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: strtotime($date) < time() is always true #5969
Comments
The actual problem is you are passing a mixed to strtotime() |
@staabm Thanks, that explains why it works fine with the typed property. I guess that phpstan is unable to take advantage of |
@schlndh After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-11: Comparison operation "<" between (int|false) and int<1, max> is always true.
-16: Comparison operation "<" between (int|false) and int<1, max> is always true.
+No errors |
Fixed: phpstan/phpstan-src@dd5633f |
Closes phpstan/phpstan#5893 Closes phpstan/phpstan#6070 Closes phpstan/phpstan#5869 Closes phpstan/phpstan#6212 Closes phpstan/phpstan#6262 Closes phpstan/phpstan#6266 Closes phpstan/phpstan#6023 Closes phpstan/phpstan#6108 Closes phpstan/phpstan#6020 Closes phpstan/phpstan#1746 Closes phpstan/phpstan#1516 Closes phpstan/phpstan#6174 Closes phpstan/phpstan#6112 Closes phpstan/phpstan#5749 Closes phpstan/phpstan#5969 Closes phpstan/phpstan#5295 Closes phpstan/phpstan#5675 Closes phpstan/phpstan#5369 Closes phpstan/phpstan#6699 Closes phpstan/phpstan#6505
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
It looks like PHPStan is confused about
(int|false) < int<1, max>
, the fact that it's related to time functions is probably just because of the changes from 1.1.2.Code snippet that reproduces the problem
https://phpstan.org/r/2096429c-7a1b-438a-9738-2be373692672
Expected output
No errors.
The text was updated successfully, but these errors were encountered: