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 on int values: Comparison operation ">" between int<min, 6> and 10 is always false #5656
Comments
Hi, it'd help me if you debugged where PHPStan starts to get things wrong with the |
@muxx After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-17: Comparison operation ">" between int<min, 6> and 10 is always false.
+ 3: Function okpoValidate() should return bool but return statement is missing. Full report
|
@ondrejmirtes After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-15: Dumped type: int<min, 3>
-18: Comparison operation ">" between int<min, 6> and 10 is always false.
-23: Dumped type: int<min, 7>
-27: Dumped type: int<min, 7>
-33: Dumped type: int<min, 7>
+ 3: Function okpoValidate() should return bool but return statement is missing. Full report
|
In version |
@muxx After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-17: Comparison operation ">" between int<min, 6> and 10 is always false.
+17: Comparison operation ">" between int<1, 6> and 10 is always false. Full report
|
@ondrejmirtes After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-15: Dumped type: int<min, 3>
-18: Comparison operation ">" between int<min, 6> and 10 is always false.
-23: Dumped type: int<min, 7>
-27: Dumped type: int<min, 7>
-33: Dumped type: int<min, 7>
+15: Dumped type: int<1, 3>
+18: Comparison operation ">" between int<1, 6> and 10 is always false.
+23: Dumped type: int<2, 7>
+27: Dumped type: int<1, 7>
+33: Dumped type: int<1, 7> Full report
|
@muxx After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-17: Comparison operation ">" between int<min, 6> and 10 is always false.
+No errors |
@ondrejmirtes After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-15: Dumped type: int<min, 3>
-18: Comparison operation ">" between int<min, 6> and 10 is always false.
-23: Dumped type: int<min, 7>
-27: Dumped type: int<min, 7>
-33: Dumped type: int<min, 7>
+15: Dumped type: 1|3
+23: Dumped type: int<2, 11>
+27: Dumped type: int<1, 11>
+33: Dumped type: int<1, 11> Full report
|
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
This is logic of validation OKPO number of companies in Russia.
Here example where you can see than
$i
can be greater 10 and logic is correct http://sandbox.onlinephpfunctions.com/code/afa48ae0eed6e2bc2407cd23984dbee39a962098Code snippet that reproduces the problem
https://phpstan.org/r/10a2ec68-73ad-4c97-90eb-a792e86e0872
Expected output
Don't show error
Did PHPStan help you today? Did it make you happy in any way?
Yes, of course!)
The text was updated successfully, but these errors were encountered: