-
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
Variadic parameters and non-empty-list #5421
Labels
Comments
I found these snippets: https://psalm.dev/r/7f75a28f23<?php
$x = [];
$y = [];
$x = [...$x, ...$y];
/** @psalm-trace $x */
$x ? 1 : 0;
|
I'm seeing several other issues creating arrays with the spread operator, here's a false negative: https://psalm.dev/r/e7aeb5831c |
I found these snippets: https://psalm.dev/r/e7aeb5831c<?php
/** @return array<array-key, int> */
function getArray(): array {
return ['test' => 0];
}
function test(): array {
$a = getArray();
$b = [...$a];
return $b;
}
https://psalm.dev/r/2ac2479ad5<?php
/** @return array<string, int> */
function getArray(): array {
return ['test' => 0];
}
function test(): array {
$a = getArray();
$b = [...$a];
return $b;
}
|
AndrolGenhald
added a commit
to AndrolGenhald/psalm
that referenced
this issue
Mar 19, 2021
AndrolGenhald
added a commit
to AndrolGenhald/psalm
that referenced
this issue
Mar 20, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://psalm.dev/r/7f75a28f23
In this example
$x
can be empty, but psalm understand this as non-empty-list. It is bug.The text was updated successfully, but these errors were encountered: