Skip to content

Latest commit

 

History

History
35 lines (22 loc) · 570 Bytes

Not.md

File metadata and controls

35 lines (22 loc) · 570 Bytes

Not

  • v::not(v $negatedValidator)

Negates any rule.

v::not(v::ip())->validate('foo'); //true

using a shortcut

v::ip()->not()->validate('foo'); //true

In the sample above, validator returns true because 'foo' isn't an IP Address.

You can negate complex, grouped or chained validators as well:

v::not(v::int()->positive())->validate(-1.5); //true

using a shortcut

v::int()->positive()->not()->validate(-1.5); //true

Each other validation has custom messages for negated rules.

See also: