Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/Type/ArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,12 @@ public function looseCompare(Type $type, PhpVersion $phpVersion): BooleanType

public function hasOffsetValueType(Type $offsetType): TrinaryLogic
{
$allowedArrayKeys = AllowedArrayKeysTypes::getType();
$offsetType = TypeCombinator::intersect($allowedArrayKeys, $offsetType)->toArrayKey();
$offsetArrayKeyType = $offsetType->toArrayKey();
if ($offsetArrayKeyType instanceof ErrorType) {
$allowedArrayKeys = AllowedArrayKeysTypes::getType();
$offsetArrayKeyType = TypeCombinator::intersect($allowedArrayKeys, $offsetType)->toArrayKey();
}
$offsetType = $offsetArrayKeyType;

if ($this->getKeyType()->isSuperTypeOf($offsetType)->no()
&& ($offsetType->isString()->no() || !$offsetType->isConstantScalarValue()->no())
Expand Down
Loading