diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php index a45c9c9c5fd8d..0ff799ba9bbc3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php @@ -16,7 +16,6 @@ use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\StyleInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; /** @@ -60,7 +59,7 @@ protected function listBundles($output) /** * @return ExtensionInterface */ - protected function findExtension($name, ContainerBuilder $container) + protected function findExtension($name) { $bundles = $this->initializeBundles(); $minScore = \INF; @@ -82,6 +81,8 @@ protected function findExtension($name, ContainerBuilder $container) } } + $container = $this->getContainerBuilder(); + if ($container->hasExtension($name)) { return $container->getExtension($name); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php index aa36b1fa80bdb..a0623f396127b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php @@ -79,9 +79,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - $container = $this->compileContainer(); - $extension = $this->findExtension($name, $container); + $extension = $this->findExtension($name); $extensionAlias = $extension->getAlias(); + $container = $this->compileContainer(); $config = $container->resolveEnvPlaceholders( $container->getParameterBag()->resolveValue( diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php index b104a1b806ca4..17690f7c99401 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php @@ -89,10 +89,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - $container = $this->getContainerBuilder(); - $extension = $this->findExtension($name, $container); + $extension = $this->findExtension($name); - $configuration = $extension->getConfiguration([], $container); + $configuration = $extension->getConfiguration([], $this->getContainerBuilder()); $this->validateConfiguration($extension, $configuration);