Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle] debug:autowiring: Fix wrong display when using class_alias#36519
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
[FrameworkBundle] debug:autowiring: Fix wrong display when using class_alias#36519
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| $tester =newApplicationTester($application); | ||
| $tester->run(['command' =>'debug:autowiring','search' =>'ClassAlias','--all' =>true]); | ||
| $this->assertStringContainsString('Symfony\Bundle\FrameworkBundle\Tests\Fixtures\ClassAliasExampleClass (public)',$tester->getDisplay()); |
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.
Before the patch, the output was simple:
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\ClassAliasTargetClassIt would resolveClassAliasExampleClass toClassAliasTargetClass. To make matters worse, becauseClassAliasTargetClass is not an alias name in the system (it's not even a service in the system), it doesn't print the service id (or show up unless you pass--all) because it looks (incorrectly) like a concrete service.
36a0972 tod34b437Compare
nicolas-grekas 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.
Since you have tests and a use case, and also because I don't remember, you win :)
nicolas-grekas commentedApr 23, 2020
Thank you@weaverryan. |
Imagine that
FooInterfaceis an alias, but it is deprecated and so has aclass_aliastoBarInterface. Currently,debug:autowiringwill actually print that's the autowiring alias isBarInterface, despite there being no such id in the container.@nicolas-grekas originally (on purpose) made the 2nd argument to
Descriptor::getClassDescription()be passed by referencefor this exact feature -56aab09 - but I can't figure out why. This change (which effectively removes the by-reference modifying) made no existing tests fail.Discovered this because the whole deprecated
Doctrine\Common\Persistence\ManagerRegistryvs newerDoctrine\Persistence\ManagerRegistrycauses the issue.Thanks!