mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Negation of numeric on array-key is fine too
This commit is contained in:
parent
6adf6a09f0
commit
2635e57cde
@ -1007,6 +1007,9 @@ class NegatedAssertionReconciler extends Reconciler
|
||||
|
||||
$non_numeric_types[] = $type;
|
||||
}
|
||||
} elseif ($type instanceof TArrayKey) {
|
||||
$did_remove_type = true;
|
||||
$non_numeric_types[] = new TString();
|
||||
} elseif (!$type->isNumericType()) {
|
||||
$non_numeric_types[] = $type;
|
||||
} else {
|
||||
|
@ -1038,6 +1038,7 @@ class TypeTest extends \Psalm\Tests\TestCase
|
||||
function foo(array $arr) : void {
|
||||
foreach ($arr as $k => $_) {
|
||||
if (is_numeric($k)) {}
|
||||
if (!is_numeric($k)) {}
|
||||
}
|
||||
}'
|
||||
],
|
||||
|
Loading…
x
Reference in New Issue
Block a user