Skip to content

Commit bbcce3f

Browse files
committed
move logic into HasOffset*
1 parent b418801 commit bbcce3f

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Diff for: src/Type/Accessory/HasOffsetType.php

+3
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
111111

112112
public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
113113
{
114+
if ($acceptingType instanceof NonEmptyArrayType) {
115+
return AcceptsResult::createYes();
116+
}
114117
return $this->isSubTypeOf($acceptingType)->toAcceptsResult();
115118
}
116119

Diff for: src/Type/Accessory/HasOffsetValueType.php

+4
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
122122

123123
public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
124124
{
125+
if ($acceptingType instanceof NonEmptyArrayType) {
126+
return AcceptsResult::createYes();
127+
}
128+
125129
return $this->isSubTypeOf($acceptingType)->toAcceptsResult();
126130
}
127131

Diff for: src/Type/Accessory/NonEmptyArrayType.php

-6
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ public function getConstantStrings(): array
7676

7777
public function accepts(Type $type, bool $strictTypes): AcceptsResult
7878
{
79-
if ($type instanceof HasOffsetType
80-
|| $type instanceof HasOffsetValueType
81-
) {
82-
return AcceptsResult::createYes();
83-
}
84-
8579
if ($type instanceof CompoundType) {
8680
return $type->isAcceptedBy($this, $strictTypes);
8781
}

0 commit comments

Comments
 (0)