Skip to content

match() with isset is incorrectly warning about remaining value to use in branch #7095

@tpetry

Description

@tpetry

PHPStan is checking whether all possible outcomes of a match expression are used. But for isset it's reporting an error despite true and false are used.

Code snippet that reproduces the problem

/// PHPStan: Match expression does not handle remaining value: bool
match (isset($foo)) {
    true => 'a',
    false => 'b',
};

https://phpstan.org/r/4d740289-69d9-4071-825f-014bd4bdfecc

Expected output

The code is correct, as it has a branch for the true and false value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions