-
Notifications
You must be signed in to change notification settings - Fork 548
Intersection of array&hasOffset is accepted by non-empty-array #4766
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
base: 2.1.x
Are you sure you want to change the base?
Conversation
|
|
|
ok, I think its fine. |
455abe8 to
f6bb448
Compare
|
This pull request has been marked as ready for review. |
f6bb448 to
6ca1e8c
Compare
| public function accepts(Type $type, bool $strictTypes): AcceptsResult | ||
| { | ||
| if ($type instanceof CompoundType) { | ||
| return $type->isAcceptedBy($this, $strictTypes); |
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 don't understand this. All Accessory types do this. So it has to stay.
But you can do another condition before this one, like AccessoryNonEmptyStringType does:
public function accepts(Type $type, bool $strictTypes): AcceptsResult
{
if ($type->isNonEmptyString()->yes()) {
return AcceptsResult::createYes();
}
if ($type instanceof CompoundType) {
return $type->isAcceptedBy($this, $strictTypes);
}
return new AcceptsResult($type->isNonEmptyString(), []);
}You can also try doing the same thing (call related method before instanceof CompoundType) in other Accessory types so they all still look the same..
closes phpstan/phpstan#13964