respect-validation/docs/Not.md

25 lines
422 B
Markdown
Raw Normal View History

2015-01-30 09:40:06 +01:00
# Not
- `Not(Validatable $rule)`
2015-01-30 09:40:06 +01:00
Negates any rule.
```php
v::not(v::ip())->validate('foo'); // true
2015-01-30 09:40:06 +01:00
```
In the sample above, validator returns true because 'foo' isn't an IP Address.
You can negate complex, grouped or chained validators as well:
```php
v::not(v::intVal()->positive())->validate(-1.5); // true
2015-01-30 09:40:06 +01:00
```
Each other validation has custom messages for negated rules.
***
2015-01-30 09:40:06 +01:00
See also:
* [NoneOf](NoneOf.md)