Repository navigation
feat: support phpdocumentor/reflection-docblock 6 and type-resolver 2 #840
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
oojacoboo
merged 2 commits into
thecodingmachine:master
from
timtheisinger:feat/reflection-docblock-6
Oct 15, 2026
+67
−6
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Why do we only pass the last type of the
$type->getTypes()for the OutputType? Does this mean support for union and intersection types aren't properly supported here?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.
We're working with lists here and want to get the type of items in that list. For all common PHP list types like
ArrayObjectorIterator(not true forGenerator) this should be last the type parameter. This behavior is also exactly whatgetValueTypedid in type-resolver v1.See: https://github.com/phpDocumentor/TypeResolver/blob/1.12.0/src/TypeResolver.php#L457-L466
https://github.com/phpDocumentor/TypeResolver/blob/1.12.0/src/Types/Collection.php#L40
It reverses the params and the last one lands in
valueType.I'm not sure exactly what you mean by missing support for unions/intersections. For example if we have a
\ArrayObject<int, A&B>, the whole intersectionA&Bwill be the value type, as before. The tests cover this already as far as I can see.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.
@timtheisinger what does
getTypesreturn for a phpdoc like:@return \ArrayObject<int, A&B>|boolThere 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.
I'm not sure but
getTypes()on the outer type isn't called.\ArrayObject<int, A&B>|boolis aCompound, and only its\ArrayObject<int, A&B>part reaches this branch, withgetTypes()=[int, A&B].I found another problem though.
Genericis anObject_, unlikeCollection, soIteratorTypeMappertreated it as a raw iterator when looking at\ArrayObject|User[].\ArrayObject<int, A>|boolthen mapped to[A!]!and silently droppedbool, where type-resolver 1 threw. Fixed this and added tests.I compared these cases:
\ArrayObject<int, A>|bool[A!]!,boolsilently dropped\ArrayObject<int, A>|B[A!]!,Bdropped\ArrayObject<int, A>|B[][A!]!,B[]dropped\ArrayObject<int, A&B>A&B\ArrayObject<int, A|B>,…|nullUh oh!
There was an error while loading. Please reload this page.
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.
@timtheisinger The errors are preferred in these cases, as it let's the developer know that it's not supported. Silently dropping is misleading.
Uh oh!
There was an error while loading. Please reload this page.
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.
If we can improve the error handling around this as well, so that it's more descriptive of the actual issue, that's a plus
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.
The table I added was the behavior before my newest commit (my bad). It now errors instead of dropping, same as before.
I just did a minimal fix and didn't look into that. I'd rather keep this PR minimal though if that's ok.
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.
@timtheisinger I've read over your tests and see now - thanks
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.
Cool! Do you have an idea when the next release might be come out?
Uh oh!
There was an error while loading. Please reload this page.
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.
We have some pretty large changes that recently got merged. I'd like to give it a little time to see if there are any bug reports. It's a breaking release. Soon though.
You're welcome to target
dev-masterin the meantime.