Skip to content

Support the class-string-map type #9521

@stof

Description

@stof

Feature request

Psalm has a class-string-map type to represent cases where an array is a map between a class name (potentially restricted to a given type) as key and a value which type depends on that class name: https://psalm.dev/docs/annotating_code/type_syntax/utility_types/#class-string-mapt-of-foo-t

The most basic usage being that each value is an instance of the type available as key. But it could be more complex for values (for instance using list<T> for a list of instances of that type or even OtherType<T>).

It would be great if phpstan could have such a type (and ideally using the same syntax than psalm)

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions