mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Disable list flag for TKeyedArray after unset
This commit is contained in:
parent
b42c2814a9
commit
4f223db455
@ -50,6 +50,7 @@ class UnsetAnalyzer
|
||||
|| $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
|
||||
}
|
||||
|
@ -1024,6 +1024,13 @@ class ArrayAccessTest extends TestCase
|
||||
return $p["name"];
|
||||
}'
|
||||
],
|
||||
'unsetListKeyedArrayDisableListFlag' => [
|
||||
'<?php
|
||||
$a = ["a", "b"];
|
||||
unset($a[0]);
|
||||
',
|
||||
'assertions' => ['$a===' => 'array{1: "b"}']
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user