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
FP: Switch(count(array)) doesn't infer non-empty-array when case is 1 or more #4499
Comments
PHPStan mostly doesn't support Works with |
Thanks. |
@dktapps After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-7: Dumped type: int|null
+7: Dumped type: int Full report
|
@ondrejmirtes After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-6: Dumped type: int|null
+6: Dumped type: int Full report
|
Fixed by: phpstan/phpstan-src#648 |
Ref phpstan/phpstan#4793 Ref phpstan/phpstan#5062 Ref phpstan/phpstan#5447 Ref phpstan/phpstan#5454 Ref phpstan/phpstan#3366 Ref phpstan/phpstan#5072 Ref phpstan/phpstan#3530 Ref phpstan/phpstan#5530 Ref phpstan/phpstan#1861 Ref phpstan/phpstan#4843 Ref phpstan/phpstan#4602 Ref phpstan/phpstan#4499 Ref phpstan/phpstan#2142
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
Code snippet that reproduces the problem
https://phpstan.org/r/30604226-e6f3-459e-947c-95a807f7c064
Expected output
The dumped type should be
int
, notint|null
, because the number of items is known to be non-zero.The text was updated successfully, but these errors were encountered: