-
Notifications
You must be signed in to change notification settings - Fork 534
take subtracted type into account in MixedType->isArray()
#1656
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
tests/PHPStan/Type/MixedTypeTest.php
Outdated
new MixedType(), | ||
new ArrayType(new IntegerType(), new StringType()), | ||
TrinaryLogic::createNo(), |
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.
subtracting only array<int, string>
could still leave e.g. a array<string, mixed>
within the mixed
.
therefore I am wondering, whether the only case where $mixed->isArray()
can say NO is, when a general array
is substracted?
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.
Exactly. Switching the callee and the argument works even when more than just an array are subtracted, like array|null for example.
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 just see #1656 (comment), so I think we are on the same page.. will adjust the PR.
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.
While you're at it, please do all the other methods as well.
implemented in all methods I found useful. here are a few notes:
|
Exactly, it should just call
Can we get a union of all offset-accessible types? Is it
Yes, definitely, the current code is wrong. |
00b7b03
to
e131ca2
Compare
implemented and rebased |
Thank you. |
No description provided.