Skip to content

Commit 0223f74

Browse files
committed
Fix Isset and Empty with FiberScope
1 parent f4e17d0 commit 0223f74

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3843,9 +3843,10 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
38433843
$this->callNodeCallback($nodeCallback, $expr->name, $scope, $storage);
38443844
}
38453845
} elseif ($expr instanceof Expr\Empty_) {
3846+
$this->processExprNode($stmt, $expr->expr, $scope, $storage, new NoopNodeCallback(), $context->enterDeep());
38463847
$nonNullabilityResult = $this->ensureNonNullability($scope, $expr->expr);
38473848
$scope = $this->lookForSetAllowedUndefinedExpressions($nonNullabilityResult->getScope(), $expr->expr);
3848-
$result = $this->processExprNode($stmt, $expr->expr, $scope, $storage, $nodeCallback, $context->enterDeep());
3849+
$result = $this->processExprNode($stmt, $this->deepNodeCloner->cloneNode($expr->expr), $scope, $storage, $nodeCallback, $context->enterDeep());
38493850
$scope = $result->getScope();
38503851
$hasYield = $result->hasYield();
38513852
$throwPoints = $result->getThrowPoints();
@@ -3860,9 +3861,10 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
38603861
$nonNullabilityResults = [];
38613862
$isAlwaysTerminating = false;
38623863
foreach ($expr->vars as $var) {
3864+
$this->processExprNode($stmt, $var, $scope, $storage, new NoopNodeCallback(), $context->enterDeep());
38633865
$nonNullabilityResult = $this->ensureNonNullability($scope, $var);
38643866
$scope = $this->lookForSetAllowedUndefinedExpressions($nonNullabilityResult->getScope(), $var);
3865-
$result = $this->processExprNode($stmt, $var, $scope, $storage, $nodeCallback, $context->enterDeep());
3867+
$result = $this->processExprNode($stmt, $this->deepNodeCloner->cloneNode($var), $scope, $storage, $nodeCallback, $context->enterDeep());
38663868
$scope = $result->getScope();
38673869
$hasYield = $hasYield || $result->hasYield();
38683870
$throwPoints = array_merge($throwPoints, $result->getThrowPoints());

0 commit comments

Comments
 (0)