-
Notifications
You must be signed in to change notification settings - Fork 153
Fix parameter type for Assert::isMap()
#331
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
base: master
Are you sure you want to change the base?
Conversation
`isMap` should accept `mixed` or `array<array-key, T>`, not `array<string, T>`. If the input was `array<string, T>`, we wouldn't need to use `Assert::isMap()`.
|
Isn't |
|
The |
|
I guess it's implementation dependent (the static analysis tool), but yep, agree. |
| * @psalm-assert array<string, T> $array | ||
| * | ||
| * @param array<string, T> $array | ||
| * @param mixed|array<array-key, T> $array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should just be mixed. As in, remove the @param declaration because the actual type is already mixed $array.
| * @param array<string, T> $array | ||
| * @param mixed|array<array-key, T> $array | ||
| * | ||
| * @return array<string, T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect, it should be @return array<array-key, T>.
| * | ||
| * @template T | ||
| * | ||
| * @psalm-assert array<string, T> $array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this should be array<array-key, T>.
isMapshould acceptmixedorarray<array-key, T>, notarray<string, T>. If the input wasarray<string, T>, we wouldn't need to useAssert::isMap().