Skip to content

Commit

Permalink
allow StrictMixedType as a special case
Browse files Browse the repository at this point in the history
  • Loading branch information
rajyan committed May 14, 2022
1 parent 30a0aa2 commit 7770a18
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Rules/Arrays/NonexistentOffsetInArrayDimFetchRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PHPStan\Rules\RuleErrorBuilder;
use PHPStan\Rules\RuleLevelHelper;
use PHPStan\Type\ErrorType;
use PHPStan\Type\StrictMixedType;
use PHPStan\Type\Type;
use PHPStan\Type\VerbosityLevel;
use function sprintf;
Expand Down Expand Up @@ -58,7 +59,7 @@ public function processNode(Node $node, Scope $scope): array

if (
$scope->isInExpressionAssign($node) && $isOffsetAccessible->yes()
|| ($scope->isUndefinedExpressionAllowed($node) || $scope->isSpecified($node)) && !$isOffsetAccessible->no()
|| ($scope->isUndefinedExpressionAllowed($node) || $scope->isSpecified($node)) && (!$isOffsetAccessible->no() || $scope->getType($node->var) instanceof StrictMixedType)
) {
return [];
}
Expand Down

0 comments on commit 7770a18

Please sign in to comment.