Skip to content

Commit de0a64c

Browse files
committed
Revert "Pass StatementContext around processExprNode as well"
This reverts commit 932f403.
1 parent ec2d94e commit de0a64c

File tree

3 files changed

+148
-173
lines changed

3 files changed

+148
-173
lines changed

src/Analyser/MutatingScope.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ private function resolveType(string $exprString, Expr $node): Type
942942
if ($this->getBooleanExpressionDepth($node->left) <= self::BOOLEAN_EXPRESSION_MAX_PROCESS_DEPTH) {
943943
$noopCallback = static function (): void {
944944
};
945-
$leftResult = $this->nodeScopeResolver->processExprNode(new Node\Stmt\Expression($node->left), $node->left, $this, $noopCallback, ExpressionContext::createDeep(), StatementContext::createTopLevel());
945+
$leftResult = $this->nodeScopeResolver->processExprNode(new Node\Stmt\Expression($node->left), $node->left, $this, $noopCallback, ExpressionContext::createDeep());
946946
$rightBooleanType = $leftResult->getTruthyScope()->getType($node->right)->toBoolean();
947947
} else {
948948
$rightBooleanType = $this->filterByTruthyValue($node->left)->getType($node->right)->toBoolean();
@@ -974,7 +974,7 @@ private function resolveType(string $exprString, Expr $node): Type
974974
if ($this->getBooleanExpressionDepth($node->left) <= self::BOOLEAN_EXPRESSION_MAX_PROCESS_DEPTH) {
975975
$noopCallback = static function (): void {
976976
};
977-
$leftResult = $this->nodeScopeResolver->processExprNode(new Node\Stmt\Expression($node->left), $node->left, $this, $noopCallback, ExpressionContext::createDeep(), StatementContext::createTopLevel());
977+
$leftResult = $this->nodeScopeResolver->processExprNode(new Node\Stmt\Expression($node->left), $node->left, $this, $noopCallback, ExpressionContext::createDeep());
978978
$rightBooleanType = $leftResult->getFalseyScope()->getType($node->right)->toBoolean();
979979
} else {
980980
$rightBooleanType = $this->filterByFalseyValue($node->left)->getType($node->right)->toBoolean();
@@ -1408,7 +1408,6 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
14081408
);
14091409
},
14101410
ExpressionContext::createDeep(),
1411-
StatementContext::createTopLevel(),
14121411
);
14131412
$throwPoints = $arrowFunctionExprResult->getThrowPoints();
14141413
$impurePoints = array_merge($arrowFunctionImpurePoints, $arrowFunctionExprResult->getImpurePoints());
@@ -2060,7 +2059,7 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
20602059
if ($node instanceof Expr\Ternary) {
20612060
$noopCallback = static function (): void {
20622061
};
2063-
$condResult = $this->nodeScopeResolver->processExprNode(new Node\Stmt\Expression($node->cond), $node->cond, $this, $noopCallback, ExpressionContext::createDeep(), StatementContext::createTopLevel());
2062+
$condResult = $this->nodeScopeResolver->processExprNode(new Node\Stmt\Expression($node->cond), $node->cond, $this, $noopCallback, ExpressionContext::createDeep());
20642063
if ($node->if === null) {
20652064
$conditionType = $this->getType($node->cond);
20662065
$booleanConditionType = $conditionType->toBoolean();

0 commit comments

Comments
 (0)