Skip to content

False positive ParadoxicalCondition when using in_array() #6317

@corphi

Description

@corphi

When given the snippet

function contains(array $list1, array $list2, mixed $element): void
{
    if (in_array($element, $list1, true)) {
    } elseif (in_array($element, $list2, true)) {
    }
}

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions