Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #13761 Automatically process extensions when they implement C…
…ompilerPassInterface (WouterJ) This PR was merged into the 2.7 branch. Discussion ---------- Automatically process extensions when they implement CompilerPassInterface | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | todo (if people are in favor of this PR) Compiler passes are very powerfull, but also quite strange to work with. Especially when you just need a very simple compiler pass (like https://github.com/symfony-cmf/RoutingBundle/blob/master/DependencyInjection/Compiler/SetRouterPass.php). For 3 lines of code, you need to tweak your bundle class and create a new class. When using the DI component standalone, compiler passes are even harder to work with, as DI extensions can't register them. I believe that's why libraries like Behat make their extensions compiler passes by default. I think it would be very easy to just implement an interface and have a `compile` method for the simple compiler pass stuff. If a bundle needs multiple compiler passes or need compiler passes to be executed at other times in the compile process, a bundle can use the normal compiler passes. But if it's just one simple thing, like replacing a definition or getting services with a specific tag, I think this method will be very usefull. Commits ------- 6c50013 Allowed extensions to inline compiler passes
- Loading branch information