@@ -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 ());
945+ $ leftResult = $ this ->nodeScopeResolver ->processExprNode (new Node \Stmt \Expression ($ node ->left ), $ node ->left , $ this , $ noopCallback , ExpressionContext::createDeep (), StatementContext:: createTopLevel () );
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 ());
977+ $ leftResult = $ this ->nodeScopeResolver ->processExprNode (new Node \Stmt \Expression ($ node ->left ), $ node ->left , $ this , $ noopCallback , ExpressionContext::createDeep (), StatementContext:: createTopLevel () );
978978 $ rightBooleanType = $ leftResult ->getFalseyScope ()->getType ($ node ->right )->toBoolean ();
979979 } else {
980980 $ rightBooleanType = $ this ->filterByFalseyValue ($ node ->left )->getType ($ node ->right )->toBoolean ();
@@ -1408,6 +1408,7 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
14081408 );
14091409 },
14101410 ExpressionContext::createDeep (),
1411+ StatementContext::createTopLevel (),
14111412 );
14121413 $ throwPoints = $ arrowFunctionExprResult ->getThrowPoints ();
14131414 $ impurePoints = array_merge ($ arrowFunctionImpurePoints , $ arrowFunctionExprResult ->getImpurePoints ());
@@ -2059,7 +2060,7 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
20592060 if ($ node instanceof Expr \Ternary) {
20602061 $ noopCallback = static function (): void {
20612062 };
2062- $ condResult = $ this ->nodeScopeResolver ->processExprNode (new Node \Stmt \Expression ($ node ->cond ), $ node ->cond , $ this , $ noopCallback , ExpressionContext::createDeep ());
2063+ $ condResult = $ this ->nodeScopeResolver ->processExprNode (new Node \Stmt \Expression ($ node ->cond ), $ node ->cond , $ this , $ noopCallback , ExpressionContext::createDeep (), StatementContext:: createTopLevel () );
20632064 if ($ node ->if === null ) {
20642065 $ conditionType = $ this ->getType ($ node ->cond );
20652066 $ booleanConditionType = $ conditionType ->toBoolean ();
0 commit comments