psalm
psalm copied to clipboard
Literal nested string union not being inferred correctly
https://psalm.dev/r/95c684461e
I found these snippets:
https://psalm.dev/r/95c684461e
<?php
/** @var 'a'|'b'|'c' */
$a = "a";
$b = 'test_'.$a;
$c = "test_$a";
/** @psalm-trace $b */;
/** @psalm-trace $c */;
Psalm output (using commit d957ff2):
INFO: Trace - 8:23 - $b: 'test_a'|'test_b'|'test_c'
INFO: Trace - 9:23 - $c: non-empty-literal-string
INFO: UnusedVariable - 4:1 - $a is never referenced or the value is not used
INFO: UnusedVariable - 5:1 - $b is never referenced or the value is not used
INFO: UnusedVariable - 6:1 - $c is never referenced or the value is not used