File tree Expand file tree Collapse file tree 6 files changed +33
-1
lines changed
Expand file tree Collapse file tree 6 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,8 @@ DependencyInjection
184184
185185 * Top-level anonymous services in XML are no longer supported.
186186
187+ * The `ExtensionCompilerPass` has been moved to before-optimization passes with priority -1000.
188+
187189EventDispatcher
188190---------------
189191
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ CHANGELOG
443.4.0
55-----
66
7+ * moved the ` ExtensionCompilerPass ` to before-optimization passes with priority -1000
78 * deprecated "public-by-default" definitions and aliases, the new default will be "private" in 4.0
89 * added ` EnvVarProcessorInterface ` and corresponding "container.env_var_processor" tag for processing env vars
910 * added support for ignore-on-uninitialized references
Original file line number Diff line number Diff line change @@ -45,10 +45,10 @@ public function __construct()
4545 new ResolveInstanceofConditionalsPass (),
4646 new RegisterEnvVarProcessorsPass (),
4747 ),
48+ -1000 => array (new ExtensionCompilerPass ()),
4849 );
4950
5051 $ this ->optimizationPasses = array (array (
51- new ExtensionCompilerPass (),
5252 new ResolveChildDefinitionsPass (),
5353 new ServiceLocatorTagPass (),
5454 new DecoratorServicePass (),
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ CHANGELOG
443.4.0
55-----
66
7+ * made kernels implementing ` CompilerPassInterface ` able to process the container
78 * deprecated bundle inheritance
89 * added ` RebootableInterface ` and implemented it in ` Kernel `
910 * deprecated commands auto registration
Original file line number Diff line number Diff line change 1313
1414use Symfony \Bridge \ProxyManager \LazyProxy \Instantiator \RuntimeInstantiator ;
1515use Symfony \Bridge \ProxyManager \LazyProxy \PhpDumper \ProxyDumper ;
16+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
17+ use Symfony \Component \DependencyInjection \Compiler \PassConfig ;
1618use Symfony \Component \DependencyInjection \ContainerInterface ;
1719use Symfony \Component \DependencyInjection \ContainerBuilder ;
1820use Symfony \Component \DependencyInjection \Dumper \PhpDumper ;
@@ -767,6 +769,9 @@ protected function getContainerBuilder()
767769 $ container = new ContainerBuilder ();
768770 $ container ->getParameterBag ()->add ($ this ->getKernelParameters ());
769771
772+ if ($ this instanceof CompilerPassInterface) {
773+ $ container ->addCompilerPass ($ this , PassConfig::TYPE_BEFORE_OPTIMIZATION , -10000 );
774+ }
770775 if (class_exists ('ProxyManager\Configuration ' ) && class_exists ('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator ' )) {
771776 $ container ->setProxyInstantiator (new RuntimeInstantiator ());
772777 }
Original file line number Diff line number Diff line change 1313
1414use PHPUnit \Framework \TestCase ;
1515use Symfony \Component \Config \Loader \LoaderInterface ;
16+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
1617use Symfony \Component \DependencyInjection \ContainerBuilder ;
1718use Symfony \Component \Filesystem \Filesystem ;
1819use Symfony \Component \HttpKernel \Bundle \BundleInterface ;
@@ -831,6 +832,14 @@ public function testKernelReset()
831832 $ this ->assertFileNotExists ($ containerFile );
832833 }
833834
835+ public function testKernelPass ()
836+ {
837+ $ kernel = new PassKernel ();
838+ $ kernel ->boot ();
839+
840+ $ this ->assertTrue ($ kernel ->getContainer ()->getParameter ('test.processed ' ));
841+ }
842+
834843 /**
835844 * Returns a mock for the BundleInterface.
836845 *
@@ -967,3 +976,17 @@ protected function build(ContainerBuilder $container)
967976 }
968977 }
969978}
979+
980+ class PassKernel extends CustomProjectDirKernel implements CompilerPassInterface
981+ {
982+ public function __construct (\Closure $ buildContainer = null )
983+ {
984+ parent ::__construct ();
985+ Kernel::__construct ('pass ' , true );
986+ }
987+
988+ public function process (ContainerBuilder $ container )
989+ {
990+ $ container ->setParameter ('test.processed ' , true );
991+ }
992+ }
You can’t perform that action at this time.
0 commit comments