From 40e911eed767c99ae584ab44350fa1b8fe5aa616 Mon Sep 17 00:00:00 2001 From: Maxime Veber Date: Wed, 27 Oct 2021 20:23:25 +0200 Subject: [PATCH] feat: fix asset package availability detection If the package assets is available in the dependencies, Symfony will enable automatically assets. Otherwise assets are disabled. The problem is that sometimes you want to explicetely enable assets features (in the case of testing an application you may have assets as **dev** dependency). In the case assets are enable explicitely, the service assets.packages is defined and we should not remove the definition twig.extension.assets. --- .../TwigBundle/DependencyInjection/Compiler/ExtensionPass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php index a18de86e7b02d..0dc3704c60508 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php @@ -27,7 +27,7 @@ class ExtensionPass implements CompilerPassInterface { public function process(ContainerBuilder $container) { - if (!$container::willBeAvailable('symfony/asset', Packages::class, ['symfony/twig-bundle'])) { + if (!$container->hasDefinition('assets.packages') && !$container::willBeAvailable('symfony/asset', Packages::class, ['symfony/twig-bundle'])) { $container->removeDefinition('twig.extension.assets'); }