Skip to content

Commit e20253c

Browse files
committed
minor #18025 [2.7] Don't use reflection when possible (Ener-Getick)
This PR was merged into the 2.7 branch. Discussion ---------- [2.7] Don't use reflection when possible | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | See symfony/symfony#18021 Commits ------- 35be501 Don't use reflections when possible
2 parents 552408c + d9a87f1 commit e20253c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

DependencyInjection/FragmentRendererPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public function process(ContainerBuilder $container)
5252
throw new \InvalidArgumentException(sprintf('The service "%s" must not be abstract as fragment renderer are lazy-loaded.', $id));
5353
}
5454

55-
$refClass = new \ReflectionClass($container->getParameterBag()->resolveValue($def->getClass()));
55+
$class = $container->getParameterBag()->resolveValue($def->getClass());
5656
$interface = 'Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface';
57-
if (!$refClass->implementsInterface($interface)) {
57+
if (!is_subclass_of($class, $interface)) {
5858
throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface));
5959
}
6060

0 commit comments

Comments
 (0)