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
Falsy Type after for condition #5328
Comments
Hi, please contribute the fix by yourself, that commit has everything you need. It might also apply to do-while loop too. Also please understand that when majority of new feature requests come from a single person, I have to internally rate limit implementing those feature requests myself so I can serve the whole userbase equally. Thanks for understanding. |
Thats totally fine. Just want to get in contact first to get your opinion on the case.
I checked this case already and came to the conclusion, that it works fine |
Yeah, I was excited about the while loop report, it was an obvious hole 😊 |
@staabm After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-15: Method Bug5322\Foo::doBar() has no return typehint specified.
+15: Method Bug5322\Foo::doBar() has no return type specified.
22: Expected type int, actual: int|null Full report
|
I think PHPStan got it right, it can be |
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. |
Feature request
Analog to the fix in https://github.com/phpstan/phpstan-src/blob/3166ba31a8768979a40e55f1bbfea9ba4449a3d8/tests/PHPStan/Analyser/data/bug-5322.php
i would expect this to apply to for-loops
https://phpstan.org/r/896b762d-0edd-4775-8057-ad47fcbfd5ec
(The example is a bit theoretical though)
The text was updated successfully, but these errors were encountered: