Skip to content

Commit 8f73a13

Browse files
committed
Update NonEmptyArrayType.php
1 parent cb1b255 commit 8f73a13

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/Type/Accessory/NonEmptyArrayType.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,17 @@ public function accepts(Type $type, bool $strictTypes): AcceptsResult
7878
{
7979
$isArray = $type->isArray();
8080
$isIterableAtLeastOnce = $type->isIterableAtLeastOnce();
81+
$isNonEmptyArray = $isArray->and($isIterableAtLeastOnce);
8182

82-
return new AcceptsResult($isArray->and($isIterableAtLeastOnce), []);
83+
if ($isNonEmptyArray->yes()) {
84+
return AcceptsResult::createYes();
85+
}
86+
87+
if ($type instanceof CompoundType) {
88+
return $type->isAcceptedBy($this, $strictTypes);
89+
}
90+
91+
return new AcceptsResult($isNonEmptyArray, []);
8392
}
8493

8594
public function isSuperTypeOf(Type $type): IsSuperTypeOfResult

0 commit comments

Comments
 (0)