Skip to content

Commit 79c0309

Browse files
staabmondrejmirtes
authored andcommitted
TypeSpecifier: Prevent unnecessary type specification
1 parent abcab84 commit 79c0309

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/Analyser/TypeSpecifier.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,17 +2539,15 @@ public function resolveIdentical(Expr\BinaryOp\Identical $expr, Scope $scope, Ty
25392539
if ($identicalType instanceof ConstantBooleanType) {
25402540
$never = new NeverType();
25412541
$contextForTypes = $identicalType->getValue() ? $context->negate() : $context;
2542-
$leftTypes = $this->create($leftExpr, $never, $contextForTypes, $scope)->setRootExpr($expr);
2543-
$rightTypes = $this->create($rightExpr, $never, $contextForTypes, $scope)->setRootExpr($expr);
25442542
if ($leftExpr instanceof AlwaysRememberedExpr) {
2545-
$leftTypes = $leftTypes->unionWith(
2546-
$this->create($unwrappedLeftExpr, $never, $contextForTypes, $scope)->setRootExpr($expr),
2547-
);
2543+
$leftTypes = $this->create($unwrappedLeftExpr, $never, $contextForTypes, $scope)->setRootExpr($expr);
2544+
} else {
2545+
$leftTypes = $this->create($leftExpr, $never, $contextForTypes, $scope)->setRootExpr($expr);
25482546
}
25492547
if ($rightExpr instanceof AlwaysRememberedExpr) {
2550-
$rightTypes = $rightTypes->unionWith(
2551-
$this->create($unwrappedRightExpr, $never, $contextForTypes, $scope)->setRootExpr($expr),
2552-
);
2548+
$rightTypes = $this->create($unwrappedRightExpr, $never, $contextForTypes, $scope)->setRootExpr($expr);
2549+
} else {
2550+
$rightTypes = $this->create($rightExpr, $never, $contextForTypes, $scope)->setRootExpr($expr);
25532551
}
25542552
return $leftTypes->unionWith($rightTypes);
25552553
}

0 commit comments

Comments
 (0)