1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Allow <false|T as object> to be falsy (#4711)

This commit is contained in:
orklah 2020-11-26 22:47:44 +01:00 committed by GitHub
parent a183aafadc
commit 74c07bbc08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -165,7 +165,8 @@ class SimpleNegatedAssertionReconciler extends Reconciler
$suppressed_issues,
$failed_reconciliation,
$is_equality,
$is_strict_equality
$is_strict_equality,
false
);
}
@ -540,7 +541,8 @@ class SimpleNegatedAssertionReconciler extends Reconciler
array $suppressed_issues,
int &$failed_reconciliation,
bool $is_equality,
bool $is_strict_equality
bool $is_strict_equality,
bool $recursive_check
) : Type\Union {
$old_var_type_string = $existing_var_type->getId();
$existing_var_atomic_types = $existing_var_type->getAtomicTypes();
@ -757,7 +759,8 @@ class SimpleNegatedAssertionReconciler extends Reconciler
$suppressed_issues,
$template_did_fail,
$is_equality,
$is_strict_equality
$is_strict_equality,
true
);
$did_remove_type = true;
@ -777,7 +780,10 @@ class SimpleNegatedAssertionReconciler extends Reconciler
$existing_var_type->possibly_undefined = false;
$existing_var_type->possibly_undefined_from_try = false;
if ((!$did_remove_type || empty($existing_var_type->getAtomicTypes())) && !$existing_var_type->hasTemplate()) {
if ((!$did_remove_type || empty($existing_var_type->getAtomicTypes())) &&
!$existing_var_type->hasTemplate() &&
!$recursive_check //don't emit issue if we're checking a subtype
) {
if ($key && $code_location && !$is_equality) {
self::triggerIssueForImpossible(
$existing_var_type,