Skip to content

Support class-string-map<T of Foo, T> #266

Description

@kkmuffme

See https://psalm.dev/docs/annotating_code/type_syntax/utility_types/#class-string-mapt-of-foo-t

It's essentially a more specific type of array<class-string, Foo>

Activity

  1. mspirkov commented on Dec 7, 2025

    @mspirkov
    Contributor

    I will add support for this type in the second version.

  2. mspirkov commented on Dec 7, 2025

    @mspirkov
    Contributor

    Apparently, phpstan/phpdoc-parser does not support this type. Until phpstan/phpdoc-parser supports this type, we won't be able to do anything.

    Image
  3. kkmuffme commented on Dec 7, 2025

    @kkmuffme
    Author

    Yes, there's an issue open for that phpstan/phpstan#9521

  4. kkmuffme commented on Dec 15, 2025

    @kkmuffme
    Author

    Also it's actually class-string-map<T as Foo, T> (not "of") - with psalm having a bug report for it previously vimeo/psalm#10095 - so both need to be supported

  5. kkmuffme commented on Dec 31, 2025

    @kkmuffme
    Author

    class-string-map<T, T> without any type specification is valid too (as per the OP link, however it's often overlooked)

  6. added a commit that references this issue on Apr 15, 2026
    bb758c6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions