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

Psalm treat an array as array<array-key, mixed> if it does not know the key type #11059

Open
kafkiansky opened this issue Jul 27, 2024 · 1 comment

Comments

@kafkiansky
Copy link

Hi. I'm writing a plugin for my protobuf serialization library. I decided to do a tight integration with static analysis tools and let users specify types directly in the phpdoc: @param int32 $id. Now I was able to teach psalm through the plugin to understand such types, but not for an array. If the array key contains a type known to psalm, for example array<string, int32>, there is no problem, but not when the key is unknown, for example array<int32, string>, - in this case psalm thinks that there is array<array-key, mixed>. What can be done in this case?

Copy link

Hey @kafkiansky, can you reproduce the issue on https://psalm.dev? These will be used as phpunit tests when implementing the feature or fixing this bug.

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

No branches or pull requests

1 participant