Skip to content

Commit bf5ba33

Browse files
committed
Don't use instanceof
1 parent bbcce3f commit bf5ba33

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

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

112112
public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
113113
{
114-
if ($acceptingType instanceof NonEmptyArrayType) {
114+
if ($acceptingType->isArray()->yes() && $acceptingType->isIterableAtLeastOnce()->yes()) {
115115
return AcceptsResult::createYes();
116116
}
117117
return $this->isSubTypeOf($acceptingType)->toAcceptsResult();

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

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

123123
public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
124124
{
125-
if ($acceptingType instanceof NonEmptyArrayType) {
125+
if ($acceptingType->isArray()->yes() && $acceptingType->isIterableAtLeastOnce()->yes()) {
126126
return AcceptsResult::createYes();
127127
}
128128

0 commit comments

Comments
 (0)