Skip to content

Template type gets lost when using key-of and extending ArrayAccess #7652

@ondrejmirtes

Description

@ondrejmirtes

Bug report

https://phpstan.org/r/2fb146c6-12dc-4a17-bb28-e13d93e820ea

/cc @rvanvelzen From the error messages:

 Parameter #1 $offset (key-of<TArray of array>) of method Options::offsetExists() should be contravariant with parameter $offset (key-of<array>) of method ArrayAccess<key-of<TArray of array>,value-of<TArray of array>>::offsetExists()

It looks like the generic-ness gets lost ($offset (key-of<array>)).

I don't think the example should report these messages. Could you please look into it?

This PR depends on the code to pass :) phpstan/phpstan-symfony#294

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions