Skip to content

Generic variance not working like expected #8105

@alexander-schranz

Description

@alexander-schranz

Bug report

I have a MockWrapper object which used inside anonymous methods to implement Interfaces via Traits inside tests. But the variance not working like expected.

Code snippet that reproduces the problem

https://phpstan.org/r/44f566cb-4e57-4820-a818-845d008e672e

Expected output

Parameter #1 $configuredMock of class class@anonymous/tmp.php:84 constructor expects App\Tests\ObjectProphecy<object>, App\Tests\ObjectProphecy<App\Tests\TemplateInterface> given.

Which I don't understand as ObjectProphecy<TemplateInterface> should be App\Tests\ObjectProphecy<object> 🤔

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