Skip to content

Commit 7eb66f6

Browse files
committed
Always read doc comments from statements (forward-compatible with PHP-Parser 5)
1 parent 436bd79 commit 7eb66f6

File tree

4 files changed

+150
-134
lines changed

4 files changed

+150
-134
lines changed

src/Analyser/MutatingScope.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ private function resolveType(string $exprString, Expr $node): Type
792792
if ($this->getBooleanExpressionDepth($node->left) <= self::BOOLEAN_EXPRESSION_MAX_PROCESS_DEPTH) {
793793
$noopCallback = static function (): void {
794794
};
795-
$leftResult = $this->nodeScopeResolver->processExprNode($node->left, $this, $noopCallback, ExpressionContext::createDeep());
795+
$leftResult = $this->nodeScopeResolver->processExprNode(new Node\Stmt\Expression($node->left), $node->left, $this, $noopCallback, ExpressionContext::createDeep());
796796
$rightBooleanType = $leftResult->getTruthyScope()->getType($node->right)->toBoolean();
797797
} else {
798798
$rightBooleanType = $this->filterByTruthyValue($node->left)->getType($node->right)->toBoolean();
@@ -824,7 +824,7 @@ private function resolveType(string $exprString, Expr $node): Type
824824
if ($this->getBooleanExpressionDepth($node->left) <= self::BOOLEAN_EXPRESSION_MAX_PROCESS_DEPTH) {
825825
$noopCallback = static function (): void {
826826
};
827-
$leftResult = $this->nodeScopeResolver->processExprNode($node->left, $this, $noopCallback, ExpressionContext::createDeep());
827+
$leftResult = $this->nodeScopeResolver->processExprNode(new Node\Stmt\Expression($node->left), $node->left, $this, $noopCallback, ExpressionContext::createDeep());
828828
$rightBooleanType = $leftResult->getFalseyScope()->getType($node->right)->toBoolean();
829829
} else {
830830
$rightBooleanType = $this->filterByFalseyValue($node->left)->getType($node->right)->toBoolean();
@@ -1655,7 +1655,7 @@ private function resolveType(string $exprString, Expr $node): Type
16551655
if ($node instanceof Expr\Ternary) {
16561656
$noopCallback = static function (): void {
16571657
};
1658-
$condResult = $this->nodeScopeResolver->processExprNode($node->cond, $this, $noopCallback, ExpressionContext::createDeep());
1658+
$condResult = $this->nodeScopeResolver->processExprNode(new Node\Stmt\Expression($node->cond), $node->cond, $this, $noopCallback, ExpressionContext::createDeep());
16591659
if ($node->if === null) {
16601660
$conditionType = $this->getType($node->cond);
16611661
$booleanConditionType = $conditionType->toBoolean();

0 commit comments

Comments
 (0)