TypeResolver icon indicating copy to clipboard operation
TypeResolver copied to clipboard

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

Open kkmuffme opened this issue 2 weeks ago • 4 comments

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>, Foo>

kkmuffme avatar Dec 07 '25 01:12 kkmuffme

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

mspirkov avatar Dec 07 '25 05:12 mspirkov

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

mspirkov avatar Dec 07 '25 05:12 mspirkov

Yes, there's an issue open for that https://github.com/phpstan/phpstan/issues/9521

kkmuffme avatar Dec 07 '25 09:12 kkmuffme

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

kkmuffme avatar Dec 15 '25 08:12 kkmuffme