-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[DependencyInjection] Allow extensions to register compiler passes #50444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Symfony/Component/DependencyInjection/Extension/CompilerPassProvidingExtensionInterface.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Extension/AbstractExtension.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Extension/AbstractExtension.php
Outdated
Show resolved
Hide resolved
derrabus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking the merge because there are no tests. 😉
yceruto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've the same need in some projects. Thanks for working on it!
src/Symfony/Component/DependencyInjection/Extension/AbstractExtension.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Extension/AbstractExtension.php
Outdated
Show resolved
Hide resolved
|
Thanks for the reviews. PR is updated by only introducing an There is one decision left: Should we move the |
|
Please keep merge blocked: One test failure is related (need a BC layer for |
76e8814 to
a1b35cf
Compare
|
Status: Needs review The tests failures that are remaining are unrelated. |
|
Would it make sense to deprecate |
Clearly not yet. Having the same version adding a new way to register compiler passes and deprecating the existing way would be a nightmare for the ecosystem. Side note, the comment in #50444 (comment) makes me think that we might not want to deprecate it at all. |
2d31d36 to
d25fa13
Compare
|
Precedence fixed and updated the PR description to match current state. Ready to merge as far as I'm concerned. |
d25fa13 to
5261b5b
Compare
5261b5b to
ca75703
Compare
|
The failing test revealed a conflict when you have a class As the primary use-case of this PR is already supported (#13761), I'll close here. If someone else is interested in this feature, feelf free to continue with what's available in this PR :) |
Without the bundle system, the DI extension is sometimes used for plugins/add-ons in projects. I've recently introduced this to the phpdocumentor/guides package (which will probably be the new RST parser that we're going to use at symfony.com some time in the future).
To make the DI extension fully workable as a plugin class, it would be great if it could also register compiler passes. This PR introduces a new method for this purpose:
ExtensionInterface::build()Most users will probably not get a deprecation, asExtensionhas a default implementation.Build precedence is:
KernelInterface::build()>BundleInterface::build()>ExtensionInterface::build()