Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit fcb6470

Browse files
committed
chore: improved Type rule documentation
1 parent e69cf72 commit fcb6470

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

docs/03x-rules-type.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ Type(
1515
## Basic Usage
1616

1717
```php
18-
// Single data type
18+
// Single type
1919
Validator::type('string')->validate('green'); // true
2020
Validator::type('alphanumeric')->validate('gr33n'); // true
2121

22-
// Multiple data types
22+
// Multiple types
2323
// Validates if value is of at least one of the provided types
2424
Validator::type(['alpha', 'numeric'])->validate('green'); // true (alpha)
2525
Validator::type(['alpha', 'numeric'])->validate('33'); // true (numeric)
@@ -31,7 +31,7 @@ Validator::type(\DateTimeInterface::class)->validate(new \DateTime()); // true
3131
```
3232

3333
> **Note**
34-
> An `UnexpectedValueException` will be thrown when a constraint type, class and interface is invalid.
34+
> An `UnexpectedValueException` will be thrown when a constraint type, class or interface is invalid.
3535
3636
## Options
3737

@@ -45,7 +45,7 @@ Can validate instances of classes and interfaces.
4545
If an array with multiple types is provided, it will validate if the value is of at least one of the given types.
4646
For example, if `['alpha', 'numeric']` is provided, it will validate if the value is of type `alpha` or of type `numeric`.
4747

48-
Available constraint types:
48+
Available data type constraints:
4949

5050
- [`bool`](https://www.php.net/manual/en/function.is-bool.php), [`boolean`](https://www.php.net/manual/en/function.is-bool.php)
5151
- [`int`](https://www.php.net/manual/en/function.is-int.php), [`integer`](https://www.php.net/manual/en/function.is-int.php), [`long`](https://www.php.net/manual/en/function.is-int.php)
@@ -60,6 +60,9 @@ Available constraint types:
6060
- [`object`](https://www.php.net/manual/en/function.is-object.php)
6161
- [`resource`](https://www.php.net/manual/en/function.is-resource.php)
6262
- [`null`](https://www.php.net/manual/en/function.is-null.php)
63+
64+
Available character type constraints:
65+
6366
- [`alphanumeric`](https://www.php.net/manual/en/function.ctype-alnum)
6467
- [`alpha`](https://www.php.net/manual/en/function.ctype-alpha.php)
6568
- [`digit`](https://www.php.net/manual/en/function.ctype-digit.php)

0 commit comments

Comments
 (0)