-
Notifications
You must be signed in to change notification settings - Fork 661
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
assert(!array_is_list()) changes type to be maybe list #9348
Labels
Comments
I found these snippets: https://psalm.dev/r/c7b80db58a<?php
/** param array<string, mixed> $input1 */
function test(array $input1): array {
return $input1;
}
/** param array<string, mixed> $input2 */
function test2(array $input2 = []): void {
assert(empty($input2) || !array_is_list($input2), "Must be associative");
test($input2);
}
|
@othercorey you omitted |
I found these snippets: https://psalm.dev/r/715994eafd<?php
/** @param array<string, mixed> $input1 */
function test(array $input1): array {
return $input1;
}
/** @param array<string, mixed> $input2 */
function test2(array $input2 = []): void {
assert(empty($input2) || !array_is_list($input2), "Must be associative");
test($input2);
}
|
Thanks. I updated the description with your example so it's not confusing to read. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A parameter of type
array<string, mixed
is passed to another parameter of the same typearray<string, mixed>
. However, when introducing an assert that it is associative, it seems to think the array could now be a list.https://psalm.dev/r/715994eafd
The text was updated successfully, but these errors were encountered: