-
Notifications
You must be signed in to change notification settings - Fork 545
non-empty-array<mixed> does not accept array with hasOffsetValue #3924
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
This pull request has been marked as ready for review.
7604c9f to
01bfab7
Compare
I see we have more todo here.
a union of 2 non-empty-arrays with has-offset accessory atm is just array, could be at least non-empty-array
https://phpstan.org/r/cfad9fa9-2279-4f97-b9df-580aab7aa844
edit: fixed in #3937
01bfab7 to
3d462a6
Compare
3d462a6 to
01bfab7
Compare
This reverts commit 5a62d9a.
01bfab7 to
bf5ba33
Compare
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.
It should check the iterable value type against $this->valueType.
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.
I can't check the iteratable-value-type and the non-emptiness in a single IF because $acceptingType is invoked once for each element of the intersection.
this means I get the ArrayType which I could check against the value-type, but not against non-emptiness
and on the 2nd call I get the NonEmptyArray type, which I can check only against the non-emptiness, but not the value type
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.
I will think more about it.. maybe we need a fix directly on IntersectionType then
ohh lol, I did not realize that my recently merged PR fixed the issue
This pull request has been marked as ready for review.
lets use this PR to just land the regression test. its fixed
Thank you.
BTW it'd still be beneficial to write some actual unit tests for the types in question, maybe we realize the fix is still needed for some situations where the types don't even go through TypeCombinator first.
Uh oh!
There was an error while loading. Please reload this page.
closes phpstan/phpstan#12847
edit: the underlying issue was fixed with #3937