diff --git a/src/Type/Accessory/AccessoryArrayListType.php b/src/Type/Accessory/AccessoryArrayListType.php index d7103a27b51..d832f6de853 100644 --- a/src/Type/Accessory/AccessoryArrayListType.php +++ b/src/Type/Accessory/AccessoryArrayListType.php @@ -79,11 +79,9 @@ public function getConstantStrings(): array public function accepts(Type $type, bool $strictTypes): AcceptsResult { - $isArray = $type->isArray(); $isList = $type->isList(); - $isListArray = $isArray->and($isList); - if ($isListArray->yes()) { + if ($isList->yes()) { return AcceptsResult::createYes(); } @@ -91,7 +89,7 @@ public function accepts(Type $type, bool $strictTypes): AcceptsResult return $type->isAcceptedBy($this, $strictTypes); } - return new AcceptsResult($isListArray, []); + return new AcceptsResult($isList, []); } public function isSuperTypeOf(Type $type): IsSuperTypeOfResult @@ -104,7 +102,7 @@ public function isSuperTypeOf(Type $type): IsSuperTypeOfResult return $type->isSubTypeOf($this); } - return new IsSuperTypeOfResult($type->isArray()->and($type->isList()), []); + return new IsSuperTypeOfResult($type->isList(), []); } public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult @@ -113,8 +111,15 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult return $otherType->isSuperTypeOf($this); } + if ($otherType instanceof self) { + return new IsSuperTypeOfResult( + TrinaryLogic::createYes(), + [], + ); + } + return new IsSuperTypeOfResult( - $otherType->isArray()->and($otherType->isList())->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()), + $otherType->isList()->and(TrinaryLogic::createMaybe()), [], ); }