Skip to content

Undetected template invariance violation with arrays #5298

@dktapps

Description

@dktapps

Bug report

Code snippet that reproduces the problem

https://phpstan.org/r/07963c2f-f876-48b9-bc8b-e1f9a7448c00

Expected output

An error should be reported on line 35, because array<WorldProviderEntry<WorldProvider>> cannot accept WorldProviderEntry<T of WorldProvider>. The additional code at the end provides reasoning why.

Footnote

I guess this should be allowed if template-covariant was used on the WorldProviderManagerEntry class?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions