Skip to content

Commit

Permalink
Added literalInt, literalString, nonEmptyString, numeric aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
vudaltsov committed Feb 23, 2024
1 parent ed3f00d commit 23746ca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/types.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ enum types implements Type
case float;
case int;
case iterable;
case literalInt;
case literalString;
case mixed;
case negativeInt;
case never;
case nonEmptyString;
case nonNegativeInt;
case nonPositiveInt;
case null;
case numeric;
case numericString;
case object;
case positiveInt;
Expand Down Expand Up @@ -427,12 +431,16 @@ public function accept(TypeVisitor $visitor): mixed
self::float => $visitor->float($this),
self::int => $visitor->int($this),
self::iterable => $visitor->iterable($this, self::mixed, self::mixed),
self::literalInt => $visitor->anyLiteral($this, self::int),
self::literalString => $visitor->anyLiteral($this, self::string),
self::mixed => $visitor->mixed($this),
self::negativeInt => $visitor->intRange($this, null, -1),
self::never => $visitor->never($this),
self::nonEmptyString => $visitor->nonEmpty($this, self::string),
self::nonNegativeInt => $visitor->intRange($this, 0, null),
self::nonPositiveInt => $visitor->intRange($this, null, 0),
self::null => $visitor->null($this),
self::numeric => $visitor->union($this, [self::int, self::float, self::numericString]),
self::numericString => $visitor->numericString($this),
self::object => $visitor->object($this),
self::positiveInt => $visitor->intRange($this, 1, null),
Expand Down

0 comments on commit 23746ca

Please sign in to comment.