Skip to content

Type narrowing does not work with template in union type #7688

@ComiR

Description

@ComiR

Bug report

A template of union types used in another union as parameter type prevents the is_* methods from reducing the types.

Code snippet that reproduces the problem

https://phpstan.org/r/2b15a48c-e0d4-41fa-ac80-72191cd780a6

Expected output

Dumped type in foo() should be string (like in bar), in baz() it should be int.

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

Thanks for all the great work 🥇

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions