We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d6dab64 commit dc6e2c0Copy full SHA for dc6e2c0
src/Type/Constant/ConstantArrayType.php
@@ -582,8 +582,11 @@ public function findTypeAndMethodNames(): array
582
583
public function hasOffsetValueType(Type $offsetType): TrinaryLogic
584
{
585
- $allowedArrayKeys = AllowedArrayKeysTypes::getType();
586
- $offsetArrayKeyType = TypeCombinator::intersect($allowedArrayKeys, $offsetType)->toArrayKey();
+ $offsetArrayKeyType = $offsetType->toArrayKey();
+ if ($offsetArrayKeyType instanceof ErrorType) {
587
+ $allowedArrayKeys = AllowedArrayKeysTypes::getType();
588
+ $offsetArrayKeyType = TypeCombinator::intersect($allowedArrayKeys, $offsetType)->toArrayKey();
589
+ }
590
591
return $this->recursiveHasOffsetValueType($offsetArrayKeyType);
592
}
0 commit comments