File tree 6 files changed +33
-1
lines changed
6 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,8 @@ DependencyInjection
184
184
185
185
* Top-level anonymous services in XML are no longer supported.
186
186
187
+ * The `ExtensionCompilerPass` has been moved to before-optimization passes with priority -1000.
188
+
187
189
EventDispatcher
188
190
---------------
189
191
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ CHANGELOG
4
4
3.4.0
5
5
-----
6
6
7
+ * moved the ` ExtensionCompilerPass ` to before-optimization passes with priority -1000
7
8
* deprecated "public-by-default" definitions and aliases, the new default will be "private" in 4.0
8
9
* added ` EnvVarProcessorInterface ` and corresponding "container.env_var_processor" tag for processing env vars
9
10
* added support for ignore-on-uninitialized references
Original file line number Diff line number Diff line change @@ -45,10 +45,10 @@ public function __construct()
45
45
new ResolveInstanceofConditionalsPass (),
46
46
new RegisterEnvVarProcessorsPass (),
47
47
),
48
+ -1000 => array (new ExtensionCompilerPass ()),
48
49
);
49
50
50
51
$ this ->optimizationPasses = array (array (
51
- new ExtensionCompilerPass (),
52
52
new ResolveChildDefinitionsPass (),
53
53
new ServiceLocatorTagPass (),
54
54
new DecoratorServicePass (),
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ CHANGELOG
4
4
3.4.0
5
5
-----
6
6
7
+ * made kernels implementing ` CompilerPassInterface ` able to process the container
7
8
* deprecated bundle inheritance
8
9
* added ` RebootableInterface ` and implemented it in ` Kernel `
9
10
* deprecated commands auto registration
Original file line number Diff line number Diff line change 13
13
14
14
use Symfony \Bridge \ProxyManager \LazyProxy \Instantiator \RuntimeInstantiator ;
15
15
use Symfony \Bridge \ProxyManager \LazyProxy \PhpDumper \ProxyDumper ;
16
+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
17
+ use Symfony \Component \DependencyInjection \Compiler \PassConfig ;
16
18
use Symfony \Component \DependencyInjection \ContainerInterface ;
17
19
use Symfony \Component \DependencyInjection \ContainerBuilder ;
18
20
use Symfony \Component \DependencyInjection \Dumper \PhpDumper ;
@@ -767,6 +769,9 @@ protected function getContainerBuilder()
767
769
$ container = new ContainerBuilder ();
768
770
$ container ->getParameterBag ()->add ($ this ->getKernelParameters ());
769
771
772
+ if ($ this instanceof CompilerPassInterface) {
773
+ $ container ->addCompilerPass ($ this , PassConfig::TYPE_BEFORE_OPTIMIZATION , -10000 );
774
+ }
770
775
if (class_exists ('ProxyManager\Configuration ' ) && class_exists ('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator ' )) {
771
776
$ container ->setProxyInstantiator (new RuntimeInstantiator ());
772
777
}
Original file line number Diff line number Diff line change 13
13
14
14
use PHPUnit \Framework \TestCase ;
15
15
use Symfony \Component \Config \Loader \LoaderInterface ;
16
+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
16
17
use Symfony \Component \DependencyInjection \ContainerBuilder ;
17
18
use Symfony \Component \Filesystem \Filesystem ;
18
19
use Symfony \Component \HttpKernel \Bundle \BundleInterface ;
@@ -831,6 +832,14 @@ public function testKernelReset()
831
832
$ this ->assertFileNotExists ($ containerFile );
832
833
}
833
834
835
+ public function testKernelPass ()
836
+ {
837
+ $ kernel = new PassKernel ();
838
+ $ kernel ->boot ();
839
+
840
+ $ this ->assertTrue ($ kernel ->getContainer ()->getParameter ('test.processed ' ));
841
+ }
842
+
834
843
/**
835
844
* Returns a mock for the BundleInterface.
836
845
*
@@ -967,3 +976,17 @@ protected function build(ContainerBuilder $container)
967
976
}
968
977
}
969
978
}
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