Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #18022 [DependencyInjection] Sort the CompilerPass by priorit…
…y (Ener-Getick) This PR was squashed before being merged into the 3.2-dev branch (closes #18022). Discussion ---------- [DependencyInjection] Sort the CompilerPass by priority | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10778 | License | MIT | Doc PR | This PR replaces the CompilerPass types by a new priority argument. Sometimes we want to be sure that a CompilerPass will be executed after another but we can't do that because we don't know when the other pass will be added. This PR fixes this by allowing people to simply choose when their compiler passes will be executed. Things to debate: - the constants value - should we create a new function to get/set passes for a specific priority ? Commits ------- d17c1a9 [DependencyInjection] Sort the CompilerPass by priority
- Loading branch information
Showing
6 changed files
with
139 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/Symfony/Component/DependencyInjection/Tests/Compiler/PassConfigTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Tests\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\PassConfig; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
|
||
/** | ||
* @author Guilhem N <egetick@gmail.com> | ||
*/ | ||
class PassConfigTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testPassOrdering() | ||
{ | ||
$config = new PassConfig(); | ||
|
||
$pass1 = $this->getMock(CompilerPassInterface::class); | ||
$config->addPass($pass1, PassConfig::TYPE_BEFORE_OPTIMIZATION, 10); | ||
|
||
$pass2 = $this->getMock(CompilerPassInterface::class); | ||
$config->addPass($pass2, PassConfig::TYPE_BEFORE_OPTIMIZATION, 30); | ||
|
||
$this->assertSame(array($pass2, $pass1), $config->getBeforeOptimizationPasses()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters