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

[DependencyInjection] Fix checking for interfaces in ContainerBuilder::getReflectionClass()#58822

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

Conversation

donquixote
Copy link
Contributor

@donquixotedonquixote commentedNov 9, 2024
edited
Loading

QA
Branch?5.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#58821.
LicenseMIT

Currently,ContainerBuilder::getReflectionClass() supports interfaces only ifsymfony/config package is present.
With this fix, it will do so withoutsymfony/config.

Always add tests and ensure they pass.

Not sure how to do this.
All tests run in the monorepo, with all packages present, soclass_exists(ClassExistenceResource::class) will always be TRUE.
To make this testable, we should make the condition dependent on resource tracking.

Never break backward compatibility (seehttps://symfony.com/bc).

This is TBD.
This change would enable autowire for some services where this was previously not the case.

@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "7.2" but it seems your PR description refers to branch "5.4 or 7.2, TBD".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

@carsonbotcarsonbot changed the titleIssue #58821: [DependencyInjection] Support interfaces in ContainerBuilder::getReflectionClass()[DependencyInjection] Issue #58821: Support interfaces in ContainerBuilder::getReflectionClass()Nov 9, 2024
@derrabus
Copy link
Member

This looks like a bugfix to me. Please target 5.4.

@donquixotedonquixoteforce-pushed theissue-58821-ContainerBuilder-support-interfaces branch from6f2be11 to1c3690bCompareNovember 10, 2024 01:02
@donquixotedonquixote changed the base branch from7.2 to5.4November 10, 2024 01:03
@donquixote
Copy link
ContributorAuthor

This looks like a bugfix to me. Please target 5.4.

Let's see if there is consensus that this is a bug fix.

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.

LGTM after some minor changes

@@ -369,7 +369,7 @@ public function getReflectionClass(?string $class, bool $throw = true): ?\Reflec
$resource = new ClassExistenceResource($class, false);
$classReflector = $resource->isFresh(0) ? false : new \ReflectionClass($class);
} else {
$classReflector = class_exists($class) ? new \ReflectionClass($class) : false;
$classReflector =(class_exists($class) || interface_exists($class)) ? new \ReflectionClass($class) : false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
$classReflector =(class_exists($class) ||interface_exists($class)) ?new \ReflectionClass($class) :false;
$classReflector =class_exists($class) ||interface_exists($class,false) ?new \ReflectionClass($class) :false;

derrabus reacted with thumbs up emoji
@nicolas-grekasnicolas-grekas modified the milestones:7.2,5.4Nov 13, 2024
@nicolas-grekasnicolas-grekas changed the title[DependencyInjection] Issue #58821: Support interfaces in ContainerBuilder::getReflectionClass()[DependencyInjection] Fix checking for interfaces in ContainerBuilder::getReflectionClass()Nov 14, 2024
@nicolas-grekasnicolas-grekasforce-pushed theissue-58821-ContainerBuilder-support-interfaces branch from1c3690b to6166e8fCompareNovember 20, 2024 10:52
@nicolas-grekas
Copy link
Member

Thank you@donquixote.

@nicolas-grekasnicolas-grekas merged commitcf20e09 intosymfony:5.4Nov 20, 2024
10 of 12 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

Assignees
No one assigned
Projects
None yet
Milestone
5.4
Development

Successfully merging this pull request may close these issues.

[DependencyInjection] ContainerBuilder::getReflectionClass() does not support interfaces, if symfony/config package not present
4 participants
@donquixote@carsonbot@derrabus@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp