-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Service auto-registration error message still exists #25959
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
Milestone
Comments
The bug must also exist in 3.4, when strict mode is on. |
You're right - updated the PR and milestone accordingly. |
Aren't there circumstances where autoregistration still happens? Like explained in #22295 (comment) and #22306 |
@Tobion It eventually got totally deprecated in 3.4 and removed in 4.0. It's kinda nice: in 4.0 there is 0 auto-registration from autowiring |
This was referenced Mar 22, 2018
nicolas-grekas
added a commit
that referenced
this issue
Mar 22, 2018
… mode (nicolas-grekas) This PR was merged into the 3.4 branch. Discussion ---------- [DI] Dont tell about autoregistration in strict autowiring mode | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #25959 | License | MIT | Doc PR | - Commits ------- 5e922db [DI] Dont tell about autoregistration in strict autowiring mode
nicolas-grekas
added a commit
that referenced
this issue
Mar 22, 2018
…kas) This PR was merged into the 4.0 branch. Discussion ---------- [DI] Cleanup remainings from autoregistration | Q | A | ------------- | --- | Branch? | 4.0 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #25959 | License | MIT | Doc PR | - Commits ------- 74afff8 [DI] Cleanup remainings from autoregistration
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just a minor thing: in 4.0 (or 3.4 with strict mode on), we removed the "service auto-registration" functionality of autowiring (i.e. where autowiring would automatically register a service for you if non existed for a class). But, the error message and some related code still exists:
symfony/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
Line 363 in 7693469
Unless I'm mistaken, this stuff should be removed in 4.0: the error message should not mention anything about auto-registration :). But, it's not as simple as just removing the if statement - in practice, the final error doesn't quite make sense.
To repeat the situation:
Type-hint some vendor class (e.g.
MyLib\FooClient
that has a service in the container (e.g.my_lib.foo_client
, but does not have an autowireable alias.The error will mention auto-registration. But if you simply remove the last
elseif
, the final message will also not make sense: it should suggest adding an alias fromMyLib\FooClient
tomy_lib.foo_client
.The text was updated successfully, but these errors were encountered: