mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Fix issue with array_key_exists not having an effect
This commit is contained in:
parent
c8faaf0ca9
commit
772fd496b7
@ -112,7 +112,9 @@ class Reconciler
|
|||||||
$has_equality = true;
|
$has_equality = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$has_isset = $has_isset || $new_type_part_part === 'isset';
|
$has_isset = $has_isset
|
||||||
|
|| $new_type_part_part === 'isset'
|
||||||
|
|| $new_type_part_part === 'array-key-exists';
|
||||||
|
|
||||||
$result_type_candidate = self::reconcileTypes(
|
$result_type_candidate = self::reconcileTypes(
|
||||||
$new_type_part_part,
|
$new_type_part_part,
|
||||||
|
@ -423,6 +423,15 @@ class RedundantConditionTest extends TestCase
|
|||||||
var_export($x);
|
var_export($x);
|
||||||
}',
|
}',
|
||||||
],
|
],
|
||||||
|
'arrayKeyExistsAccess' => [
|
||||||
|
'<?php
|
||||||
|
/** @param array<int, string> $arr */
|
||||||
|
function foo(array $arr) : void {
|
||||||
|
if (array_key_exists(1, $arr)) {
|
||||||
|
$a = ($arr[1] === "b") ? true : false;
|
||||||
|
}
|
||||||
|
}',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user