-
Notifications
You must be signed in to change notification settings - Fork 504
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
Fix count() regression #3889
Fix count() regression #3889
Conversation
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.
Awesome, thanks!
src/Analyser/TypeSpecifier.php
Outdated
if ( | ||
!$isNormalCount->yes() | ||
|| (!$isConstantArray->yes() && !$isList->yes()) | ||
|| $type->isIterableAtLeastOnce()->no() // array{} cannot be used for further narrowing | ||
|| !$positiveInt->isSuperTypeOf($sizeType)->yes() |
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.
What would change if we also included zero 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.
seems to also work
This pull request has been marked as ready for review. |
Nice, thx! |
Thank you. |
We have another one 🙁 https://phpstan.org/r/c97add7b-a241-45c9-88f1-b8e7c76daa09 |
refs #3709 (comment)