1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Don’t coerce false to null when coming from ignore-false type

This commit is contained in:
Brown 2019-09-20 15:30:29 -04:00
parent be4894c8e0
commit c68dcf2f74

View File

@ -1132,8 +1132,10 @@ class ArrayFetchAnalyzer
}
if ($offset_type_part instanceof Type\Atomic\TFalse) {
$offset_type->addType(new Type\Atomic\TLiteralInt(0));
$offset_type->removeType($key);
if (!$offset_type->ignore_falsable_issues) {
$offset_type->addType(new Type\Atomic\TLiteralInt(0));
$offset_type->removeType($key);
}
} elseif ($offset_type_part instanceof Type\Atomic\TTrue) {
$offset_type->addType(new Type\Atomic\TLiteralInt(1));
$offset_type->removeType($key);