-
Notifications
You must be signed in to change notification settings - Fork 27
False positive: Call to static method Webmozart\Assert\Assert::count() with arguments non-empty-array<int, string>, 2 and 'error' will always evaluate to true #68
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
Comments
Really weird, it's not happening on equivalent code: https://phpstan.org/r/66b68119-ae4b-449d-ba3b-1ac7c8863662 |
I am having the same issue, the sample you provided is not using Webmozart\Assert\Assert library. |
@gjuric the reason for that is that this project translates the assert methods to expressions like these. And that's why most of the problems are reproducable with the expressions it would create I was able to confirm this bug in a test, but don't have a good enough fix yet unfortunately. I'll try to take another look soon |
I found out a bit more. As we already saw in the phpstan.org snippet the type before the assertion is already
Regarding the fix - I'm still not sure yet. I could easily check if the expression would not add any more typing-value here and return |
Please check this once phpstan/phpstan-src#1021 is built in phpstan/phpstan, thanks. |
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. |
Related to #62 /cc @villfa
The text was updated successfully, but these errors were encountered: