Skip to content

bug: psalm-assert-if-true results in redundant-type-comparison #831

@rauanmayemir

Description

@rauanmayemir

Description

I have uses of

Type\property_name_of($input::class)->assert($field);

but mago reports it as

warning[redundant-type-comparison]: Redundant type assertion: `$field` of type `non-empty-string` is always not `non-empty-string`.

this is because PropertyNameOfType has a @psalm-assert non-empty-string $value, but it's not the only thing the function asserts.

Playground Link

No response

Reproduction

No response

Environment

mago v1.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugAn issue causing unintended or problematic behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions