Skip to content

Wrong Parameter #3 $x ... of method B::foo() should be contravariant with parameter $x ... of method A::foo() #10942

@mvorisek

Description

@mvorisek

Bug report

The method signatures are exactly the same. The narrowed type from phpdoc is correctly propagated to the child method, but with unexpected "should be contravariant" PHPStan error.

Code snippet that reproduces the problem

https://phpstan.org/r/819a30a6-5477-448a-a421-24076f8dcd0f

Expected output

no error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions