Skip to content

Commit

Permalink
Prevent overly greedy $scope->getType() calls in Arrays*Rules
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored and ondrejmirtes committed Dec 13, 2022
1 parent 8c58c09 commit fcee93f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Rules/Arrays/OffsetAccessValueAssignmentRule.php
Expand Up @@ -53,7 +53,6 @@ public function processNode(Node $node, Scope $scope): array
$assignedValueType = $scope->getType($node);
}

$originalArrayType = $scope->getType($arrayDimFetch->var);
$arrayTypeResult = $this->ruleLevelHelper->findTypeToCheck(
$scope,
$arrayDimFetch->var,
Expand All @@ -76,6 +75,8 @@ static function (Type $varType) use ($assignedValueType): bool {
return [];
}

$originalArrayType = $scope->getType($arrayDimFetch->var);

return [
RuleErrorBuilder::message(sprintf(
'%s does not accept %s.',
Expand Down

0 comments on commit fcee93f

Please sign in to comment.