We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I would not have expected to get an error on https://psalm.dev/r/2196ad3688
The text was updated successfully, but these errors were encountered:
I found these snippets:
<?php function takeVariadicInts(int ...$inputs): void { print_r($inputs); } /** * @param non-empty-list<int> $inputs */ function takeNonEmptyList(array $inputs): void { print_r($inputs); } $a = [3, 5, 7]; takeVariadicInts(...$a); takeNonEmptyList($a);
Psalm output (using commit 951b943): ERROR: ArgumentTypeCoercion - 18:18 - Argument 1 of takeNonEmptyList expects non-empty-list<int>, parent type array<int, int(3)> provided
Sorry, something went wrong.
da170ef
Thanks for the quick fix @muglug! I'm not sure it completely fixes the issue, see https://psalm.dev/r/da8bc6d1d5
<?php /** * @return non-empty-list<int> */ function provide(): array { return [3, 5, 7]; } function takeVariadicInts(int ...$inputs): void { print_r($inputs); } /** * @param non-empty-list<int> $inputs */ function takeNonEmptyList(array $inputs): void { print_r($inputs); } $a = provide(); takeVariadicInts(...$a); takeNonEmptyList($a);
Psalm output (using commit da170ef): ERROR: ArgumentTypeCoercion - 26:18 - Argument 1 of takeNonEmptyList expects non-empty-list<int>, parent type array<int, int> provided
made better in 9cd8170
No branches or pull requests
I would not have expected to get an error on https://psalm.dev/r/2196ad3688
The text was updated successfully, but these errors were encountered: