bug #18596 [DI] Fix internal caching in AutowirePass (nicolas-grekas)
This PR was merged into the 2.8 branch.
Discussion
----------
[DI] Fix internal caching in AutowirePass
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
ping @dunglas
Commits
-------
ed2e236
[DI] Fix internal caching in AutowirePass
This commit is contained in:
commit
d1038c3421
@ -228,7 +228,7 @@ class AutowirePass implements CompilerPassInterface
|
||||
* @param string $id
|
||||
* @param Definition $definition
|
||||
*
|
||||
* @return \ReflectionClass|null
|
||||
* @return \ReflectionClass|false
|
||||
*/
|
||||
private function getReflectionClass($id, Definition $definition)
|
||||
{
|
||||
@ -238,15 +238,17 @@ class AutowirePass implements CompilerPassInterface
|
||||
|
||||
// Cannot use reflection if the class isn't set
|
||||
if (!$class = $definition->getClass()) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
$class = $this->container->getParameterBag()->resolveValue($class);
|
||||
|
||||
try {
|
||||
return $this->reflectionClasses[$id] = new \ReflectionClass($class);
|
||||
$reflector = new \ReflectionClass($class);
|
||||
} catch (\ReflectionException $reflectionException) {
|
||||
// return null
|
||||
$reflector = false;
|
||||
}
|
||||
|
||||
return $this->reflectionClasses[$id] = $reflector;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user