Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 263e6d1

Browse filesBrowse files
committed
bug #21203 [DependencyInjection] moved up ResolveClassPass in the container pass list (fabpot)
This PR was merged into the 3.3-dev branch. Discussion ---------- [DependencyInjection] moved up ResolveClassPass in the container pass list | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | bug from #21133 | License | MIT | Doc PR | n/a Some compiler passes need access to the service class names. But when using an empty class name (the service id being the class name), the resolution happens too late (during the optimization step). This PR fixes this by moving up the ResolveClassPass earlier in the stack. Commits ------- 2e5b69f [DependencyInjection] moved up ResolveClassPass in the container pass list
2 parents 95043b2 + 2e5b69f commit 263e6d1
Copy full SHA for 263e6d1

File tree

2 files changed

+9
-2
lines changed
Filter options

2 files changed

+9
-2
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ public function __construct()
3939
{
4040
$this->mergePass = new MergeExtensionConfigurationPass();
4141

42+
$this->beforeOptimizationPasses = array(
43+
100 => array(
44+
$resolveClassPass = new ResolveClassPass(),
45+
),
46+
);
47+
4248
$this->optimizationPasses = array(array(
4349
new ExtensionCompilerPass(),
44-
$resolveClassPass = new ResolveClassPass(),
4550
new ResolveDefinitionTemplatesPass(),
4651
new DecoratorServicePass(),
4752
new ResolveParameterPlaceHoldersPass(),

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/PassConfigTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/PassConfigTest.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public function testPassOrdering()
2929
$pass2 = $this->getMockBuilder(CompilerPassInterface::class)->getMock();
3030
$config->addPass($pass2, PassConfig::TYPE_BEFORE_OPTIMIZATION, 30);
3131

32-
$this->assertSame(array($pass2, $pass1), $config->getBeforeOptimizationPasses());
32+
$passes = $config->getBeforeOptimizationPasses();
33+
$this->assertSame($pass2, $passes[1]);
34+
$this->assertSame($pass1, $passes[2]);
3335
}
3436
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.