Skip to content

Commit aa986d7

Browse files
[DI] reorder ExtensionCompilerPass
1 parent f032cb8 commit aa986d7

File tree

6 files changed

+4
-18
lines changed

6 files changed

+4
-18
lines changed

src/Symfony/Component/DependencyInjection/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
3.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

src/Symfony/Component/DependencyInjection/Compiler/ExtensionCompilerPass.php

-4
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,5 @@ public function process(ContainerBuilder $container)
3333

3434
$extension->process($container);
3535
}
36-
37-
if ($container->getKernelPass()) {
38-
$container->getKernelPass()->process($container);
39-
}
4036
}
4137
}

src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php

+1-1
Original file line numberDiff line numberDiff 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(),

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

-12
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
121121

122122
private $autoconfiguredInstanceof = array();
123123

124-
private $kernelPass;
125-
126124
public function __construct(ParameterBagInterface $parameterBag = null)
127125
{
128126
parent::__construct($parameterBag);
@@ -719,16 +717,6 @@ public function prependExtensionConfig($name, array $config)
719717
array_unshift($this->extensionConfigs[$name], $config);
720718
}
721719

722-
public function setKernelPass(CompilerPassInterface $kernelPass)
723-
{
724-
$this->kernelPass = $kernelPass;
725-
}
726-
727-
public function getKernelPass()
728-
{
729-
return $this->kernelPass;
730-
}
731-
732720
/**
733721
* Compiles the container.
734722
*

src/Symfony/Component/HttpKernel/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
3.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

src/Symfony/Component/HttpKernel/Kernel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ protected function getContainerBuilder()
769769
$container->getParameterBag()->add($this->getKernelParameters());
770770

771771
if ($this instanceof CompilerPassInterface) {
772-
$container->setKernelPass($this);
772+
$container->addCompilerPass($this, PassConfig::TYPE_BEFORE_OPTIMIZATION, -10000);
773773
}
774774
if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator')) {
775775
$container->setProxyInstantiator(new RuntimeInstantiator());

0 commit comments

Comments
 (0)