Skip to content

Commit 535cebc

Browse files
Rework
1 parent 9ca2718 commit 535cebc

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/Analyser/MutatingScope.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2987,7 +2987,7 @@ private static function intersectButNotNever(Type $nativeType, Type $inferredTyp
29872987
return $result;
29882988
}
29892989

2990-
public function enterMatch(Expr\Match_ $expr, ?Type $condType, ?Type $condNativeType): self
2990+
public function enterMatch(Expr\Match_ $expr, Type $condType, Type $condNativeType): self
29912991
{
29922992
if ($expr->cond instanceof Variable) {
29932993
return $this;
@@ -3001,8 +3001,8 @@ public function enterMatch(Expr\Match_ $expr, ?Type $condType, ?Type $condNative
30013001
return $this;
30023002
}
30033003

3004-
$type = $condType ?? $this->getType($cond);
3005-
$nativeType = $condNativeType ?? $this->getNativeType($cond);
3004+
$type = $condType;
3005+
$nativeType = $condNativeType;
30063006
$condExpr = new AlwaysRememberedExpr($cond, $type, $nativeType);
30073007
$expr->cond = $condExpr;
30083008

src/Analyser/NodeScopeResolver.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4178,10 +4178,6 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
41784178
$hasYield = true;
41794179
} elseif ($expr instanceof Expr\Match_) {
41804180
$deepContext = $context->enterDeep();
4181-
$condIsIncDec = $expr->cond instanceof Expr\PreInc
4182-
|| $expr->cond instanceof Expr\PostInc
4183-
|| $expr->cond instanceof Expr\PreDec
4184-
|| $expr->cond instanceof Expr\PostDec;
41854181
$condType = $scope->getType($expr->cond);
41864182
$condNativeType = $scope->getNativeType($expr->cond);
41874183
$condResult = $this->processExprNode($stmt, $expr->cond, $scope, $storage, $nodeCallback, $deepContext);
@@ -4190,7 +4186,7 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
41904186
$throwPoints = $condResult->getThrowPoints();
41914187
$impurePoints = $condResult->getImpurePoints();
41924188
$isAlwaysTerminating = $condResult->isAlwaysTerminating();
4193-
$matchScope = $scope->enterMatch($expr, $condIsIncDec ? $condType : null, $condIsIncDec ? $condNativeType : null);
4189+
$matchScope = $scope->enterMatch($expr, $condType, $condNativeType);
41944190
$armNodes = [];
41954191
$hasDefaultCond = false;
41964192
$hasAlwaysTrueCond = false;

0 commit comments

Comments
 (0)