Skip to content

Generics type inference fails and return an <empty> Collection #2900

@orklah

Description

@orklah

Hi,

I have a Collection object which use generics. I can create a Collection through a named constructor who expects two params: a class-string and an array of instances of the class-string.
However, Psalm doesn't recognize the Collection as being a Collection when given A::class in the class-string:
https://psalm.dev/r/f2fc2538af

When I remove the second parameter, everything is back to normal:
https://psalm.dev/r/0dad733095

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions