8000 [FrameworkBundle] Always dump the container as XML · symfony/symfony@21d9c1e · GitHub
[go: up one dir, main page]

Skip to content

Commit 21d9c1e

Browse files
[FrameworkBundle] Always dump the container as XML
1 parent 16c382a commit 21d9c1e

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ protected function getContainerBuilder(KernelInterface $kernel): ContainerBuilde
3838
if ($this->containerBuilder) {
3939
return $this->containerBuilder;
4040
}
41+
$container = $kernel->getContainer();
42+
$containerDump = $container->hasParameter('debug.container.dump') ? $container->getParameter('debug.container.dump') : null;
4143

42-
if (!$kernel->isDebug() || !(new ConfigCache($kernel->getContainer()->getParameter('debug.container.dump'), true))->isFresh()) {
44+
if (null === $containerDump || !(new ConfigCache($containerDump, $kernel->isDebug()))->isFresh()) {
4345
$buildContainer = \Closure::bind(function () {
4446
$this->initializeBundles();
4547

@@ -50,7 +52,7 @@ protected function getContainerBuilder(KernelInterface $kernel): ContainerBuilde
5052
$container->getCompilerPassConfig()->setAfterRemovingPasses([]);
5153
$container->compile();
5254
} else {
53-
(new XmlFileLoader($container = new ContainerBuilder(), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump'));
55+
(new XmlFileLoader($container = new ContainerBuilder(), new FileLocator()))->load($containerDump);
5456
$locatorPass = new ServiceLocatorTagPass();
5557
$locatorPass->process($container);
5658
}

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -938,9 +938,7 @@ private function registerDebugConfiguration(array $config, ContainerBuilder $con
938938

939939
$debug = $container->getParameter('kernel.debug');
940940

941-
if ($debug) {
942-
$container->setParameter('debug.container.dump', '%kernel.build_dir%/%kernel.container_class%.xml');
943-
}
941+
$container->setParameter('debug.container.dump', '%kernel.build_dir%/%kernel.container_class%.xml');
944942

945943
if ($debug && class_exists(Stopwatch::class)) {
946944
$loader->load('debug.php');

src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ public function build(ContainerBuilder $container)
160160
$container->addCompilerPass(new RegisterReverseContainerPass(false), PassConfig::TYPE_AFTER_REMOVING);
161161
$container->addCompilerPass(new RemoveUnusedSessionMarshallingHandlerPass());
162162
$container->addCompilerPass(new SessionPass());
163+
$container->addCompilerPass(new ContainerBuilderDebugDumpPass(), PassConfig::TYPE_BEFORE_REMOVING, -255);
163164

164165
if ($container->getParameter('kernel.debug')) {
165166
$container->addCompilerPass(new AddDebugLogProcessorPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 2);
166167
$container->addCompilerPass(new UnusedTagsPass(), PassConfig::TYPE_AFTER_REMOVING);
167-
$container->addCompilerPass(new ContainerBuilderDebugDumpPass(), PassConfig::TYPE_BEFORE_REMOVING, -255);
168168
$container->addCompilerPass(new CacheCollectorPass(), PassConfig::TYPE_BEFORE_REMOVING);
169169
}
170170
}

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ public function testRememberMeCookieInheritFrameworkSessionCookie($config, $same
382382
$container->registerExtension(new FrameworkExtension());
383383
$container->setParameter('kernel.bundles_metadata', []);
384384
$container->setParameter('kernel.project_dir', __DIR__);
385+
$container->setParameter('kernel.build_dir', __DIR__);
385386
$container->setParameter('kernel.cache_dir', __DIR__);
386387
$container->setParameter('kernel.container_class', 'FooContainer');
387388

0 commit comments

Comments
 (0)
0