Kaynağa Gözat

[DependencyInjection] enable debug related passes only in debug environment

Johannes M. Schmitt 14 yıl önce
ebeveyn
işleme
49ecb90221

+ 5 - 2
src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php

@@ -82,7 +82,10 @@ class FrameworkBundle extends Bundle
         $container->addCompilerPass(new AddClassesToAutoloadMapPass());
         $container->addCompilerPass(new TranslatorPass());
         $container->addCompilerPass(new AddCacheWarmerPass());
-        $container->addCompilerPass(new ContainerBuilderDebugDumpPass(), PassConfig::TYPE_BEFORE_REMOVING);
-        $container->addCompilerPass(new CompilerDebugDumpPass(), PassConfig::TYPE_AFTER_REMOVING);
+
+        if ($container->getParameter('kernel.debug')) {
+            $container->addCompilerPass(new ContainerBuilderDebugDumpPass(), PassConfig::TYPE_BEFORE_REMOVING);
+            $container->addCompilerPass(new CompilerDebugDumpPass(), PassConfig::TYPE_AFTER_REMOVING);
+        }
     }
 }