Skip to content

Commit

Permalink
bug #18596 [DI] Fix internal caching in AutowirePass (nicolas-grekas)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nicolas-grekas committed Apr 20, 2016
2 parents 44e3664 + ed2e236 commit d1038c3
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -228,7 +228,7 @@ private function createAutowiredDefinition(\ReflectionClass $typeHint, $id)
* @param string $id
* @param Definition $definition
*
* @return \ReflectionClass|null
* @return \ReflectionClass|false
*/
private function getReflectionClass($id, Definition $definition)
{
Expand All @@ -238,15 +238,17 @@ private function getReflectionClass($id, Definition $definition)

// 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;
}
}

0 comments on commit d1038c3

Please sign in to comment.