Skip to content

Intersection type mistakenly converted to union type when using ::class #4875

@lcobucci

Description

@lcobucci

Bug report

PHPStan behaves properly when using intersection type for objects
However, when getting the class name via ::class it gets confused and converts things to a union type instead.

P.S.: that doesn't happen when using get_class(): https://phpstan.org/r/d8d402e1-f1c4-437d-a425-ca3721aec34b

Code snippet that reproduces the problem

https://phpstan.org/r/b2581058-38ba-4780-8b8c-79f38630b554

Expected output

No error should be reported as class-string<Blah&Mock> is compatible with class-string<Blah>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions