Skip to content
Permalink
Browse files

Preserve more information after removing types

  • Loading branch information
muglug committed Dec 27, 2019
1 parent 9a04d93 commit 1d2fefd64760afe22af90a59f4ae6478cc9fead6
Showing with 25 additions and 5 deletions.
  1. +25 −5 src/Psalm/Internal/Type/NegatedAssertionReconciler.php
@@ -826,7 +826,11 @@ private static function reconcileScalar(
}

if ($non_scalar_types) {
return new Type\Union($non_scalar_types);
$type = new Type\Union($non_scalar_types);
$type->ignore_falsable_issues = $existing_var_type->ignore_falsable_issues;
$type->ignore_nullable_issues = $existing_var_type->ignore_nullable_issues;
$type->from_docblock = $existing_var_type->from_docblock;
return $type;
}

$failed_reconciliation = 2;
@@ -890,7 +894,11 @@ private static function reconcileObject(
}

if ($non_object_types) {
return new Type\Union($non_object_types);
$type = new Type\Union($non_object_types);
$type->ignore_falsable_issues = $existing_var_type->ignore_falsable_issues;
$type->ignore_nullable_issues = $existing_var_type->ignore_nullable_issues;
$type->from_docblock = $existing_var_type->from_docblock;
return $type;
}

$failed_reconciliation = 2;
@@ -950,7 +958,11 @@ private static function reconcileNumeric(
}

if ($non_numeric_types) {
return new Type\Union($non_numeric_types);
$type = new Type\Union($non_numeric_types);
$type->ignore_falsable_issues = $existing_var_type->ignore_falsable_issues;
$type->ignore_nullable_issues = $existing_var_type->ignore_nullable_issues;
$type->from_docblock = $existing_var_type->from_docblock;
return $type;
}

$failed_reconciliation = 2;
@@ -1018,7 +1030,11 @@ private static function reconcileString(
}

if ($non_string_types) {
return new Type\Union($non_string_types);
$type = new Type\Union($non_string_types);
$type->ignore_falsable_issues = $existing_var_type->ignore_falsable_issues;
$type->ignore_nullable_issues = $existing_var_type->ignore_nullable_issues;
$type->from_docblock = $existing_var_type->from_docblock;
return $type;
}

$failed_reconciliation = 2;
@@ -1091,7 +1107,11 @@ private static function reconcileArray(
}

if ($non_array_types) {
return new Type\Union($non_array_types);
$type = new Type\Union($non_array_types);
$type->ignore_falsable_issues = $existing_var_type->ignore_falsable_issues;
$type->ignore_nullable_issues = $existing_var_type->ignore_nullable_issues;
$type->from_docblock = $existing_var_type->from_docblock;
return $type;
}

$failed_reconciliation = 2;

0 comments on commit 1d2fefd

Please sign in to comment.
You can’t perform that action at this time.