Skip to content

False positive incompatible generic covariant return type #4017

@vhenzl

Description

@vhenzl

A return type can be covariant. Without generics, this works as expected (for PHP 7.4+): https://phpstan.org/r/0adea38a-7c7f-40da-8e9a-0c631e005aee

For the same code with added generics PHPStan complains that return types are not compatible: https://phpstan.org/r/40573216-1e55-49cb-a9bb-a66a7717f91f

PHPStan 0.12.52. Worked with 0.12.50.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions