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

[PropertyInfo] Fix getting type from constructor of parent class inPhpStanExtractor#61752

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
nicolas-grekas merged 1 commit intosymfony:7.3fromwuchen90:fix-phpstan-extractor
Sep 15, 2025

Conversation

@wuchen90
Copy link
Contributor

QA
Branch?7.3
Bug fix?yes
New feature?no
Deprecations?no
LicenseMIT

The PhpStanExtractor fails when we try to resolve the type of a constructor argument that is declared in parent class.
It is mainly because the TypeContextFactory doesn't get all theuses of parent classes.

@carsonbotcarsonbot added this to the7.3 milestoneSep 15, 2025
@OskarStarkOskarStark changed the title[PropertyInfo] Fix getting type from constructor of parent class in PhpStanExtractor[PropertyInfo] Fix getting type from constructor of parent class inPhpStanExtractorSep 15, 2025
@nicolas-grekas
Copy link
Member

Thank you@wuchen90.

@nicolas-grekasnicolas-grekas merged commit1ed06ec intosymfony:7.3Sep 15, 2025
if (!$rawDocNode =$reflectionConstructor->getDocComment()) {
returnnull;
}
$class =$reflectionConstructor->class;

Choose a reason for hiding this comment

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

I updated the code to simplify the implementation and remove repeated code.

@fabpotfabpot mentioned this pull requestSep 27, 2025
@wuchen90wuchen90 deleted the fix-phpstan-extractor branchOctober 2, 2025 13:01
nicolas-grekas added a commit that referenced this pull requestOct 6, 2025
…th templates (HypeMC)This PR was merged into the 7.3 branch.Discussion----------[PropertyInfo][TypeInfo] Fix resolving constructor type with templates| Q             | A| ------------- | ---| Branch?       | 7.3| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        | -| License       | MIT#61752 broke the resolution of templated types.Consider the following code:```php/** * `@template` T of object */abstract class ParentClass{    /**     * `@param` list<T> $items     */    public function __construct(        public array $items,    ) {    }}/** * `@template` T of SomeClass * * `@extends` ParentClass<T> */class ChildClass extends ParentClass{}$serializer->deserialize($jsonPayload, ChildClass::class, 'json');```Before that PR, after deserialization, `$items` would correctly contain a list of `SomeClass` instances.Now it no longer works, `$items` is a list of associative arrays instead.Commits-------7ad51ea [PropertyInfo][TypeInfo] Fix resolving constructor type with templates
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

@stofstofstof left review comments

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

7.3

Development

Successfully merging this pull request may close these issues.

4 participants

@wuchen90@nicolas-grekas@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp