Skip to content

Commit

Permalink
don't emit redundant error when checking a named type against itself
Browse files Browse the repository at this point in the history
  • Loading branch information
orklah committed Oct 25, 2021
1 parent e334923 commit caf9602
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Psalm/Internal/Type/AssertionReconciler.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,9 @@ private static function refine(
if ($key
&& $code_location
&& $new_type->getId() === $existing_var_type->getId()
//even if two objects are the same, equality is not guaranteed
// example: (ErrorException and TypeError are both Throwable but not equal)
&& !$new_type->hasNamedObjectType()
&& !$is_equality
&& !($original_assertion === 'loaded-class-string' && $old_var_type_string === 'class-string')
&& (!($statements_analyzer->getSource()->getSource() instanceof TraitAnalyzer)
Expand Down

0 comments on commit caf9602

Please sign in to comment.