-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Deprecate/remove autowiring "auto-create" Definition functionality #23350
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
Labels
Milestone
Comments
👍 |
2 similar comments
👍 |
👍 |
Yeah, it also creates WTF debugging moments, when you get error messages related to an autocreated services sometimes while you expected your own service: #23325 👍 from me. |
@weaverryan I think you can safely work on a PR :) |
Haha, indeed... except I was hoping someone else would beat me to it ;). But if not, I'll get to it! |
This gave me some WTF moments, so 👍 PSR-4 is just fine |
nicolas-grekas
added a commit
that referenced
this issue
Aug 3, 2017
…o-registration (GuilhemN) This PR was squashed before being merged into the 3.4 branch (closes #23712). Discussion ---------- [DependencyInjection] Deprecate autowiring service auto-registration | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | yes <!-- don't forget updating UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | #23350 | License | MIT | Doc PR | Fix #23350, to make autowiring more predictable. Commits ------- 969a207 [DependencyInjection] Deprecate autowiring service auto-registration
symfony-splitter
pushed a commit
to symfony/dependency-injection
that referenced
this issue
Aug 3, 2017
…o-registration (GuilhemN) This PR was squashed before being merged into the 3.4 branch (closes #23712). Discussion ---------- [DependencyInjection] Deprecate autowiring service auto-registration | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | yes <!-- don't forget updating UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | symfony/symfony#23350 | License | MIT | Doc PR | Fix symfony/symfony#23350, to make autowiring more predictable. Commits ------- 969a207 [DependencyInjection] Deprecate autowiring service auto-registration
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current autowiring behavior is:
In #22295, @nicolas-grekas proposed removing this. But, we decided not to, because it meant that all services would need to be explicitly wired. But with the PSR-4 service loader, that's not true anymore.
We should deprecate this "auto-registration" functionality from
AutowirePass
(symfony/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
Lines 422 to 461 in d7992dc
This "auto-registration" in AutowirePass is problematic because we can't apply instanceof to those definitions... which is a bit unexpected. Removing it also simplifies the autowiring logic: there's one less case to explain. I chatted with @dunglas about this already (https://twitter.com/dunglas/status/881557361042894849).
The text was updated successfully, but these errors were encountered: