-
Notifications
You must be signed in to change notification settings - Fork 28
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
False positive: Call to inArray() with different object instances will always evaluate to true #142
Comments
Yeah, this is unfortunate, it means that this code shouldn't exist https://github.com/phpstan/phpstan-src/blob/3c3ea2f21898e8e411b0a7263910722738839288/src/Rules/Comparison/ImpossibleCheckTypeHelper.php#L85-L134 and all of that should be handled directly in https://github.com/phpstan/phpstan-src/blob/master/src/Type/Php/InArrayFunctionTypeSpecifyingExtension.php. |
Hi there! 👋 Looks like you opened an issue without following one of the issue templates: Bug report 🐛 (open an issue)If something isn't working as expected 🤔. Feature request 🚀 (open an issue)I have a suggestion (and may want to implement it 🙂)! Support question ❓ (open a discussion)I need some help with my code because PHPStan doesn't like it. The current issue will be closed. This is a precaution to save maintainer's time, I hope you'll understand. Sincerely, the bot 🤖 |
tried working on it, but I don't get how to formulate the unit test to reproduce the problem (I don't get how the |
You'd need to:
|
Hello, I just came across a similar issue as per the following example:
phpstan reports: However this is not true, the webmozart assert function is using the exact same param annotations. I'm not completely sure if this is related to what @simPod has reported. |
@p4veI In fact this is exactly the same issue :) In fact this issue was moved from phpstan-webmozart-repo here because it needs to be fixed in PHPStan's core. |
imo fixed in latest release ;) |
Please send a regression test, or it didn't happen :-) |
Interesting, I just tried to add a regression test for this. The current state is
|
Not surprising - there's still a massive codeblock about It's there to prevent false-positives about My comment still stands #142 (comment) |
ah right, I was just super confused because I could not reproduce it in a phpstan snippet. actually it never reported even when it definitely should. that explains it all :) thx |
Enjoy :D phpstan/phpstan#6705 |
Just encounter the issue with
Only the second, third and fourth check are reported as always true. |
gives:
The text was updated successfully, but these errors were encountered: