Skip to content

Since Phpstan 1.5, there is a weird error with instersection of generic #6917

@VincentLanglet

Description

@VincentLanglet

Bug report

I'm getting an error

Parameter #1 $admin of method Hello::setAdmin() expects AdminInterface<T of object>, AdminInterface<object>&MockObject given.

But to me, AdminInterface<object>&MockObject is a AdminInterface<object> which would resolve T to object.

Code snippet that reproduces the problem

https://phpstan.org/r/44fdf0f8-25de-4394-b606-19288601ea1e

Expected output

No errors

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

Phpstan is my favorite tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions