-
Notifications
You must be signed in to change notification settings - Fork 666
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 ParadoxicalCondition
when using in_array()
#6317
Comments
I found these snippets: https://psalm.dev/r/e148c5660c<?php
function contains(array $list1, array $list2, mixed $element): void
{
if (in_array($element, $list1, true)) {
} elseif (in_array($element, $list2, true)) {
}
}
|
Also reported by @orklah here: #6233 (comment) |
I checked why it happens. Here's a quick summary:
Both of those assertions are correctly reconciled by One naive solution that I first thought of - just don't negate
So if we don't return the first negated clause, there won't be the 2nd one. So I'm not sure how to better approach it. |
I don't know the code here very well, two things come to my mind:
|
We're all basically reverse-engineering here.
Negated |
When given the snippet
the second condition is mistaken to be identical to the first condition.
See https://psalm.dev/r/e148c5660c
This has been introduced in Psalm 4.9.3.
The text was updated successfully, but these errors were encountered: