Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged

Conversation

@weaverryan
Copy link
Member

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
TicketsNone
LicenseMIT
Doc PRnot needed

Imagine thatFooInterface is an alias, but it is deprecated and so has aclass_alias toBarInterface. Currently,debug:autowiring will 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 toDescriptor::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 deprecatedDoctrine\Common\Persistence\ManagerRegistry vs newerDoctrine\Persistence\ManagerRegistry causes the issue.

Thanks!


$tester =newApplicationTester($application);
$tester->run(['command' =>'debug:autowiring','search' =>'ClassAlias','--all' =>true]);
$this->assertStringContainsString('Symfony\Bundle\FrameworkBundle\Tests\Fixtures\ClassAliasExampleClass (public)',$tester->getDisplay());
Copy link
MemberAuthor

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\ClassAliasTargetClass

It 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.

@weaverryanweaverryanforce-pushed thedebug-autowiring-class-aliases branch from36a0972 tod34b437CompareApril 21, 2020 18:43
@nicolas-grekasnicolas-grekas added this to the4.4 milestoneApr 21, 2020
Copy link
Member

@nicolas-grekasnicolas-grekas left a 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 :)

weaverryan reacted with laugh emoji
@nicolas-grekasnicolas-grekas changed the titleDebug:autowiring: Fix wrong display when using class_alias[FrameworkBundle] debug:autowiring: Fix wrong display when using class_aliasApr 21, 2020
@nicolas-grekas
Copy link
Member

Thank you@weaverryan.

@nicolas-grekasnicolas-grekas merged commit2d7b0b8 intosymfony:4.4Apr 23, 2020
@weaverryanweaverryan deleted the debug-autowiring-class-aliases branchApril 24, 2020 10:11
This was referencedApr 28, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

4 participants

@weaverryan@nicolas-grekas@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp