Skip to content

@phpstan-assert isn't working with Union #11441

@adumont-prestaconcept

Description

@adumont-prestaconcept

Bug report

When doing some check by calling a method using @phpstan-assert tag on union type, the tags is not working as expected.

Code snippet that reproduces the problem

https://phpstan.org/r/884685bf-302a-4be6-a544-94035843b448

Expected output

The expected type of $fooOrBar->getParam() is int|string instead of int|string|null

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions