Skip to content

A useless strict comparison is not detected #2894

@morozov

Description

@morozov

Bug report

PHPStan 0.12.7.

If a function argument type is enforced to be a string, its strict comparison with anything else than a string should be reported as useless.

Code snippet that reproduces the problem

https://phpstan.org/r/4b215575-9bb4-4928-a5b9-d993026000b8

Expected output

PHPStan should report the $database !== null as useless because it's always true.

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