Skip to content

Commit

Permalink
Process ClassConstFetch::$name
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Oct 3, 2024
1 parent 712c33e commit b38c852
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Analyser/NodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3159,9 +3159,6 @@ static function (): void {
$throwPoints = $result->getThrowPoints();
$impurePoints = $result->getImpurePoints();
} elseif ($expr instanceof Expr\ClassConstFetch) {
$hasYield = false;
$throwPoints = [];
$impurePoints = [];
if ($expr->class instanceof Expr) {
$result = $this->processExprNode($stmt, $expr->class, $scope, $nodeCallback, $context->enterDeep());
$scope = $result->getScope();
Expand All @@ -3174,6 +3171,16 @@ static function (): void {
$impurePoints = [];
$nodeCallback($expr->class, $scope);
}

if ($expr->name instanceof Expr) {
$result = $this->processExprNode($stmt, $expr->name, $scope, $nodeCallback, $context->enterDeep());
$scope = $result->getScope();
$hasYield = $hasYield || $result->hasYield();
$throwPoints = array_merge($throwPoints, $result->getThrowPoints());
$impurePoints = array_merge($impurePoints, $result->getImpurePoints());
} else {
$nodeCallback($expr->name, $scope);
}
} elseif ($expr instanceof Expr\Empty_) {
$nonNullabilityResult = $this->ensureNonNullability($scope, $expr->expr);
$scope = $this->lookForSetAllowedUndefinedExpressions($nonNullabilityResult->getScope(), $expr->expr);
Expand Down

0 comments on commit b38c852

Please sign in to comment.