diff --git a/src/types.php b/src/types.php index e834b6d..3ada628 100644 --- a/src/types.php +++ b/src/types.php @@ -89,6 +89,10 @@ public static function arrayElement(Type $type, bool $optional = false): ArrayEl */ public static function arrayShape(array $elements = [], bool $sealed = true): Type { + if (!$sealed && $elements === []) { + return self::array; + } + return new ArrayShapeType( array_map( static fn(Type|ArrayElement $element): ArrayElement => $element instanceof Type ? new ArrayElement($element) : $element,