respect-validation/docs/rules/Nullable.md

28 lines
478 B
Markdown
Raw Normal View History

2018-01-18 12:15:51 +01:00
# 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
```
## Categorization
- Nesting
2018-01-18 12:15:51 +01:00
## Changelog
Version | Description
--------|-------------
2.0.0 | Created
***
See also:
2018-12-11 13:31:50 +01:00
- [NullType](NullType.md)
- [Optional](Optional.md)