-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
0|positive-int += $bool : 0 ? 1, should not give a 'does not accept int' error #4843
Comments
Root issue: https://phpstan.org/r/c0259855-d15d-4ee3-9816-8e6722179db2 This should still result in positive-int|0. It can be fixed in |
Something similar happens further down the 'Real world example' code. Where function parameter |
* Updated PhpDoc, mainly made with Psalm * Also add the few import changes * More @param array vs splat operator fixes * A few @return fixes * Fix reeDSx/Ldap/Entry/Option.php:63 in `composer run-script analyse` * Various cleanups around InheritDoc. * Various cleanups around InheritDoc. * Various cleanups around InheritDoc. * Various cleanups around InheritDoc. * Various cleanups around InheritDoc. * This confuses phpstan: phpstan/phpstan#4843 (comment)
@HenkPoley After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-11: Property Bar::$depth (int<0, max>) does not accept int.
+No errors |
@ondrejmirtes After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-11: Dumped type: int
+11: Dumped type: int<0, max> Full report
|
I think this was fixed with recent commits |
Fixed by: phpstan/phpstan-src#637 |
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. |
Bug report
When you declare a class attribute as 0 or higher, and initialise it as 0. Then adding 0 or 1 to it, should not be a problem. It's still 0 or higher.
Code snippet that reproduces the problem
https://phpstan.org/r/4e349804-7493-43ab-81fd-ed54f3f388de
Real world example: https://github.com/FreeDSx/LDAP/blob/7722aea71a840d9cbf133a61ef326fc049b3dd34/src/FreeDSx/Ldap/Search/FilterParser.php#L127
Expected output
No output in particular
The text was updated successfully, but these errors were encountered: