Skip to content

Commit

Permalink
OffsetAccessValueAssignmentRule optimization for huge arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Oct 26, 2024
1 parent 11e0ab6 commit a07996a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Rules/Arrays/OffsetAccessValueAssignmentRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public function processNode(Node $node, Scope $scope): array
}

$arrayDimFetch = $node->var;
$varType = $scope->getType($arrayDimFetch->var);
if ($varType->isObject()->no()) {
return [];
}

if ($node instanceof Assign || $node instanceof Expr\AssignRef) {
$assignedValueType = $scope->getType($node->expr);
Expand Down

0 comments on commit a07996a

Please sign in to comment.