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
non-empty-string is not always truthy #5317
Comments
Yeah, you're right, but I think we need to introduce another type, something like |
And it's useful to mark |
For the record, since https://github.com/vimeo/psalm/releases/tag/4.5.0, there is a |
@BackEndTea After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-6: Dumped type: non-empty-string
-8: Negated boolean expression is always false.
+No errors |
@BackEndTea After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-8: Negated boolean expression is always false.
+No errors |
Seems fixed. |
It's not fixed, it was a bug in the playground. |
@JTAjala your issue is most likely unrelated, please open a separate bug report |
Here is another example: |
did some research on this topic. in psalm for phpstan-src inspiration:
|
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
if the length of a string is 1, it is not necessarily truthy. if it is '0', the string is fasly
Code snippet that reproduces the problem
https://phpstan.org/r/0d0ff87d-1142-4c8d-887a-9ea257c0540b
https://phpstan.org/r/af765852-8582-480e-8225-6457ee0b214e
https://3v4l.org/BeHAV
Expected output
No errors
The text was updated successfully, but these errors were encountered: