Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[DependencyInjection] Add a mechanism to deprecate public services to private#36470
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[DependencyInjection] Add a mechanism to deprecate public services to private#36470
Uh oh!
There was an error while loading.Please reload this page.
Conversation
e080ce2
to51e8723
Comparesrc/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/DependencyInjection/Compiler/AliasDeprecatedPublicServicesPass.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/DependencyInjection/Compiler/AliasDeprecatedPublicServicesPass.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
51e8723
toe1b3324
Comparee1b3324
to0df92cb
Comparesrc/Symfony/Component/DependencyInjection/Compiler/AliasDeprecatedPublicServicesPass.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
0df92cb
toff01714
CompareThere 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.
Minor things and GTM.
src/Symfony/Component/DependencyInjection/Compiler/AliasDeprecatedPublicServicesPass.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/DependencyInjection/Compiler/AliasDeprecatedPublicServicesPass.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/DependencyInjection/Compiler/AliasDeprecatedPublicServicesPass.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
ff01714
to0a8853b
Compare0a8853b
to3e80e46
CompareThank you@fancyweb. |
… private container to remove false-positive deprecations (nicolas-grekas)This PR was merged into the 5.1 branch.Discussion----------[FrameworkBundle] acces public-deprecated services via the private container to remove false-positive deprecations| Q | A| ------------- | ---| Branch? | 5.1| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | -| License | MIT| Doc PR | -Something we missed in#36470 apparently.Commits-------d502ba9 [FrameworkBundle] acces public-deprecated services via the private container to remove false-positive deprecations
Uh oh!
There was an error while loading.Please reload this page.
This PR adds a mechanism to easily deprecate public services to private, ie a public service will be private in a next version.
It works with a tag and a compiler pass. The pass creates a deprecated public alias of the public service.
It is ran "after removing" because we want to trigger only on direct accesses to the public service (
$container->get()
): if the public service was removed, we don't need to do anything because there is no impact.All references to the public service are kept because the deprecated public alias is created afterResolveReferencesToAliasesPass
so only direct access actually uses the deprecated alias.All references to the public service are altered to a direct reference to the alias target service so that they don't trigger the alias deprecation.
Thanks to@nicolas-grekas for sharing some ideas and helping me !