Skip to content

Invalid generic type resolution after class instances are created in an if branch #6946

@biozshock

Description

@biozshock

Bug report

After an if branch phpstan detects the variable of a wrong type.
Sure moving the apply inside the if fixes the problem, but it smells a lot.

Code snippet that reproduces the problem

https://phpstan.org/r/5c6d4ab7-013c-40cb-a867-da3b42288d4c

Expected output

No errors

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

Thank you everybody for your hard 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