Skip to content

Commit 074a4e1

Browse files
committed
prep
1 parent 609686a commit 074a4e1

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ private function processStmtNode(
564564
$stmtScope = $this->processStmtVarAnnotation($scope, $stmt, $stmt->expr, $nodeCallback);
565565
}
566566

567-
$this->callNodeCallback($nodeCallback, $stmt, $stmt, $stmtScope, $storage, ExpressionContext::createTopLevel());
567+
$this->callNodeCallback($nodeCallback, $stmt, $stmtScope, $storage);
568568

569569
$overridingThrowPoints = $this->getOverridingThrowPoints($stmt, $scope);
570570

@@ -575,8 +575,8 @@ private function processStmtNode(
575575
$alwaysTerminating = false;
576576
$exitPoints = [];
577577
foreach ($stmt->declares as $declare) {
578-
$this->callNodeCallback($nodeCallback, $stmt, $declare, $scope, $storage, ExpressionContext::createTopLevel());
579-
$this->callNodeCallback($nodeCallback, $stmt, $declare->value, $scope, $storage, ExpressionContext::createTopLevel());
578+
$this->callNodeCallback($nodeCallback, $declare, $scope, $storage);
579+
$this->callNodeCallback($nodeCallback, $declare->value, $scope, $storage);
580580
if (
581581
$declare->key->name !== 'strict_types'
582582
|| !($declare->value instanceof Node\Scalar\Int_)
@@ -2579,7 +2579,7 @@ public function processExprNode(
25792579
throw new ShouldNotHappenException(sprintf('Expr %s on line %d has already been analysed', get_class($expr), $expr->getStartLine()));
25802580
}
25812581

2582-
$this->callNodeCallbackWithExpression($nodeCallback, $stmt, $expr, $scope, $storage, $context);
2582+
$this->callNodeCallbackWithExpression($nodeCallback, $expr, $scope, $storage, $context);
25832583

25842584
if ($expr instanceof Variable) {
25852585
$hasYield = false;
@@ -3562,7 +3562,7 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
35623562
$leftMergedWithRightScope = $leftResult->getScope()->mergeWith($rightResult->getScope());
35633563
}
35643564

3565-
$this->callNodeCallbackWithExpression($nodeCallback, $stmt, new BooleanAndNode($expr, $leftResult->getTruthyScope()), $scope, $storage, $context);
3565+
$this->callNodeCallbackWithExpression($nodeCallback, new BooleanAndNode($expr, $leftResult->getTruthyScope()), $scope, $storage, $context);
35663566

35673567
$result = new ExpressionResult(
35683568
$leftMergedWithRightScope,
@@ -3585,7 +3585,7 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
35853585
$leftMergedWithRightScope = $leftResult->getScope()->mergeWith($rightResult->getScope());
35863586
}
35873587

3588-
$this->callNodeCallbackWithExpression($nodeCallback, $stmt, new BooleanOrNode($expr, $leftResult->getFalseyScope()), $scope, $storage, $context);
3588+
$this->callNodeCallbackWithExpression($nodeCallback, new BooleanOrNode($expr, $leftResult->getFalseyScope()), $scope, $storage, $context);
35893589

35903590
$result = new ExpressionResult(
35913591
$leftMergedWithRightScope,
@@ -4882,7 +4882,6 @@ private function getAssignedVariables(Expr $expr): array
48824882
*/
48834883
private function callNodeCallbackWithExpression(
48844884
callable $nodeCallback,
4885-
Node\Stmt $stmt,
48864885
Expr $expr,
48874886
MutatingScope $scope,
48884887
ExpressionResultStorage $storage,
@@ -4892,16 +4891,14 @@ private function callNodeCallbackWithExpression(
48924891
if ($context->isDeep()) {
48934892
$scope = $scope->exitFirstLevelStatements();
48944893
}
4895-
$this->callNodeCallback($nodeCallback, $stmt, $expr, $scope, $storage, $context);
4894+
$this->callNodeCallback($nodeCallback, $expr, $scope, $storage);
48964895
}
48974896

48984897
protected function callNodeCallback(
48994898
callable $nodeCallback,
4900-
Node\Stmt $stmt,
49014899
Node $node,
49024900
MutatingScope $scope,
49034901
ExpressionResultStorage $storage,
4904-
ExpressionContext $context,
49054902
): void
49064903
{
49074904
$nodeCallback($node, $scope);
@@ -5609,7 +5606,7 @@ private function processArgs(
56095606
}
56105607
}
56115608

5612-
$this->callNodeCallbackWithExpression($nodeCallback, $stmt, $arg->value, $scopeToPass, $storage, $context);
5609+
$this->callNodeCallbackWithExpression($nodeCallback, $arg->value, $scopeToPass, $storage, $context);
56135610
$closureResult = $this->processClosureNode($stmt, $arg->value, $scopeToPass, $storage, $nodeCallback, $context, $parameterType ?? null);
56145611
if ($callCallbackImmediately) {
56155612
$throwPoints = array_merge($throwPoints, array_map(static fn (InternalThrowPoint $throwPoint) => $throwPoint->isExplicit() ? InternalThrowPoint::createExplicit($scope, $throwPoint->getType(), $arg->value, $throwPoint->canContainAnyThrowable()) : InternalThrowPoint::createImplicit($scope, $arg->value), $closureResult->getThrowPoints()));
@@ -5664,7 +5661,7 @@ private function processArgs(
56645661
}
56655662
}
56665663

5667-
$this->callNodeCallbackWithExpression($nodeCallback, $stmt, $arg->value, $scopeToPass, $storage, $context);
5664+
$this->callNodeCallbackWithExpression($nodeCallback, $arg->value, $scopeToPass, $storage, $context);
56685665
$arrowFunctionResult = $this->processArrowFunctionNode($stmt, $arg->value, $scopeToPass, $storage, $nodeCallback, $parameterType ?? null);
56695666
if ($callCallbackImmediately) {
56705667
$throwPoints = array_merge($throwPoints, array_map(static fn (InternalThrowPoint $throwPoint) => $throwPoint->isExplicit() ? InternalThrowPoint::createExplicit($scope, $throwPoint->getType(), $arg->value, $throwPoint->canContainAnyThrowable()) : InternalThrowPoint::createImplicit($scope, $arg->value), $arrowFunctionResult->getThrowPoints()));

0 commit comments

Comments
 (0)