Skip to content

Commit

Permalink
Prevent unnecesary calls to isSuperTypeOf
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored and ondrejmirtes committed Jun 18, 2024
1 parent ab74e58 commit 7a07852
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Reflection/InitializerExprTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -1350,9 +1350,7 @@ public function resolveIdenticalType(Type $leftType, Type $rightType): BooleanTy
return new ConstantBooleanType($leftTypeFiniteTypes[0]->equals($rightTypeFiniteType[0]));
}

$isLeftSupertype = $leftType->isSuperTypeOf($rightType);
$isRightSupertype = $rightType->isSuperTypeOf($leftType);
if ($isLeftSupertype->no() && $isRightSupertype->no()) {
if ($leftType->isSuperTypeOf($rightType)->no() && $rightType->isSuperTypeOf($leftType)->no()) {
return new ConstantBooleanType(false);
}

Expand Down

0 comments on commit 7a07852

Please sign in to comment.