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
Property (-1|int<1, max>) does not accept int #6174
Comments
Fyi the base problem seems to be the |
@herndlm Yes, line 20 in your example should be |
It still fails https://phpstan.org/r/71a29c1c-0f36-4401-9a07-61d3ed867142 |
Yeah, it's not fixed (I didn't say it is.) |
Oh, sorry, haha. |
@acelaya After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-13: Property HelloWorld::$myValue (-1|int<1, max>) does not accept int.
+No errors |
@herndlm After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
14: Dumped type: -1
17: Dumped type: int<1, max>
-20: Dumped type: int
-22: Property HelloWorld::$myValue (-1|int<1, max>) does not accept int.
+20: Dumped type: -1|int<1, max> Full report
|
@acelaya After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-13: Property HelloWorld::$myValue (-1|int<1, max>) does not accept int.
+No errors |
Fixed: phpstan/phpstan-src@68e6443 |
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
I have a property annotated as
@var positive-int|-1
, but even if I explicitly check that the value to be assigned actually fulfils that (< 0 || === -1), PHPStan keeps reporting it cannot assignint
to(-1|int<1, max>)
.Code snippet that reproduces the problem
https://phpstan.org/r/22add73c-2fd7-45a1-a5b3-2e1ddb8a1847
Expected output
PHPStan should not throw an error
Did PHPStan help you today? Did it make you happy in any way?
PHPStan always helps. It's just amazing 🙂
The text was updated successfully, but these errors were encountered: