diff --git a/src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php index 3943db8e46d..febeb353ee6 100644 --- a/src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php @@ -50,6 +50,7 @@ public static function analyze( || $var->dim instanceof PhpParser\Node\Scalar\LNumber ) { if (isset($atomic_root_type->properties[$var->dim->value])) { + $atomic_root_type->is_list = false; unset($atomic_root_type->properties[$var->dim->value]); $root_type->bustCache(); //remove id cache } diff --git a/tests/ArrayAccessTest.php b/tests/ArrayAccessTest.php index c391582d3a7..38c4f3c41e2 100644 --- a/tests/ArrayAccessTest.php +++ b/tests/ArrayAccessTest.php @@ -1024,6 +1024,13 @@ function f($p): int { return $p["name"]; }' ], + 'unsetListKeyedArrayDisableListFlag' => [ + ' ['$a===' => 'array{1: "b"}'] + ], ]; }