Skip to content

ArrayAccess mixed contravariant false positive #4854

@soullivaneuh

Description

@soullivaneuh

Bug report

I use @extends keyword on ArrayAccess to have a better type checking with PHPStan.

It looks to recognize it, but want the parameters to be contravariant with the native ArrayAccess native class methods.

However, if this not a bug, I don't see how this should be resolved. 🤔

Code snippet that reproduces the problem

https://phpstan.org/r/f3a9c0d9-96b4-4b97-8c00-d908147465c3

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