Skip to content

Commit

Permalink
Move code around a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jul 6, 2024
1 parent 2c08dfa commit b41f520
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Analyser/MutatingScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -1318,12 +1318,6 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
$impurePoints = array_merge($arrowFunctionImpurePoints, $arrowFunctionExprResult->getImpurePoints());
$usedVariables = [];
} else {
$closureScope = $this->enterAnonymousFunctionWithoutReflection($node, $callableParameters);
$closureReturnStatements = [];
$closureYieldStatements = [];
$closureExecutionEnds = [];
$closureImpurePoints = [];
$invalidateExpressions = [];
if (self::$resolveClosureTypeDepth >= 2) {
return new ClosureType(
$parameters,
Expand All @@ -1333,6 +1327,14 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
}

self::$resolveClosureTypeDepth++;

$closureScope = $this->enterAnonymousFunctionWithoutReflection($node, $callableParameters);
$closureReturnStatements = [];
$closureYieldStatements = [];
$closureExecutionEnds = [];
$closureImpurePoints = [];
$invalidateExpressions = [];

try {
$closureStatementResult = $this->nodeScopeResolver->processStmtNodes($node, $node->stmts, $closureScope, static function (Node $node, Scope $scope) use ($closureScope, &$closureReturnStatements, &$closureYieldStatements, &$closureExecutionEnds, &$closureImpurePoints, &$invalidateExpressions): void {
if ($scope->getAnonymousFunctionReflection() !== $closureScope->getAnonymousFunctionReflection()) {
Expand Down

0 comments on commit b41f520

Please sign in to comment.