[DI] dont track classes/interfaces used to compute autowiring error messages
This commit is contained in:
parent
3ed98de837
commit
09a0c23668
@ -452,7 +452,17 @@ class AutowirePass extends AbstractRecursivePass
|
||||
|
||||
private function createTypeNotFoundMessage(TypedReference $reference, $label)
|
||||
{
|
||||
if (!$r = $this->container->getReflectionClass($type = $reference->getType(), false)) {
|
||||
$trackResources = $this->container->isTrackingResources();
|
||||
$this->container->setResourceTracking(false);
|
||||
try {
|
||||
if ($r = $this->container->getReflectionClass($type = $reference->getType(), false)) {
|
||||
$alternatives = $this->createTypeAlternatives($reference);
|
||||
}
|
||||
} finally {
|
||||
$this->container->setResourceTracking($trackResources);
|
||||
}
|
||||
|
||||
if (!$r) {
|
||||
// either $type does not exist or a parent class does not exist
|
||||
try {
|
||||
$resource = new ClassExistenceResource($type, false);
|
||||
@ -465,7 +475,6 @@ class AutowirePass extends AbstractRecursivePass
|
||||
|
||||
$message = sprintf('has type "%s" but this class %s.', $type, $parentMsg ? sprintf('is missing a parent class (%s)', $parentMsg) : 'was not found');
|
||||
} else {
|
||||
$alternatives = $this->createTypeAlternatives($reference);
|
||||
$message = $this->container->has($type) ? 'this service is abstract' : 'no such service exists';
|
||||
$message = sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $alternatives);
|
||||
|
||||
|
@ -364,7 +364,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
try {
|
||||
if (isset($this->classReflectors[$class])) {
|
||||
$classReflector = $this->classReflectors[$class];
|
||||
} elseif ($this->trackResources) {
|
||||
} elseif (class_exists(ClassExistenceResource::class)) {
|
||||
$resource = new ClassExistenceResource($class, false);
|
||||
$classReflector = $resource->isFresh(0) ? false : new \ReflectionClass($class);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user