Skip to content

Commit

Permalink
simulate offsetSet to get throw points for ArrayAccess
Browse files Browse the repository at this point in the history
  • Loading branch information
rajyan committed Mar 7, 2022
1 parent 3d6c5c3 commit 67eef37
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Analyser/NodeScopeResolver.php
Expand Up @@ -3286,6 +3286,16 @@ private function processAssignVar(
$nodeCallback(new PropertyAssignNode($var, $assignedPropertyExpr, $isAssignOp), $scope);
}
}

if (!(new ObjectType(ArrayAccess::class))->isSuperTypeOf($varType)->no()) {
$throwPoints = array_merge($throwPoints, $this->processExprNode(
new MethodCall($var, 'offsetSet'),
$scope,
static function (): void {
},
$context,
)->getThrowPoints());
}
} elseif ($var instanceof PropertyFetch) {
$objectResult = $this->processExprNode($var->var, $scope, $nodeCallback, $context);
$hasYield = $objectResult->hasYield();
Expand Down

0 comments on commit 67eef37

Please sign in to comment.