psalm icon indicating copy to clipboard operation
psalm copied to clipboard

PHP variadic internal functions should not allow named calls

Open kkmuffme opened this issue 11 months ago • 1 comments

https://psalm.dev/r/14572dea00

This is a fatal error.

The reason it's wrong in psalm is that PHP's docs itself have been wrong all along (since the beginning), which is why this is wrong in psalm too I guess - see https://github.com/php/doc-en/issues/3233

kkmuffme avatar Mar 04 '24 14:03 kkmuffme

I found these snippets:

https://psalm.dev/r/14572dea00
<?php
/**
 * @var array $a
 * @var array $b
 * @var array $c
 */

$x = array_intersect(arrays: $a, array: $b);
$y = array_intersect(hello: $a, world: $c, array: $b);
Psalm output (using commit 3600d51):

INFO: UnusedVariable - 8:1 - $x is never referenced or the value is not used

INFO: UnusedVariable - 9:1 - $y is never referenced or the value is not used

psalm-github-bot[bot] avatar Mar 04 '24 14:03 psalm-github-bot[bot]