Skip to content

Commit

Permalink
allow !$isOffsetAccessible->yes() for isUndefinedExpressionAllowed …
Browse files Browse the repository at this point in the history
…or isSpecified expression
  • Loading branch information
rajyan committed May 14, 2022
1 parent fb69caf commit 64a4f9c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Rules/Arrays/NonexistentOffsetInArrayDimFetchRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ public function processNode(Node $node, Scope $scope): array

$isOffsetAccessible = $isOffsetAccessibleType->isOffsetAccessible();

if (($scope->isInExpressionAssign($node) || $scope->isUndefinedExpressionAllowed($node)) && $isOffsetAccessible->yes()) {
if (
$scope->isInExpressionAssign($node) && $isOffsetAccessible->yes()
|| $scope->isUndefinedExpressionAllowed($node)
|| $scope->isSpecified($node)
) {
return [];
}

Expand All @@ -83,7 +87,7 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

if ($dimType === null || $scope->isSpecified($node)) {
if ($dimType === null) {
return [];
}

Expand Down

0 comments on commit 64a4f9c

Please sign in to comment.