psalm
psalm copied to clipboard
Unset on shape with literal variable key not inferring exact shape
https://psalm.dev/r/1f834d0ed7, already fixing in my immutable PR
I found these snippets:
https://psalm.dev/r/1f834d0ed7
<?php
$a = 1;
$test = [0, 1];
unset($test[$a]);
/** @psalm-trace $test **/
$test2 = [0, 1];
unset($test2[1]);
/** @psalm-trace $test2 */
Psalm output (using commit 028ac7f):
INFO: Trace - 7:1 - $test: array<0|1, 0|1>
INFO: Trace - 9:27 - $test2: array{0}
Yup, this is fixed :)