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
False positive: Comparison operation ">" between 0 and 0 is always false. #8938
Comments
We noticed this in overnight CI that started failing on code here: |
Note: with PHP 7.4 this passes on phpstan 1.9.18 and fails on 1.10.0 |
Is this commit somehow related ? But I don't see an obvious problem with that code, or how it would execute differently on PHP 7.4 |
If you want, you can find the commit who introduce the bug by writing a test case for php 7.4 on phpstan-src and running |
good idea about using the commit hash, I will try that. |
Got similar issue with this snippet https://phpstan.org/r/b44378ba-632d-4b47-bb04-f8ac420be7a3
|
Somehow phpstan is thinking that
But I don't see any PHPDoc at all in our code examples, So that message seems to be emitted in error. |
In my example, I can refactor to:
and that passes. But having the So there is a silly workaround for my example. But doing a similar refactoring of @eigan example, it still fails. What is going on? |
Fixed: phpstan/phpstan-src@f882eff |
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
The type of "while strlen" construction in the example was passing phpstan. But now it fails on PHP7 (but looks like it passes on PHP8).
Code snippet that reproduces the problem
https://phpstan.org/r/0694abfa-be7c-47e9-ab0e-d2d6ca7dec80
Expected output
The code should pass phpstan, and was passing with 1.9
Did PHPStan help you today? Did it make you happy in any way?
The text was updated successfully, but these errors were encountered: