Skip to content

False positive argument.type #12495

@Niklan

Description

@Niklan

Bug report

PHPStan can't determine that the type of the value has already been checked in the conditional statement. It is reproducible with any type of check (instanceof, for example).

Code snippet that reproduces the problem

https://phpstan.org/r/a46b054e-feaa-421f-b1a6-7e6a2976673b

Expected output

PHPStan can "understand" that the type of the value is already checked by ::hasValue() and if it returns TRUE, it cannot be NULL.

Did PHPStan help you today? Did it make you happy in any way?

No response

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