Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
earthiverse opened this issue Feb 19, 2025 · 1 comment · May be fixed by #244
Open

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

earthiverse opened this issue Feb 19, 2025 · 1 comment · May be fixed by #244

Comments

@earthiverse
Copy link

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?

@danog danog linked a pull request Feb 19, 2025 that will close this issue
@SvenRtbg
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants