Skip to content

Commit 94d9b6c

Browse files
committed
Revert unnecessary changes to keep the diff readable
1 parent c2aae08 commit 94d9b6c

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/Analyser/TypeSpecifier.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,7 @@ public function specifyTypesInCondition(
240240
}
241241
}
242242

243-
$leftType = $scope->getType($expr->left);
244243
$rightType = $scope->getType($expr->right);
245-
246244
if (
247245
$expr->left instanceof ClassConstFetch &&
248246
$expr->left->class instanceof Expr &&
@@ -261,40 +259,42 @@ public function specifyTypesInCondition(
261259
);
262260
}
263261

262+
$exprLeftType = $scope->getType($expr->left);
263+
$exprRightType = $scope->getType($expr->right);
264+
264265
$types = null;
265266

266267
if (
267268
(
268-
$leftType instanceof ConstantType
269+
$exprLeftType instanceof ConstantType
269270
&& !$expr->right instanceof Node\Scalar
270-
) || $leftType instanceof EnumCaseObjectType
271+
) || $exprLeftType instanceof EnumCaseObjectType
271272
) {
272273
$types = $this->create(
273274
$expr->right,
274-
$leftType,
275+
$exprLeftType,
275276
$context,
276277
false,
277278
$scope,
278279
);
279280
}
280-
281281
if (
282282
(
283-
$rightType instanceof ConstantType
283+
$exprRightType instanceof ConstantType
284284
&& !$expr->left instanceof Node\Scalar
285-
) || $rightType instanceof EnumCaseObjectType
285+
) || $exprRightType instanceof EnumCaseObjectType
286286
) {
287-
$leftTypes = $this->create(
287+
$leftType = $this->create(
288288
$expr->left,
289-
$rightType,
289+
$exprRightType,
290290
$context,
291291
false,
292292
$scope,
293293
);
294294
if ($types !== null) {
295-
$types = $types->unionWith($leftTypes);
295+
$types = $types->unionWith($leftType);
296296
} else {
297-
$types = $leftTypes;
297+
$types = $leftType;
298298
}
299299
}
300300

@@ -319,9 +319,10 @@ public function specifyTypesInCondition(
319319
return $leftTypes->unionWith($rightTypes);
320320
}
321321

322-
return $this->create($expr->left, $leftType, $context, false, $scope)->normalize($scope)
323-
->intersectWith($this->create($expr->right, $rightType, $context, false, $scope)->normalize($scope));
322+
return $this->create($expr->left, $exprLeftType, $context, false, $scope)->normalize($scope)
323+
->intersectWith($this->create($expr->right, $exprRightType, $context, false, $scope)->normalize($scope));
324324
}
325+
325326
} elseif ($expr instanceof Node\Expr\BinaryOp\NotIdentical) {
326327
return $this->specifyTypesInCondition(
327328
$scope,

0 commit comments

Comments
 (0)