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

[TypeInfo] AddPhpDocAwareReflectionTypeResolver#57618

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
fabpot merged 1 commit intosymfony:7.2frommtarld:feat/phpdoc-aware-type-resolver
Jul 25, 2024

Conversation

mtarld
Copy link
Contributor

@mtarldmtarld commentedJul 1, 2024
edited by chalasr
Loading

QA
Branch?7.2
Bug fix?no
New feature?yes
Deprecations?no
Issues
LicenseMIT

Add aPhpDocAwareReflectionTypeResolver that resolves type on reflections prioritizing PHP documentation.
The same feature already exists in thePropertyInfo component and improves DX a lot.
Installingphpstan/phpdoc-parser automatically enables this feature both using the type-info component standalone and the fullstack framework.

walva reacted with rocket emojiKocal reacted with eyes emoji
@carsonbotcarsonbot added this to the7.2 milestoneJul 1, 2024
@OskarStarkOskarStark changed the title[TypeInfo] Add PhpDocAwareReflectionTypeResolver[TypeInfo] AddPhpDocAwareReflectionTypeResolverJul 1, 2024
Copy link
Member

@chalasrchalasr left a comment

Choose a reason for hiding this comment

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

with minor comments

@wouterj
Copy link
Member

Isn't this outside the scope of TypeInfo and exactly the scope for the PropertyType component? Or what is the difference between these 2 components if TypeInfo is also going to read type information from different sources outside of PHP's native types?

@chalasr
Copy link
Member

TypeInfo is about getting the type of any PHP element including class properties but also methods, functions and their parameters. It does it by reading through the most common sources that are built-in types but also docblocks until we don't need them anymore for types.
It’s a low-level brick that PropertyInfo builds on to provide more high-level features about class properties introspection.
That low-level API is more powerful and flexible than the one PropertyInfo used to embed, which mostly needsto be deprecatedin favor of a TypeInfo integration as it appeared to be not good enough for some use cases, notably other on-going work such asjson-encoder.

mtarld reacted with thumbs up emoji

@chalasr
Copy link
Member

To illustrate more, this change unlocks makingMapRequestPayload able to guess the inner type of a list of objects mapped from the request by extracting it from the controller action's docblock (see#54385 (comment))

@mtarldmtarldforce-pushed thefeat/phpdoc-aware-type-resolver branch from00d8043 to10fc1c4CompareJuly 2, 2024 12:10
@mtarldmtarld requested a review fromdunglas as acode ownerJuly 2, 2024 12:10
@mtarldmtarldforce-pushed thefeat/phpdoc-aware-type-resolver branch from10fc1c4 to57a5c8aCompareJuly 2, 2024 13:03
@mtarldmtarldforce-pushed thefeat/phpdoc-aware-type-resolver branch from57a5c8a toc6698ceCompareJuly 3, 2024 06:46
Copy link
Contributor

@KorbeilKorbeil left a comment

Choose a reason for hiding this comment

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

Looks awesome and makes phpDoc handling way easier !
I tried to make a phpDoc example from scratch here:symfony/symfony-docs#20014 (comment) (see "Then we extract the phpDoc we want to parse" part), it is very complex without such wrapper !

chalasr reacted with thumbs up emoji
@chalasr
Copy link
Member

chalasr commentedJul 22, 2024
edited
Loading

Unless I'm mistaken the build failure should disappear once merged in 7.2 and is due to 7.2.x-dev being installed as part of property-info's test suite, while this breaks BC in the experimental TypeInfo.

@fabpot
Copy link
Member

Thank you@mtarld.

@fabpotfabpot merged commit0234e05 intosymfony:7.2Jul 25, 2024
7 of 10 checks passed
@xabbuhxabbuh mentioned this pull requestJul 25, 2024
@mtarldmtarld deleted the feat/phpdoc-aware-type-resolver branchJuly 25, 2024 09:33
fabpot added a commit that referenced this pull requestJul 26, 2024
This PR was merged into the 7.1 branch.Discussion----------[PropertyInfo] fix tests| Q             | A| ------------- | ---| Branch?       | 7.1| Bug fix?      | no| New feature?  | no| Deprecations? | no| Issues        || License       | MITfollowing#57618Commits-------7192dd1 fix tests
@fabpotfabpot mentioned this pull requestOct 27, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@OskarStarkOskarStarkOskarStark left review comments

@alexandre-dauboisalexandre-dauboisalexandre-daubois left review comments

@chalasrchalasrchalasr approved these changes

@fabpotfabpotfabpot approved these changes

@KorbeilKorbeilKorbeil approved these changes

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
7.2
Development

Successfully merging this pull request may close these issues.

8 participants
@mtarld@wouterj@chalasr@fabpot@Korbeil@OskarStark@alexandre-daubois@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp