From 2baace22d84163cb653b1b4ca4e5129572ca7934 Mon Sep 17 00:00:00 2001 From: Willem Wollebrants Date: Fri, 14 Feb 2020 09:44:44 +0100 Subject: [PATCH] correct documentation for integer strict mode, see #302 --- README.md | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index b96ca33..11c9311 100644 --- a/README.md +++ b/README.md @@ -440,24 +440,19 @@ $v->rules([ $v->validate(); ``` -*Note* the optional boolean flag for strict mode will allow for integers to be supplied as negative values. So the following rule would evaluate to true: +*Note* the optional boolean flag for strict mode makes sure integers are to be supplied in a strictly numeric form. So the following rule would evaluate to true: ```php -$v = new Valitron\Validator(['age' => '-27']); -$v->rules([ - 'integer' => [ - ['age', true] - ] -]); +$v = new Valitron\Validator(['negative' => '-27', 'positive'=>'27']); +$v->rule('integer', 'age', true); +$v->rule('integer', 'height', true); $v->validate(); ``` -Whereas the same for a positive (+) value would evaluate to false, as the + in this case is redundant: + +Whereas the following will evaluate to false, as the + for the positive number in this case is redundant: ```php -$v = new Valitron\Validator(['age' => '+27']); -$v->rules([ - 'integer' => [ - ['age', true] - ] -]); +$v = new Valitron\Validator(['negative' => '-27', 'positive'=>'+27']); +$v->rule('integer', 'age', true); +$v->rule('integer', 'height', true); $v->validate(); ```