From 3102258ca6b5d1d5b8cf03b314571d0e43a2c6ff Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 26 Jul 2026 20:04:27 +0200 Subject: [PATCH 1/2] Simplify `AccessoryArrayListType->isSubTypeOf()` --- src/Type/Accessory/AccessoryArrayListType.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Type/Accessory/AccessoryArrayListType.php b/src/Type/Accessory/AccessoryArrayListType.php index d7103a27b51..640a0f9cce7 100644 --- a/src/Type/Accessory/AccessoryArrayListType.php +++ b/src/Type/Accessory/AccessoryArrayListType.php @@ -113,8 +113,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()), [], ); } From 51034e853c38665ed16b758b3b33fe23908ff102 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 26 Jul 2026 20:09:41 +0200 Subject: [PATCH 2/2] simplify --- src/Type/Accessory/AccessoryArrayListType.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Type/Accessory/AccessoryArrayListType.php b/src/Type/Accessory/AccessoryArrayListType.php index 640a0f9cce7..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