-
Notifications
You must be signed in to change notification settings - Fork 651
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
ArrayAnalyzer int_offset broken #5427
Comments
I found these snippets: https://psalm.dev/r/1066dc35a8<?php
$a = [1, 'a' => 2, 3];
/** @psalm-trace $a */ // $a is actually [0 => 1, 'a' => 2, 1 => 3];
|
Should this be allowed? |
I found these snippets: https://psalm.dev/r/a37bd3cac6<?php
/** @return list<int> */
function returnList(): array {
return [1, 1 => 2, 3];
}
|
AndrolGenhald
added a commit
to AndrolGenhald/psalm
that referenced
this issue
Mar 18, 2021
Looks like a false-positive to me. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For object-like arrays with some keys specified and some not
$int_offset
assigns the wrong key.https://psalm.dev/r/1066dc35a8
It's out of order too (assuming object-like arrays are supposed to retain order).Edit: sorting properties on non-list keyed arrays seems to be intentional.The text was updated successfully, but these errors were encountered: