diff --git a/extra/twig-extra-bundle/TwigExtraBundle.php b/extra/twig-extra-bundle/TwigExtraBundle.php index e2d181145f6..f182f2f3f09 100644 --- a/extra/twig-extra-bundle/TwigExtraBundle.php +++ b/extra/twig-extra-bundle/TwigExtraBundle.php @@ -13,15 +13,17 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; +use Symfony\Component\HttpKernel\Kernel; use Twig\Extra\TwigExtraBundle\DependencyInjection\Compiler\MissingExtensionSuggestorPass; -if (!method_exists(ContainerBuilder::class, 'getAutoconfiguredAttributes')) { +$refMethod = new \ReflectionMethod(\Symfony\Component\HttpKernel\Bundle\Bundle::class, 'build'); + +if (Kernel::MAJOR_VERSION >= 8) { class TwigExtraBundle extends Bundle { public function build(ContainerBuilder $container): void { parent::build($container); - $container->addCompilerPass(new MissingExtensionSuggestorPass()); } } @@ -32,8 +34,8 @@ class TwigExtraBundle extends Bundle public function build(ContainerBuilder $container) { parent::build($container); - $container->addCompilerPass(new MissingExtensionSuggestorPass()); } } } +