mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 15:25:45 +01:00
23 lines
448 B
Markdown
23 lines
448 B
Markdown
# Nullable
|
|
|
|
- `Nullable(Validatable $rule)`
|
|
|
|
Validates the given input with a defined rule when input is not NULL.
|
|
|
|
```php
|
|
v::nullable(v::email())->validate(null); // true
|
|
v::nullable(v::email())->validate('example@example.com'); // true
|
|
v::nullable(v::email())->validate('not an email'); // false
|
|
```
|
|
|
|
## Changelog
|
|
|
|
Version | Description
|
|
--------|-------------
|
|
2.0.0 | Created
|
|
|
|
***
|
|
See also:
|
|
|
|
- [NullType](NullType.md)
|
|
- [Optional](Optional.md)
|