-
-
Notifications
You must be signed in to change notification settings - Fork 431
[TypeDeclarationDocblocks] Handle multiple objects on AddReturnDocblockDataProviderRector #7298
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
Conversation
…ckDataProviderRector
|
It seems there is bug on rector-src/src/NodeTypeResolver/PHPStan/Type/TypeFactory.php Lines 195 to 211 in 76dc419
rector-src/src/NodeTypeResolver/PHPStan/TypeHasher.php Lines 26 to 52 in 76dc419
|
|
Fixed 🎉 |
| * @var int | ||
| */ | ||
| private const MAX_PRINTED_UNION_DOC_LENGHT = 60; | ||
| private const MAX_PRINTED_UNION_DOC_LENGHT = 77; |
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.
@TomasVotruba I updated to use 77 as max length union to show the fix, otherwise, it just \Iterator<mixed> for this fixture test
The fix for this case is loop when inner is ConstantArrayType too.
Proven works at
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.
This might be tricky to keep in readable line. The longer the docblock will be, the more mess might get int. But let's give 77 a try.
| if ($nestedFlattenItemType instanceof ConstantArrayType) { | ||
| $innerArrayTypes = $this->unwrapConstantArrayTypes($nestedFlattenItemType); | ||
| foreach ($innerArrayTypes as $innerArrayType) { | ||
| // preserve outer array -> inner array structure: array<outerKey, innerArray> | ||
| $unwrappedTypes[] = new ArrayType($nestedFlattenKeyType, $innerArrayType); | ||
| } | ||
|
|
||
| continue; | ||
| } |
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.
this loop again to make result of inner constant array to avoid just added the last one,
|
All checks have passed 🎉 @TomasVotruba I am merging it ;) |
|
👍 |
it currently only got last objects, which cause phpstan notice:
see https://phpstan.org/r/db520ab6-fc4f-4c45-ac1f-b91801f2e065