psalm
psalm copied to clipboard
Implode of literal-string should be inferred as literal-string
Cf rfc: https://wiki.php.net/rfc/is_literal
Cf phpstan: https://phpstan.org/r/ca885493-b98a-4192-9e9b-eccabeda173a
Psalm snippet https://psalm.dev/r/36ad98d72b
I found these snippets:
https://psalm.dev/r/36ad98d72b
<?php
/** @param array<literal-string> $string */
function test(array $string): void
{
/** @psalm-trace $a */
$a = implode('e', $string);
}
Psalm output (using commit 08afc45):
INFO: Trace - 7:5 - $a: string
INFO: UnusedVariable - 7:5 - $a is never referenced or the value is not used