mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Add better support for previous key types
This commit is contained in:
parent
549aee47f1
commit
ca06277f30
@ -722,7 +722,7 @@ class Reconciler
|
||||
null
|
||||
);
|
||||
|
||||
if (!$previous_key_type->isArrayKey()) {
|
||||
if (!$previous_key_type->isEmpty()) {
|
||||
$base_atomic_type->previous_key_type = $previous_key_type;
|
||||
}
|
||||
$base_atomic_type->previous_value_type = $previous_value_type;
|
||||
|
@ -290,6 +290,17 @@ class AssertTest extends TestCase
|
||||
$arr[$a->id]->foo();
|
||||
}'
|
||||
],
|
||||
'assertAfterNotEmptyArrayCheck' => [
|
||||
'<?php
|
||||
function foo(array $c): void {
|
||||
if (!empty($c["d"])) {}
|
||||
|
||||
foreach (["a", "b", "c"] as $k) {
|
||||
/** @psalm-suppress MixedAssignment */
|
||||
foreach ($c[$k] as $d) {}
|
||||
}
|
||||
}',
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user