Skip to content

Commit

Permalink
types::nonEmpty()
Browse files Browse the repository at this point in the history
  • Loading branch information
vudaltsov committed Feb 24, 2024
1 parent 771a658 commit f2d95e8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/types.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public static function intRange(?int $min = null, ?int $max = null): Type
}

if ($min === $max) {
/** @var int $min */
return self::literalValue($min);
}

Expand Down Expand Up @@ -290,6 +291,16 @@ public static function literalValue(bool|int|float|string $value): Type
return new LiteralValueType($value);
}

/**
* @template TType
* @param Type<TType> $type
* @return Type<TType>
*/
public static function nonEmpty(Type $type): Type
{
return new NonEmptyType($type);
}

/**
* @template TKey
* @template TValue
Expand Down

0 comments on commit f2d95e8

Please sign in to comment.