jsonmapper icon indicating copy to clipboard operation
jsonmapper copied to clipboard

Support for `array<Type>` (alternative to `Type[]`)

Open earthiverse opened this issue 9 months ago • 2 comments

I usually use array<Type> in my projects, but JsonMapper doesn't support that.

It does however support Type[], and for that I am grateful 🙂 .

Would adding support for array<Type> be difficult?

earthiverse avatar Feb 19 '25 06:02 earthiverse

I think this way of declaring contents of an array is reflecting the way PHPStan any other static analysis tools and IDEs offer it, but if that's the feature to be implemented, then it should also allow for the full variant of array<keytype, valuetype> - and it should obviously allow for a bit of spicy mixture of types if this sounds reasonable, i.e. array<int, string|null> or array<string, array<int, Type>> (at least the last option may not be relevant, but union types). See https://phpstan.org/writing-php-code/phpdocs-basics#combining-phpdoc-types-with-native-typehints

SvenRtbg avatar Feb 19 '25 15:02 SvenRtbg

I would also like to request support for list<Type> style docblocks.

jansteffen avatar Sep 18 '25 13:09 jansteffen