@@ -15,7 +15,7 @@ The Hello World validator is something like this:
1515
1616``` php
1717$number = 123;
18- v::numericVal()->validate ($number); // true
18+ v::numericVal()->isValid ($number); // true
1919```
2020
2121## Chained validation
@@ -25,7 +25,7 @@ containing numbers and letters, no whitespace and length between 1 and 15.
2525
2626``` php
2727$usernameValidator = v::alnum()->noWhitespace()->length(1, 15);
28- $usernameValidator->validate ('alganet'); // true
28+ $usernameValidator->isValid ('alganet'); // true
2929```
3030
3131## Validating object properties
@@ -44,7 +44,7 @@ Is possible to validate its properties in a single chain:
4444$userValidator = v::property('name', v::stringType()->length(1, 32))
4545 ->property('birthdate', v::dateTimeDiff(v::greaterThanOrEqual(18), 'years'));
4646
47- $userValidator->validate ($user); // true
47+ $userValidator->isValid ($user); // true
4848```
4949
5050Validating array keys is also possible using ` v::key() `
@@ -93,11 +93,11 @@ For that reason all rules are mandatory now but if you want to treat a value as
9393optional you can use ` v::optional() ` rule:
9494
9595``` php
96- v::alpha()->validate (''); // false input required
97- v::alpha()->validate (null); // false input required
96+ v::alpha()->isValid (''); // false input required
97+ v::alpha()->isValid (null); // false input required
9898
99- v::optional(v::alpha())->validate (''); // true
100- v::optional(v::alpha())->validate (null); // true
99+ v::optional(v::alpha())->isValid (''); // true
100+ v::optional(v::alpha())->isValid (null); // true
101101```
102102
103103By _ optional_ we consider ` null ` or an empty string (` '' ` ).
@@ -109,17 +109,17 @@ See more on [Optional](rules/UndefOr.md).
109109You can use the ` v::not() ` to negate any rule:
110110
111111``` php
112- v::not(v::intVal())->validate (10); // false, input must not be integer
112+ v::not(v::intVal())->isValid (10); // false, input must not be integer
113113```
114114
115115## Validator reuse
116116
117117Once created, you can reuse your validator anywhere. Remember ` $usernameValidator ` ?
118118
119119``` php
120- $usernameValidator->validate ('respect'); //true
121- $usernameValidator->validate ('alexandre gaigalas'); // false
122- $usernameValidator->validate ('#$%'); //false
120+ $usernameValidator->isValid ('respect'); //true
121+ $usernameValidator->isValid ('alexandre gaigalas'); // false
122+ $usernameValidator->isValid ('#$%'); //false
123123```
124124
125125## Exception types
0 commit comments