We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It seems that a second rand() results in a false positive only when using rand(1, x). E.g. rand(0, 100) does not give an error.
Error: Comparison operation "<" between int<5, max> and 5 is always false.
https://phpstan.org/r/f6cd6866-3de6-4034-8b7c-dc083bbc17c2
Another example, without the elseif: https://phpstan.org/r/1db5d8ae-21df-46bd-8361-818e872964c0
Expected output is no error. When rand(1, 100) is changed to something else like rand(0, 100) the error also disappears.
The text was updated successfully, but these errors were encountered:
@Fosse After the latest commit in dev-master, PHPStan now reports different result with your code snippet:
@@ @@ -9: Comparison operation "<" between int<5, max> and 5 is always false. +No errors
Sorry, something went wrong.
@@ @@ -10: Comparison operation "<" between int<5, max> and 5 is always false. +No errors
Fixed: phpstan/phpstan-src@d4edc59
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.
No branches or pull requests
Bug report
It seems that a second rand() results in a false positive only when using rand(1, x). E.g. rand(0, 100) does not give an error.
Error:
Comparison operation "<" between int<5, max> and 5 is always false.
Code snippet that reproduces the problem
https://phpstan.org/r/f6cd6866-3de6-4034-8b7c-dc083bbc17c2
Another example, without the elseif:
https://phpstan.org/r/1db5d8ae-21df-46bd-8361-818e872964c0
Expected output
Expected output is no error. When rand(1, 100) is changed to something else like rand(0, 100) the error also disappears.
The text was updated successfully, but these errors were encountered: