From d57bd0e4ced7a8c9121fb8e598cc06de992e0243 Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Tue, 2 Dec 2025 20:26:22 -0500 Subject: [PATCH 1/3] check for return type --- extra/twig-extra-bundle/TwigExtraBundle.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extra/twig-extra-bundle/TwigExtraBundle.php b/extra/twig-extra-bundle/TwigExtraBundle.php index e2d181145f6..b624e796988 100644 --- a/extra/twig-extra-bundle/TwigExtraBundle.php +++ b/extra/twig-extra-bundle/TwigExtraBundle.php @@ -15,13 +15,14 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; use Twig\Extra\TwigExtraBundle\DependencyInjection\Compiler\MissingExtensionSuggestorPass; -if (!method_exists(ContainerBuilder::class, 'getAutoconfiguredAttributes')) { +$refMethod = new \ReflectionMethod(\Symfony\Component\HttpKernel\Bundle\Bundle::class, 'build'); + +if ($refMethod->hasReturnType()) { class TwigExtraBundle extends Bundle { public function build(ContainerBuilder $container): void { parent::build($container); - $container->addCompilerPass(new MissingExtensionSuggestorPass()); } } @@ -32,8 +33,8 @@ class TwigExtraBundle extends Bundle public function build(ContainerBuilder $container) { parent::build($container); - $container->addCompilerPass(new MissingExtensionSuggestorPass()); } } } + From 10a1daba791de25a533a9a7566c129d627cde6ff Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Wed, 3 Dec 2025 05:21:40 -0500 Subject: [PATCH 2/3] Update extra/twig-extra-bundle/TwigExtraBundle.php Co-authored-by: Christian Flothmann --- extra/twig-extra-bundle/TwigExtraBundle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/twig-extra-bundle/TwigExtraBundle.php b/extra/twig-extra-bundle/TwigExtraBundle.php index b624e796988..2e447a3cb21 100644 --- a/extra/twig-extra-bundle/TwigExtraBundle.php +++ b/extra/twig-extra-bundle/TwigExtraBundle.php @@ -17,7 +17,7 @@ $refMethod = new \ReflectionMethod(\Symfony\Component\HttpKernel\Bundle\Bundle::class, 'build'); -if ($refMethod->hasReturnType()) { +if (Kernel::MAJOR_VERSION >= 8) { class TwigExtraBundle extends Bundle { public function build(ContainerBuilder $container): void From 9aec2b6840054e87fd093c6d1e7d6896e786525f Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Wed, 3 Dec 2025 05:21:57 -0500 Subject: [PATCH 3/3] Update extra/twig-extra-bundle/TwigExtraBundle.php Co-authored-by: Christian Flothmann --- extra/twig-extra-bundle/TwigExtraBundle.php | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/twig-extra-bundle/TwigExtraBundle.php b/extra/twig-extra-bundle/TwigExtraBundle.php index 2e447a3cb21..f182f2f3f09 100644 --- a/extra/twig-extra-bundle/TwigExtraBundle.php +++ b/extra/twig-extra-bundle/TwigExtraBundle.php @@ -13,6 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; +use Symfony\Component\HttpKernel\Kernel; use Twig\Extra\TwigExtraBundle\DependencyInjection\Compiler\MissingExtensionSuggestorPass; $refMethod = new \ReflectionMethod(\Symfony\Component\HttpKernel\Bundle\Bundle::class, 'build');