Skip to content

support Psl\invariant #4

@bendavies

Description

@bendavies

Hi,

Until phpstan has its own assert/type narrowing support:

it would be good to have support for
\Psl\Invariant (https://github.com/azjezz/psl/blob/2.1.x/src/Psl/invariant.php#L12) in this extension.

example:
doesn't work:

\PHPStan\dumpType($result); //$result = Divsion|null

Psl\invariant(
    null !== $result,
    Str\format('Division with ID %s not found', $uuid->toRfc4122()),
);

\PHPStan\dumpType($result); //$result = Divsion|null

Thanks

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