-
-
Notifications
You must be signed in to change notification settings - Fork 863
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
min/max functions cannot resolve final value range if one of values is variable or constant #5072
Labels
Comments
@lulco After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
20: Dumped type: int
-21: Method HelloWorld::incorrect() should return int<1, max> but returns int.
-29: Dumped type: int
-30: Method HelloWorld::incorrectWithConstant() should return int<1, max> but returns int.
+29: Dumped type: int Full report
|
Implemented: phpstan/phpstan-src@458f5d2 |
ondrejmirtes
added a commit
to phpstan/phpstan-src
that referenced
this issue
Aug 31, 2021
Ref phpstan/phpstan#4793 Ref phpstan/phpstan#5062 Ref phpstan/phpstan#5447 Ref phpstan/phpstan#5454 Ref phpstan/phpstan#3366 Ref phpstan/phpstan#5072 Ref phpstan/phpstan#3530 Ref phpstan/phpstan#5530 Ref phpstan/phpstan#1861 Ref phpstan/phpstan#4843 Ref phpstan/phpstan#4602 Ref phpstan/phpstan#4499 Ref phpstan/phpstan#2142
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug report
min/max functions cannot resolve final value range if one of values is variable or constant
Code snippet that reproduces the problem
https://phpstan.org/r/2a2c7b0c-c410-40ff-b2a5-d6c8036f3780
Expected output
Expected output in these cases is that return value is positive integer. So no error will be reported.
The text was updated successfully, but these errors were encountered: