Skip to content

Intersection type info being lost on templated function #6845

@stingray-11

Description

@stingray-11

Bug report

When passing an intersection type A&B into a function that takes and returns a T of one of those (e.g. T of A), the intersection type info is lost and the return of that function can no longer be used as a B. I'm not sure whether this should work or not, but figured I would post it for discussion.

Code snippet that reproduces the problem

https://phpstan.org/r/716007c4-7adf-437a-9f92-06f163de5ba7

Expected output

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

PHPStan is such a game changer that I am thoroughly redesigning my project around using it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions