Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b3b8e24

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

File tree

7 files changed

+7
-18
lines changed

7 files changed

+7
-18
lines changed

UPGRADE-4.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
187189
EventDispatcher
188190
---------------
189191

src/Symfony/Component/DependencyInjection/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
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

Lines changed: 0 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 12 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
1515
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
1616
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17+
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
1718
use Symfony\Component\DependencyInjection\ContainerInterface;
1819
use Symfony\Component\DependencyInjection\ContainerBuilder;
1920
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
@@ -769,7 +770,7 @@ protected function getContainerBuilder()
769770
$container->getParameterBag()->add($this->getKernelParameters());
770771

771772
if ($this instanceof CompilerPassInterface) {
772-
$container->setKernelPass($this);
773+
$container->addCompilerPass($this, PassConfig::TYPE_BEFORE_OPTIMIZATION, -10000);
773774
}
774775
if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator')) {
775776
$container->setProxyInstantiator(new RuntimeInstantiator());

0 commit comments

Comments
 (0)