diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e71b2d011..9a7f363dc 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -22,6 +22,7 @@ jobs: - "8.1" - "8.2" - "8.3" + - "8.4" steps: - name: Checkout diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a760063c4..a3b27141a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,61 +62,22 @@ declare(strict_types=1); namespace Respect\Validation\Rules; +use Respect\Validation\Rules\Core\Simple; + /** * Explain in one sentence what this rule does. * * @author Your Name */ -final class HelloWorld extends AbstractRule +final class HelloWorld extends Simple { - /** - * {@inheritDoc} - */ - public function validate($input): bool + public function isValid(mixed $input): bool { return $input === 'Hello World'; } } ``` -### Creating the rule exception - -Just that and we're done with the rule code. The Exception requires you to -declare messages used by `assert()` and `check()`. Messages are declared in -affirmative and negative moods, so if anyone calls `v::not(v::helloWorld())` the -library will show the appropriate message. - -```php - - * SPDX-License-Identifier: MIT - */ - -declare(strict_types=1); - -namespace Respect\Validation\Exceptions; - -/** - * @author Your Name - */ -final class HelloWorldException extends ValidationException -{ - /** - * {@inheritDoc} - */ - protected $defaultTemplates = [ - self::MODE_DEFAULT => [ - self::STANDARD => '{{name}} must be a Hello World', - ], - self::MODE_NEGATIVE => [ - self::STANDARD => '{{name}} must not be a Hello World', - ] - ]; -} -``` - ### Creating unit tests Finally, we need to test if everything is running smooth. We have `RuleTestCase` diff --git a/README.md b/README.md index e0a15ef77..57ae3fb37 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The most awesome validation engine ever created for PHP. -- Complex rules made simple: `v::numericVal()->positive()->between(1, 255)->validate($input)`. +- Complex rules made simple: `v::numericVal()->positive()->between(1, 255)->isValid($input)`. - [Granularity control](docs/02-feature-guide.md#validation-methods) for advanced reporting. - [More than 150](docs/08-list-of-rules-by-category.md) (fully tested) validation rules. - [A concrete API](docs/05-concrete-api.md) for non fluent usage. diff --git a/composer.json b/composer.json index a22c8339f..16d4b6eed 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ } }, "require": { - "php": "^8.1 || ^8.2", + "php": ">=8.1", "respect/stringifier": "^0.2.0", "symfony/polyfill-mbstring": "^1.2" }, diff --git a/docs/02-feature-guide.md b/docs/02-feature-guide.md index 7e0eadcdc..eab7cf59f 100644 --- a/docs/02-feature-guide.md +++ b/docs/02-feature-guide.md @@ -15,7 +15,7 @@ The Hello World validator is something like this: ```php $number = 123; -v::numericVal()->validate($number); // true +v::numericVal()->isValid($number); // true ``` ## Chained validation @@ -25,7 +25,7 @@ containing numbers and letters, no whitespace and length between 1 and 15. ```php $usernameValidator = v::alnum()->noWhitespace()->length(1, 15); -$usernameValidator->validate('alganet'); // true +$usernameValidator->isValid('alganet'); // true ``` ## Validating object attributes @@ -44,7 +44,7 @@ Is possible to validate its attributes in a single chain: $userValidator = v::attribute('name', v::stringType()->length(1, 32)) ->attribute('birthdate', v::date()->minAge(18)); -$userValidator->validate($user); // true +$userValidator->isValid($user); // true ``` Validating 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 optional you can use `v::optional()` rule: ```php -v::alpha()->validate(''); // false input required -v::alpha()->validate(null); // false input required +v::alpha()->isValid(''); // false input required +v::alpha()->isValid(null); // false input required -v::optional(v::alpha())->validate(''); // true -v::optional(v::alpha())->validate(null); // true +v::optional(v::alpha())->isValid(''); // true +v::optional(v::alpha())->isValid(null); // true ``` By _optional_ we consider `null` or an empty string (`''`). @@ -109,7 +109,7 @@ See more on [Optional](rules/Optional.md). You can use the `v::not()` to negate any rule: ```php -v::not(v::intVal())->validate(10); // false, input must not be integer +v::not(v::intVal())->isValid(10); // false, input must not be integer ``` ## Validator reuse @@ -117,9 +117,9 @@ v::not(v::intVal())->validate(10); // false, input must not be integer Once created, you can reuse your validator anywhere. Remember `$usernameValidator`? ```php -$usernameValidator->validate('respect'); //true -$usernameValidator->validate('alexandre gaigalas'); // false -$usernameValidator->validate('#$%'); //false +$usernameValidator->isValid('respect'); //true +$usernameValidator->isValid('alexandre gaigalas'); // false +$usernameValidator->isValid('#$%'); //false ``` ## Exception types diff --git a/docs/05-concrete-api.md b/docs/05-concrete-api.md index b372a9952..b7f71d05c 100644 --- a/docs/05-concrete-api.md +++ b/docs/05-concrete-api.md @@ -8,7 +8,7 @@ or magic methods. We'll use a traditional dependency injection approach. use Respect\Validation\Validator as v; $usernameValidator = v::alnum()->noWhitespace()->length(1, 15); -$usernameValidator->validate('alganet'); // true +$usernameValidator->isValid('alganet'); // true ``` If you `var_dump($usernameValidator)`, you'll see a composite of objects with @@ -18,13 +18,14 @@ the chain only builds the structure. You can build it by yourself: ```php use Respect\Validation\Rules; +use Respect\Validation\Validator; -$usernameValidator = new Rules\AllOf( +$usernameValidator = Validator::create( new Rules\Alnum(), new Rules\NoWhitespace(), new Rules\Length(1, 15) ); -$usernameValidator->validate('alganet'); // true +$usernameValidator->isValid('alganet'); // true ``` This is still a very lean API. You can use it in any dependency injection @@ -32,14 +33,16 @@ container or test it in the way you want. Nesting is still possible: ```php use Respect\Validation\Rules; +use Respect\Validation\Validator; -$usernameValidator = new Rules\AllOf( +$usernameValidator = Validator::create( new Rules\Alnum(), new Rules\NoWhitespace(), new Rules\Length(1, 15) ); -$userValidator = new Rules\Key('name', $usernameValidator); -$userValidator->validate(['name' => 'alganet']); // true + +$userValidator = Validator::create(new Rules\Key('name', $usernameValidator)); +$userValidator->isValid(['name' => 'alganet']); // true ``` ## How It Works? @@ -63,7 +66,7 @@ something complex and returns for you. > I really don't like static calls, can I avoid it? -Yes. Just use `$validator = new Validator();` each time you want a new validator, +Yes. Just use `$validator = Validator::create();` each time you want a new validator, and continue from there. > Do you have a static method for each rule? diff --git a/docs/06-custom-rules.md b/docs/06-custom-rules.md index bc0cbe507..696df9f9a 100644 --- a/docs/06-custom-rules.md +++ b/docs/06-custom-rules.md @@ -10,11 +10,11 @@ validate method will be executed. Here's how the class should look: ```php namespace My\Validation\Rules; -use Respect\Validation\Rules\AbstractRule; +use Respect\Validation\Rules\Core\Simple; -final class Something extends AbstractRule +final class Something extends Simple { - public function validate($input): bool + public function isValid(mixed $input): bool { // Do something here with the $input and return a boolean value } diff --git a/docs/07-comparable-values.md b/docs/07-comparable-values.md index 63ba4e138..b17ad23e1 100644 --- a/docs/07-comparable-values.md +++ b/docs/07-comparable-values.md @@ -16,15 +16,15 @@ that can be parsed by PHP Below you can see some examples: ```php -v::min(100)->validate($collection); // true if it has at least 100 items +v::min(100)->isValid($collection); // true if it has at least 100 items v::dateTime() ->between(new DateTime('yesterday'), new DateTime('tomorrow')) - ->validate(new DateTime('now')); // true + ->isValid(new DateTime('now')); // true -v::numericVal()->max(10)->validate(5); // true +v::numericVal()->max(10)->isValid(5); // true -v::stringVal()->between('a', 'f')->validate('d'); // true +v::stringVal()->between('a', 'f')->isValid('d'); // true -v::dateTime()->between('yesterday', 'tomorrow')->validate('now'); // true +v::dateTime()->between('yesterday', 'tomorrow')->isValid('now'); // true ``` \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 2d172b960..0a94f5bdb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,7 +2,7 @@ The most awesome validation engine ever created for PHP. -- Complex rules made simple: `v::numericVal()->positive()->between(1, 255)->validate($input)`. +- Complex rules made simple: `v::numericVal()->positive()->between(1, 255)->isValid($input)`. - [Granularity control](02-feature-guide.md#validation-methods) for advanced reporting. - [More than 150](08-list-of-rules-by-category.md) (fully tested) validation rules. - [A concrete API](05-concrete-api.md) for non fluent usage. diff --git a/docs/rules/AllOf.md b/docs/rules/AllOf.md index 3615d960d..a7fcce5d7 100644 --- a/docs/rules/AllOf.md +++ b/docs/rules/AllOf.md @@ -5,7 +5,7 @@ Will validate if all inner validators validates. ```php -v::allOf(v::intVal(), v::positive())->validate(15); // true +v::allOf(v::intVal(), v::positive())->isValid(15); // true ``` ## Categorization diff --git a/docs/rules/Alnum.md b/docs/rules/Alnum.md index 952ed695c..2ae54acf6 100644 --- a/docs/rules/Alnum.md +++ b/docs/rules/Alnum.md @@ -9,18 +9,18 @@ Alphanumeric is a combination of alphabetic (a-z and A-Z) and numeric (0-9) characters. ```php -v::alnum()->validate('foo 123'); // false -v::alnum(' ')->validate('foo 123'); // true -v::alnum()->validate('100%'); // false -v::alnum('%')->validate('100%'); // true -v::alnum('%', ',')->validate('10,5%'); // true +v::alnum()->isValid('foo 123'); // false +v::alnum(' ')->isValid('foo 123'); // true +v::alnum()->isValid('100%'); // false +v::alnum('%')->isValid('100%'); // true +v::alnum('%', ',')->isValid('10,5%'); // true ``` You can restrict case using the [Lowercase](Lowercase.md) and [Uppercase](Uppercase.md) rules. ```php -v::alnum()->uppercase()->validate('example'); // false +v::alnum()->uppercase()->isValid('example'); // false ``` Message template for this validator includes `{{additionalChars}}` as the string diff --git a/docs/rules/Alpha.md b/docs/rules/Alpha.md index 510b084b6..795279041 100644 --- a/docs/rules/Alpha.md +++ b/docs/rules/Alpha.md @@ -7,18 +7,18 @@ Validates whether the input contains only alphabetic characters. This is similar to [Alnum](Alnum.md), but it does not allow numbers. ```php -v::alpha()->validate('some name'); // false -v::alpha(' ')->validate('some name'); // true -v::alpha()->validate('Cedric-Fabian'); // false -v::alpha('-')->validate('Cedric-Fabian'); // true -v::alpha('-', '\'')->validate('\'s-Gravenhage'); // true +v::alpha()->isValid('some name'); // false +v::alpha(' ')->isValid('some name'); // true +v::alpha()->isValid('Cedric-Fabian'); // false +v::alpha('-')->isValid('Cedric-Fabian'); // true +v::alpha('-', '\'')->isValid('\'s-Gravenhage'); // true ``` You can restrict case using the [Lowercase](Lowercase.md) and [Uppercase](Uppercase.md) rules. ```php -v::alpha()->uppercase()->validate('example'); // false +v::alpha()->uppercase()->isValid('example'); // false ``` ## Categorization diff --git a/docs/rules/AlwaysInvalid.md b/docs/rules/AlwaysInvalid.md index f298d38ee..52e2ef2f4 100644 --- a/docs/rules/AlwaysInvalid.md +++ b/docs/rules/AlwaysInvalid.md @@ -5,7 +5,7 @@ Validates any input as invalid. ```php -v::alwaysInvalid()->validate('whatever'); // false +v::alwaysInvalid()->isValid('whatever'); // false ``` ## Categorization diff --git a/docs/rules/AlwaysValid.md b/docs/rules/AlwaysValid.md index c83d9f458..646afc51a 100644 --- a/docs/rules/AlwaysValid.md +++ b/docs/rules/AlwaysValid.md @@ -5,7 +5,7 @@ Validates any input as valid. ```php -v::alwaysValid()->validate('whatever'); // true +v::alwaysValid()->isValid('whatever'); // true ``` ## Categorization diff --git a/docs/rules/AnyOf.md b/docs/rules/AnyOf.md index ad19b97c2..a9ae48b5c 100644 --- a/docs/rules/AnyOf.md +++ b/docs/rules/AnyOf.md @@ -5,7 +5,7 @@ This is a group validator that acts as an OR operator. ```php -v::anyOf(v::intVal(), v::floatVal())->validate(15.5); // true +v::anyOf(v::intVal(), v::floatVal())->isValid(15.5); // true ``` In the sample above, `IntVal()` doesn't validates, but `FloatVal()` validates, diff --git a/docs/rules/ArrayType.md b/docs/rules/ArrayType.md index e25947d00..2c59af005 100644 --- a/docs/rules/ArrayType.md +++ b/docs/rules/ArrayType.md @@ -5,9 +5,9 @@ Validates whether the type of an input is array. ```php -v::arrayType()->validate([]); // true -v::arrayType()->validate([1, 2, 3]); // true -v::arrayType()->validate(new ArrayObject()); // false +v::arrayType()->isValid([]); // true +v::arrayType()->isValid([1, 2, 3]); // true +v::arrayType()->isValid(new ArrayObject()); // false ``` ## Categorization diff --git a/docs/rules/ArrayVal.md b/docs/rules/ArrayVal.md index 3b9db2ca0..cec67ed36 100644 --- a/docs/rules/ArrayVal.md +++ b/docs/rules/ArrayVal.md @@ -6,9 +6,9 @@ Validates if the input is an array or if the input can be used as an array (instance of `ArrayAccess` or `SimpleXMLElement`). ```php -v::arrayVal()->validate([]); // true -v::arrayVal()->validate(new ArrayObject); // true -v::arrayVal()->validate(new SimpleXMLElement('')); // true +v::arrayVal()->isValid([]); // true +v::arrayVal()->isValid(new ArrayObject); // true +v::arrayVal()->isValid(new SimpleXMLElement('')); // true ``` ## Categorization diff --git a/docs/rules/Attribute.md b/docs/rules/Attribute.md index acb8bfdf6..711262a33 100644 --- a/docs/rules/Attribute.md +++ b/docs/rules/Attribute.md @@ -10,19 +10,19 @@ Validates an object attribute, even private ones. $obj = new stdClass; $obj->foo = 'bar'; -v::attribute('foo')->validate($obj); // true +v::attribute('foo')->isValid($obj); // true ``` You can also validate the attribute itself: ```php -v::attribute('foo', v::equals('bar'))->validate($obj); // true +v::attribute('foo', v::equals('bar'))->isValid($obj); // true ``` Third parameter makes the attribute presence optional: ```php -v::attribute('lorem', v::stringType(), false)->validate($obj); // true +v::attribute('lorem', v::stringType(), false)->isValid($obj); // true ``` The name of this validator is automatically set to the attribute name. diff --git a/docs/rules/Base.md b/docs/rules/Base.md index 402ecf6af..c8065c68e 100644 --- a/docs/rules/Base.md +++ b/docs/rules/Base.md @@ -5,11 +5,11 @@ Validate numbers in any base, even with non regular bases. ```php -v::base(2)->validate('011010001'); // true -v::base(3)->validate('0120122001'); // true -v::base(8)->validate('01234567520'); // true -v::base(16)->validate('012a34f5675c20d'); // true -v::base(2)->validate('0120122001'); // false +v::base(2)->isValid('011010001'); // true +v::base(3)->isValid('0120122001'); // true +v::base(8)->isValid('01234567520'); // true +v::base(16)->isValid('012a34f5675c20d'); // true +v::base(2)->isValid('0120122001'); // false ``` ## Categorization diff --git a/docs/rules/Base64.md b/docs/rules/Base64.md index 7e4e5b34a..3b742a5d5 100644 --- a/docs/rules/Base64.md +++ b/docs/rules/Base64.md @@ -5,8 +5,8 @@ Validate if a string is Base64-encoded. ```php -v::base64()->validate('cmVzcGVjdCE='); // true -v::base64()->validate('respect!'); // false +v::base64()->isValid('cmVzcGVjdCE='); // true +v::base64()->isValid('respect!'); // false ``` ## Categorization diff --git a/docs/rules/Between.md b/docs/rules/Between.md index 3cf02b8df..fcb0675bb 100644 --- a/docs/rules/Between.md +++ b/docs/rules/Between.md @@ -5,9 +5,9 @@ Validates whether the input is between two other values. ```php -v::intVal()->between(10, 20)->validate(10); // true -v::intVal()->between(10, 20)->validate(15); // true -v::intVal()->between(10, 20)->validate(20); // true +v::intVal()->between(10, 20)->isValid(10); // true +v::intVal()->between(10, 20)->isValid(15); // true +v::intVal()->between(10, 20)->isValid(20); // true ``` Validation makes comparison easier, check out our supported diff --git a/docs/rules/BoolType.md b/docs/rules/BoolType.md index d5d90990e..70ccf5007 100644 --- a/docs/rules/BoolType.md +++ b/docs/rules/BoolType.md @@ -5,8 +5,8 @@ Validates whether the type of the input is [boolean](http://php.net/types.boolean). ```php -v::boolType()->validate(true); // true -v::boolType()->validate(false); // true +v::boolType()->isValid(true); // true +v::boolType()->isValid(false); // true ``` ## Categorization diff --git a/docs/rules/BoolVal.md b/docs/rules/BoolVal.md index 536ac1e31..792ee42d1 100644 --- a/docs/rules/BoolVal.md +++ b/docs/rules/BoolVal.md @@ -5,12 +5,12 @@ Validates if the input results in a boolean value: ```php -v::boolVal()->validate('on'); // true -v::boolVal()->validate('off'); // true -v::boolVal()->validate('yes'); // true -v::boolVal()->validate('no'); // true -v::boolVal()->validate(1); // true -v::boolVal()->validate(0); // true +v::boolVal()->isValid('on'); // true +v::boolVal()->isValid('off'); // true +v::boolVal()->isValid('yes'); // true +v::boolVal()->isValid('no'); // true +v::boolVal()->isValid(1); // true +v::boolVal()->isValid(0); // true ``` ## Categorization diff --git a/docs/rules/Bsn.md b/docs/rules/Bsn.md index 21822fbf0..5441a16a7 100644 --- a/docs/rules/Bsn.md +++ b/docs/rules/Bsn.md @@ -5,7 +5,7 @@ Validates a Dutch citizen service number ([BSN](https://nl.wikipedia.org/wiki/Burgerservicenummer)). ```php -v::bsn()->validate('612890053'); // true +v::bsn()->isValid('612890053'); // true ``` ## Categorization diff --git a/docs/rules/Call.md b/docs/rules/Call.md index 427fec3ce..cd0b1f1e6 100644 --- a/docs/rules/Call.md +++ b/docs/rules/Call.md @@ -37,7 +37,7 @@ v::call( ->key('host', v::domain()) ->key('path', v::stringType()) ->key('query', v::notEmpty()) -)->validate($url); +)->isValid($url); ``` ## Categorization diff --git a/docs/rules/CallableType.md b/docs/rules/CallableType.md index 851c618c0..11b31b093 100644 --- a/docs/rules/CallableType.md +++ b/docs/rules/CallableType.md @@ -5,9 +5,9 @@ Validates whether the pseudo-type of the input is [callable](http://php.net/types.callable). ```php -v::callableType()->validate(function () {}); // true -v::callableType()->validate('trim'); // true -v::callableType()->validate([new DateTime(), 'format']); // true +v::callableType()->isValid(function () {}); // true +v::callableType()->isValid('trim'); // true +v::callableType()->isValid([new DateTime(), 'format']); // true ``` ## Categorization diff --git a/docs/rules/Callback.md b/docs/rules/Callback.md index 620dd0877..d560edae1 100644 --- a/docs/rules/Callback.md +++ b/docs/rules/Callback.md @@ -9,7 +9,7 @@ v::callback( function (int $input): bool { return $input + ($input / 2) == 15; } -)->validate(10); // true +)->isValid(10); // true ``` ## Categorization diff --git a/docs/rules/Charset.md b/docs/rules/Charset.md index 2c89e9a18..89eb2e95d 100644 --- a/docs/rules/Charset.md +++ b/docs/rules/Charset.md @@ -5,9 +5,9 @@ Validates if a string is in a specific charset. ```php -v::charset('ASCII')->validate('açúcar'); // false -v::charset('ASCII')->validate('sugar'); //true -v::charset('ISO-8859-1', 'EUC-JP')->validate('日本国'); // true +v::charset('ASCII')->isValid('açúcar'); // false +v::charset('ASCII')->isValid('sugar'); //true +v::charset('ISO-8859-1', 'EUC-JP')->isValid('日本国'); // true ``` The array format is a logic OR, not AND. diff --git a/docs/rules/Cnh.md b/docs/rules/Cnh.md index 177143057..e052d335e 100644 --- a/docs/rules/Cnh.md +++ b/docs/rules/Cnh.md @@ -5,7 +5,7 @@ Validates a Brazilian driver's license. ```php -v::cnh()->validate('02650306461'); // true +v::cnh()->isValid('02650306461'); // true ``` ## Categorization diff --git a/docs/rules/Consonant.md b/docs/rules/Consonant.md index 70c230eca..6a3f17bac 100644 --- a/docs/rules/Consonant.md +++ b/docs/rules/Consonant.md @@ -6,7 +6,7 @@ Validates if the input contains only consonants. ```php -v::consonant()->validate('xkcd'); // true +v::consonant()->isValid('xkcd'); // true ``` ## Categorization diff --git a/docs/rules/Contains.md b/docs/rules/Contains.md index d975937ce..2707b95dd 100644 --- a/docs/rules/Contains.md +++ b/docs/rules/Contains.md @@ -8,13 +8,13 @@ Validates if the input contains some value. For strings: ```php -v::contains('ipsum')->validate('lorem ipsum'); // true +v::contains('ipsum')->isValid('lorem ipsum'); // true ``` For arrays: ```php -v::contains('ipsum')->validate(['ipsum', 'lorem']); // true +v::contains('ipsum')->isValid(['ipsum', 'lorem']); // true ``` A second parameter may be passed for identical comparison instead diff --git a/docs/rules/ContainsAny.md b/docs/rules/ContainsAny.md index e1ab89a8a..492b0ad27 100644 --- a/docs/rules/ContainsAny.md +++ b/docs/rules/ContainsAny.md @@ -8,13 +8,13 @@ Validates if the input contains at least one of defined values For strings (comparing is case insensitive): ```php -v::containsAny(['lorem', 'dolor'])->validate('lorem ipsum'); // true +v::containsAny(['lorem', 'dolor'])->isValid('lorem ipsum'); // true ``` For arrays (comparing is case sensitive to respect "contains" behavior): ```php -v::containsAny(['lorem', 'dolor'])->validate(['ipsum', 'lorem']); // true +v::containsAny(['lorem', 'dolor'])->isValid(['ipsum', 'lorem']); // true ``` A second parameter may be passed for identical comparison instead diff --git a/docs/rules/Control.md b/docs/rules/Control.md index 126fb8384..c4c75a117 100644 --- a/docs/rules/Control.md +++ b/docs/rules/Control.md @@ -7,7 +7,7 @@ Validates if all of the characters in the provided string, are control characters. ```php -v::control()->validate("\n\r\t"); // true +v::control()->isValid("\n\r\t"); // true ``` ## Categorization diff --git a/docs/rules/Countable.md b/docs/rules/Countable.md index 219d0e21a..51df68173 100644 --- a/docs/rules/Countable.md +++ b/docs/rules/Countable.md @@ -6,9 +6,9 @@ Validates if the input is countable, in other words, if you're allowed to use [count()](http://php.net/count) function on it. ```php -v::countable()->validate([]); // true -v::countable()->validate(new ArrayObject()); // true -v::countable()->validate('string'); // false +v::countable()->isValid([]); // true +v::countable()->isValid(new ArrayObject()); // true +v::countable()->isValid('string'); // false ``` ## Categorization diff --git a/docs/rules/CountryCode.md b/docs/rules/CountryCode.md index f4d7e04d6..55dd1a3ce 100644 --- a/docs/rules/CountryCode.md +++ b/docs/rules/CountryCode.md @@ -6,11 +6,11 @@ Validates whether the input is a country code in [ISO 3166-1][] standard. ```php -v::countryCode()->validate('BR'); // true +v::countryCode()->isValid('BR'); // true -v::countryCode('alpha-2')->validate('NL'); // true -v::countryCode('alpha-3')->validate('USA'); // true -v::countryCode('numeric')->validate('504'); // true +v::countryCode('alpha-2')->isValid('NL'); // true +v::countryCode('alpha-3')->isValid('USA'); // true +v::countryCode('numeric')->isValid('504'); // true ``` This rule supports the three sets of country codes: diff --git a/docs/rules/Cpf.md b/docs/rules/Cpf.md index dfeb81817..0fbbe53d5 100644 --- a/docs/rules/Cpf.md +++ b/docs/rules/Cpf.md @@ -5,20 +5,20 @@ Validates a Brazillian CPF number. ```php -v::cpf()->validate('11598647644'); // true +v::cpf()->isValid('11598647644'); // true ``` It ignores any non-digit char: ```php -v::cpf()->validate('693.319.118-40'); // true +v::cpf()->isValid('693.319.118-40'); // true ``` If you need to validate digits only, add `->digit()` to the chain: ```php -v::digit()->cpf()->validate('11598647644'); // true +v::digit()->cpf()->isValid('11598647644'); // true ``` ## Categorization diff --git a/docs/rules/CreditCard.md b/docs/rules/CreditCard.md index d7fde7f28..0fb2297ae 100644 --- a/docs/rules/CreditCard.md +++ b/docs/rules/CreditCard.md @@ -6,17 +6,17 @@ Validates a credit card number. ```php -v::creditCard()->validate('5376 7473 9720 8720'); // true -v::creditCard()->validate('5376-7473-9720-8720'); // true -v::creditCard()->validate('5376.7473.9720.8720'); // true - -v::creditCard('American_Express')->validate('340316193809364'); // true -v::creditCard('Diners_Club')->validate('30351042633884'); // true -v::creditCard('Discover')->validate('6011000990139424'); // true -v::creditCard('JCB')->validate('3566002020360505'); // true -v::creditCard('Mastercard')->validate('5376747397208720'); // true -v::creditCard('Visa')->validate('4024007153361885'); // true -v::creaditCard('RuPay')->validate('6062973831636410') // true +v::creditCard()->isValid('5376 7473 9720 8720'); // true +v::creditCard()->isValid('5376-7473-9720-8720'); // true +v::creditCard()->isValid('5376.7473.9720.8720'); // true + +v::creditCard('American_Express')->isValid('340316193809364'); // true +v::creditCard('Diners_Club')->isValid('30351042633884'); // true +v::creditCard('Discover')->isValid('6011000990139424'); // true +v::creditCard('JCB')->isValid('3566002020360505'); // true +v::creditCard('Mastercard')->isValid('5376747397208720'); // true +v::creditCard('Visa')->isValid('4024007153361885'); // true +v::creaditCard('RuPay')->isValid('6062973831636410') // true ``` The current supported brands are: @@ -33,7 +33,7 @@ It ignores any non-numeric characters, use [Digit](Digit.md), [NoWhitespace](NoWhitespace.md), or [Regex](Regex.md) when appropriate. ```php -v::digit()->creditCard()->validate('5376747397208720'); // true +v::digit()->creditCard()->isValid('5376747397208720'); // true ``` ## Categorization diff --git a/docs/rules/CurrencyCode.md b/docs/rules/CurrencyCode.md index 466ecc4c5..3ebbd057c 100644 --- a/docs/rules/CurrencyCode.md +++ b/docs/rules/CurrencyCode.md @@ -5,7 +5,7 @@ Validates an [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code like GBP or EUR. ```php -v::currencyCode()->validate('GBP'); // true +v::currencyCode()->isValid('GBP'); // true ``` ## Categorization diff --git a/docs/rules/Date.md b/docs/rules/Date.md index 15b723a52..1aa3b0c98 100644 --- a/docs/rules/Date.md +++ b/docs/rules/Date.md @@ -22,12 +22,12 @@ Format | Description When a `$format` is not given its default value is `Y-m-d`. ```php -v::date()->validate('2017-12-31'); // true -v::date()->validate('2020-02-29'); // true -v::date()->validate('2019-02-29'); // false -v::date('m/d/y')->validate('12/31/17'); // true -v::date('F jS, Y')->validate('May 1st, 2017'); // true -v::date('Ydm')->validate(20173112); // true +v::date()->isValid('2017-12-31'); // true +v::date()->isValid('2020-02-29'); // true +v::date()->isValid('2019-02-29'); // false +v::date('m/d/y')->isValid('12/31/17'); // true +v::date('F jS, Y')->isValid('May 1st, 2017'); // true +v::date('Ydm')->isValid(20173112); // true ``` ## Categorization diff --git a/docs/rules/DateTime.md b/docs/rules/DateTime.md index 3f69d9661..20f912abe 100644 --- a/docs/rules/DateTime.md +++ b/docs/rules/DateTime.md @@ -10,26 +10,26 @@ The `$format` argument should be in accordance to [DateTime::format()][]. See mo When a `$format` is not given its default value is `Y-m-d H:i:s`. ```php -v::dateTime()->validate('2009-01-01'); // true +v::dateTime()->isValid('2009-01-01'); // true ``` Also accepts [strtotime()](http://php.net/strtotime) values: ```php -v::dateTime()->validate('now'); // true +v::dateTime()->isValid('now'); // true ``` And `DateTimeInterface` instances: ```php -v::dateTime()->validate(new DateTime()); // true -v::dateTime()->validate(new DateTimeImmutable()); // true +v::dateTime()->isValid(new DateTime()); // true +v::dateTime()->isValid(new DateTimeImmutable()); // true ``` You can pass a format when validating strings: ```php -v::dateTime('Y-m-d')->validate('01-01-2009'); // false +v::dateTime('Y-m-d')->isValid('01-01-2009'); // false ``` Format has no effect when validating DateTime instances. @@ -50,9 +50,9 @@ you desire, and you may want to use [Callback](Callback.md) to create a custom v $input = '2014-04-12T23:20:50.052Z'; v::callback(fn($input) => is_string($input) && DateTime::createFromFormat(DateTime::RFC3339_EXTENDED, $input)) - ->validate($input); // true + ->isValid($input); // true -v::dateTime(DateTime::RFC3339_EXTENDED)->validate($input); // false +v::dateTime(DateTime::RFC3339_EXTENDED)->isValid($input); // false ``` ## Categorization diff --git a/docs/rules/Decimal.md b/docs/rules/Decimal.md index 0ae459e0c..47c9ad984 100644 --- a/docs/rules/Decimal.md +++ b/docs/rules/Decimal.md @@ -5,9 +5,9 @@ Validates whether the input matches the expected number of decimals. ```php -v::decimals(2)->validate('27990.50'); // true -v::decimals(1)->validate('27990.50'); // false -v::decimal(1)->validate(1.5); // true +v::decimals(2)->isValid('27990.50'); // true +v::decimals(1)->isValid('27990.50'); // false +v::decimal(1)->isValid(1.5); // true ``` @@ -17,7 +17,7 @@ When validating float types, it is not possible to determine the amount of ending zeros and because of that, validations like the ones below will pass. ```php -v::decimal(1)->validate(1.50); // true +v::decimal(1)->isValid(1.50); // true ``` ## Categorization diff --git a/docs/rules/Digit.md b/docs/rules/Digit.md index 9432432fd..ee9314ccb 100644 --- a/docs/rules/Digit.md +++ b/docs/rules/Digit.md @@ -6,10 +6,10 @@ Validates whether the input contains only digits. ```php -v::digit()->validate('020 612 1851'); // false -v::digit(' ')->validate('020 612 1851'); // true -v::digit()->validate('172.655.537-21'); // false -v::digit('.', '-')->validate('172.655.537-21'); // true +v::digit()->isValid('020 612 1851'); // false +v::digit(' ')->isValid('020 612 1851'); // true +v::digit()->isValid('172.655.537-21'); // false +v::digit('.', '-')->isValid('172.655.537-21'); // true ``` ## Categorization diff --git a/docs/rules/Directory.md b/docs/rules/Directory.md index afcc8d9bc..dd5226fb0 100644 --- a/docs/rules/Directory.md +++ b/docs/rules/Directory.md @@ -5,15 +5,15 @@ Validates if the given path is a directory. ```php -v::directory()->validate(__DIR__); // true -v::directory()->validate(__FILE__); // false +v::directory()->isValid(__DIR__); // true +v::directory()->isValid(__FILE__); // false ``` This validator will consider SplFileInfo instances, so you can do something like: ```php -v::directory()->validate(new SplFileInfo('library/')); -v::directory()->validate(dir('/')); +v::directory()->isValid(new SplFileInfo('library/')); +v::directory()->isValid(dir('/')); ``` ## Categorization diff --git a/docs/rules/Domain.md b/docs/rules/Domain.md index a22386b0b..9cf2d193d 100644 --- a/docs/rules/Domain.md +++ b/docs/rules/Domain.md @@ -6,14 +6,14 @@ Validates whether the input is a valid domain name or not. ```php -v::domain()->validate('google.com'); +v::domain()->isValid('google.com'); ``` You can skip *top level domain* (TLD) checks to validate internal domain names: ```php -v::domain(false)->validate('dev.machine.local'); +v::domain(false)->isValid('dev.machine.local'); ``` This is a composite validator, it validates several rules diff --git a/docs/rules/Each.md b/docs/rules/Each.md index bf1617010..65bc41069 100644 --- a/docs/rules/Each.md +++ b/docs/rules/Each.md @@ -11,13 +11,13 @@ $releaseDates = [ 'relational' => '2011-02-05', ]; -v::each(v::dateTime())->validate($releaseDates); // true +v::each(v::dateTime())->isValid($releaseDates); // true ``` You can also validate array keys combining this rule with [Call](Call.md): ```php -v::call('array_keys', v::each(v::stringType()))->validate($releaseDates); // true +v::call('array_keys', v::each(v::stringType()))->isValid($releaseDates); // true ``` This rule will not validate values that are not iterable, to have a more detailed @@ -27,8 +27,8 @@ If the input is empty this rule will consider the value as valid, you use [NotEmpty](NotEmpty.md) if convenient: ```php -v::each(v::dateTime())->validate([]); // true -v::notEmpty()->each(v::dateTime())->validate([]); // false +v::each(v::dateTime())->isValid([]); // true +v::notEmpty()->each(v::dateTime())->isValid([]); // false ``` ## Categorization diff --git a/docs/rules/Email.md b/docs/rules/Email.md index 6a742338a..564db1589 100644 --- a/docs/rules/Email.md +++ b/docs/rules/Email.md @@ -5,7 +5,7 @@ Validates an email address. ```php -v::email()->validate('alganet@gmail.com'); // true +v::email()->isValid('alganet@gmail.com'); // true ``` ## Categorization diff --git a/docs/rules/EndsWith.md b/docs/rules/EndsWith.md index f7b956680..01b167800 100644 --- a/docs/rules/EndsWith.md +++ b/docs/rules/EndsWith.md @@ -9,13 +9,13 @@ only if the value is at the end of the input. For strings: ```php -v::endsWith('ipsum')->validate('lorem ipsum'); // true +v::endsWith('ipsum')->isValid('lorem ipsum'); // true ``` For arrays: ```php -v::endsWith('ipsum')->validate(['lorem', 'ipsum']); // true +v::endsWith('ipsum')->isValid(['lorem', 'ipsum']); // true ``` A second parameter may be passed for identical comparison instead diff --git a/docs/rules/Equals.md b/docs/rules/Equals.md index 8b27d9477..10ffc46bc 100644 --- a/docs/rules/Equals.md +++ b/docs/rules/Equals.md @@ -5,7 +5,7 @@ Validates if the input is equal to some value. ```php -v::equals('alganet')->validate('alganet'); // true +v::equals('alganet')->isValid('alganet'); // true ``` Message template for this validator includes `{{compareTo}}`. diff --git a/docs/rules/Equivalent.md b/docs/rules/Equivalent.md index 86fa50fc5..eb99e15ee 100644 --- a/docs/rules/Equivalent.md +++ b/docs/rules/Equivalent.md @@ -5,9 +5,9 @@ Validates if the input is equivalent to some value. ```php -v::equivalent(1)->validate(true); // true -v::equivalent('Something')->validate('someThing'); // true -v::equivalent(new ArrayObject([1, 2, 3, 4, 5]))->validate(new ArrayObject([1, 2, 3, 4, 5])); // true +v::equivalent(1)->isValid(true); // true +v::equivalent('Something')->isValid('someThing'); // true +v::equivalent(new ArrayObject([1, 2, 3, 4, 5]))->isValid(new ArrayObject([1, 2, 3, 4, 5])); // true ``` This rule is very similar to [Equals](Equals.md) but it does not make case-sensitive diff --git a/docs/rules/Even.md b/docs/rules/Even.md index 572f2622c..b6d3d92dd 100644 --- a/docs/rules/Even.md +++ b/docs/rules/Even.md @@ -5,7 +5,7 @@ Validates whether the input is an even number or not. ```php -v::intVal()->even()->validate(2); // true +v::intVal()->even()->isValid(2); // true ``` Using `int()` before `even()` is a best practice. diff --git a/docs/rules/Executable.md b/docs/rules/Executable.md index 5fc6dedcd..7e2b3808d 100644 --- a/docs/rules/Executable.md +++ b/docs/rules/Executable.md @@ -5,7 +5,7 @@ Validates if a file is an executable. ```php -v::executable()->validate('script.sh'); // true +v::executable()->isValid('script.sh'); // true ``` ## Categorization diff --git a/docs/rules/Exists.md b/docs/rules/Exists.md index e45d65bd8..33c1562d3 100644 --- a/docs/rules/Exists.md +++ b/docs/rules/Exists.md @@ -5,14 +5,14 @@ Validates files or directories. ```php -v::exists()->validate(__FILE__); // true -v::exists()->validate(__DIR__); // true +v::exists()->isValid(__FILE__); // true +v::exists()->isValid(__DIR__); // true ``` This validator will consider SplFileInfo instances, so you can do something like: ```php -v::exists()->validate(new SplFileInfo('file.txt')); +v::exists()->isValid(new SplFileInfo('file.txt')); ``` ## Categorization diff --git a/docs/rules/Extension.md b/docs/rules/Extension.md index c51a9e324..c0e7d573c 100644 --- a/docs/rules/Extension.md +++ b/docs/rules/Extension.md @@ -5,7 +5,7 @@ Validates if the file extension matches the expected one: ```php -v::extension('png')->validate('image.png'); // true +v::extension('png')->isValid('image.png'); // true ``` This rule is case-sensitive. diff --git a/docs/rules/Factor.md b/docs/rules/Factor.md index 66ff9cb7d..510d7e4a2 100644 --- a/docs/rules/Factor.md +++ b/docs/rules/Factor.md @@ -5,9 +5,9 @@ Validates if the input is a factor of the defined dividend. ```php -v::factor(0)->validate(5); // true -v::factor(4)->validate(2); // true -v::factor(4)->validate(3); // false +v::factor(0)->isValid(5); // true +v::factor(4)->isValid(2); // true +v::factor(4)->isValid(3); // false ``` ## Categorization diff --git a/docs/rules/FalseVal.md b/docs/rules/FalseVal.md index 1862fc60d..5bbc522ed 100644 --- a/docs/rules/FalseVal.md +++ b/docs/rules/FalseVal.md @@ -5,14 +5,14 @@ Validates if a value is considered as `false`. ```php -v::falseVal()->validate(false); // true -v::falseVal()->validate(0); // true -v::falseVal()->validate('0'); // true -v::falseVal()->validate('false'); // true -v::falseVal()->validate('off'); // true -v::falseVal()->validate('no'); // true -v::falseVal()->validate('0.5'); // false -v::falseVal()->validate('2'); // false +v::falseVal()->isValid(false); // true +v::falseVal()->isValid(0); // true +v::falseVal()->isValid('0'); // true +v::falseVal()->isValid('false'); // true +v::falseVal()->isValid('off'); // true +v::falseVal()->isValid('no'); // true +v::falseVal()->isValid('0.5'); // false +v::falseVal()->isValid('2'); // false ``` ## Categorization diff --git a/docs/rules/Fibonacci.md b/docs/rules/Fibonacci.md index b98cd1783..2faf47295 100644 --- a/docs/rules/Fibonacci.md +++ b/docs/rules/Fibonacci.md @@ -5,9 +5,9 @@ Validates whether the input follows the Fibonacci integer sequence. ```php -v::fibonacci()->validate(1); // true -v::fibonacci()->validate('34'); // true -v::fibonacci()->validate(6); // false +v::fibonacci()->isValid(1); // true +v::fibonacci()->isValid('34'); // true +v::fibonacci()->isValid(6); // false ``` ## Categorization diff --git a/docs/rules/File.md b/docs/rules/File.md index 70bedf934..2bc74f42d 100644 --- a/docs/rules/File.md +++ b/docs/rules/File.md @@ -5,14 +5,14 @@ Validates whether file input is as a regular filename. ```php -v::file()->validate(__FILE__); // true -v::file()->validate(__DIR__); // false +v::file()->isValid(__FILE__); // true +v::file()->isValid(__DIR__); // false ``` This validator will consider SplFileInfo instances, so you can do something like: ```php -v::file()->validate(new SplFileInfo('file.txt')); +v::file()->isValid(new SplFileInfo('file.txt')); ``` ## Categorization diff --git a/docs/rules/FilterVar.md b/docs/rules/FilterVar.md index 1a6798f21..20e40d9b0 100644 --- a/docs/rules/FilterVar.md +++ b/docs/rules/FilterVar.md @@ -6,12 +6,12 @@ Validates the input with the PHP's [filter_var()](http://php.net/filter_var) function. ```php -v::filterVar(FILTER_VALIDATE_EMAIL)->validate('bob@example.com'); // true -v::filterVar(FILTER_VALIDATE_URL)->validate('http://example.com'); // true -v::filterVar(FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)->validate('http://example.com'); // false -v::filterVar(FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)->validate('http://example.com/path'); // true -v::filterVar(FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)->validate('webserver.local'); // true -v::filterVar(FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)->validate('@local'); // false +v::filterVar(FILTER_VALIDATE_EMAIL)->isValid('bob@example.com'); // true +v::filterVar(FILTER_VALIDATE_URL)->isValid('http://example.com'); // true +v::filterVar(FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)->isValid('http://example.com'); // false +v::filterVar(FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)->isValid('http://example.com/path'); // true +v::filterVar(FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)->isValid('webserver.local'); // true +v::filterVar(FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)->isValid('@local'); // false ``` ## Categorization @@ -22,7 +22,7 @@ v::filterVar(FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)->validate('@local'); Version | Description ---------|------------- - 2.3.0 | `v::filterVar(FILTER_VALIDATE_INT)->validate(0)` is no longer false + 2.3.0 | `v::filterVar(FILTER_VALIDATE_INT)->isValid(0)` is no longer false 2.0.15 | Allow validating domains 0.8.0 | Created diff --git a/docs/rules/Finite.md b/docs/rules/Finite.md index 5ac0844fd..a0d4051ac 100644 --- a/docs/rules/Finite.md +++ b/docs/rules/Finite.md @@ -5,8 +5,8 @@ Validates if the input is a finite number. ```php -v::finite()->validate('10'); // true -v::finite()->validate(10); // true +v::finite()->isValid('10'); // true +v::finite()->isValid(10); // true ``` ## Categorization diff --git a/docs/rules/FloatType.md b/docs/rules/FloatType.md index b54b919b7..a433ec1e5 100644 --- a/docs/rules/FloatType.md +++ b/docs/rules/FloatType.md @@ -5,9 +5,9 @@ Validates whether the type of the input is [float](http://php.net/types.float). ```php -v::floatType()->validate(1.5); // true -v::floatType()->validate('1.5'); // false -v::floatType()->validate(0e5); // true +v::floatType()->isValid(1.5); // true +v::floatType()->isValid('1.5'); // false +v::floatType()->isValid(0e5); // true ``` ## Categorization diff --git a/docs/rules/FloatVal.md b/docs/rules/FloatVal.md index 7ed9574f7..a55c2151b 100644 --- a/docs/rules/FloatVal.md +++ b/docs/rules/FloatVal.md @@ -5,8 +5,8 @@ Validate whether the input value is float. ```php -v::floatVal()->validate(1.5); // true -v::floatVal()->validate('1e5'); // true +v::floatVal()->isValid(1.5); // true +v::floatVal()->isValid('1e5'); // true ``` ## Categorization diff --git a/docs/rules/Graph.md b/docs/rules/Graph.md index 725dacb46..935974f6a 100644 --- a/docs/rules/Graph.md +++ b/docs/rules/Graph.md @@ -7,7 +7,7 @@ Validates if all characters in the input are printable and actually creates visible output (no white space). ```php -v::graph()->validate('LKM@#$%4;'); // true +v::graph()->isValid('LKM@#$%4;'); // true ``` ## Categorization diff --git a/docs/rules/GreaterThan.md b/docs/rules/GreaterThan.md index 132b3288b..53de91c41 100644 --- a/docs/rules/GreaterThan.md +++ b/docs/rules/GreaterThan.md @@ -5,8 +5,8 @@ Validates whether the input is greater than a value. ```php -v::greaterThan(10)->validate(11); // true -v::greaterThan(10)->validate(9); // false +v::greaterThan(10)->isValid(11); // true +v::greaterThan(10)->isValid(9); // false ``` Validation makes comparison easier, check out our supported diff --git a/docs/rules/HexRgbColor.md b/docs/rules/HexRgbColor.md index 3b989a223..5a1562fc2 100644 --- a/docs/rules/HexRgbColor.md +++ b/docs/rules/HexRgbColor.md @@ -5,10 +5,10 @@ Validates whether the input is a hex RGB color or not. ```php -v::hexRgbColor()->validate('#FFFAAA'); // true -v::hexRgbColor()->validate('#ff6600'); // true -v::hexRgbColor()->validate('123123'); // true -v::hexRgbColor()->validate('FCD'); // true +v::hexRgbColor()->isValid('#FFFAAA'); // true +v::hexRgbColor()->isValid('#ff6600'); // true +v::hexRgbColor()->isValid('123123'); // true +v::hexRgbColor()->isValid('FCD'); // true ``` ## Categorization diff --git a/docs/rules/Iban.md b/docs/rules/Iban.md index 4625a82ae..f592af340 100644 --- a/docs/rules/Iban.md +++ b/docs/rules/Iban.md @@ -6,12 +6,12 @@ Validates whether the input is a valid [IBAN][] (International Bank Account Number) or not. ```php -v::iban()->validate('SE35 5000 0000 0549 1000 0003'); // true -v::iban()->validate('ch9300762011623852957'); // true +v::iban()->isValid('SE35 5000 0000 0549 1000 0003'); // true +v::iban()->isValid('ch9300762011623852957'); // true -v::iban()->validate('ZZ32 5000 5880 7742'); // false -v::iban()->validate(123456789); // false -v::iban()->validate(''); // false +v::iban()->isValid('ZZ32 5000 5880 7742'); // false +v::iban()->isValid(123456789); // false +v::iban()->isValid(''); // false ``` ## Categorization diff --git a/docs/rules/Identical.md b/docs/rules/Identical.md index fe1817003..7c18ed972 100644 --- a/docs/rules/Identical.md +++ b/docs/rules/Identical.md @@ -5,8 +5,8 @@ Validates if the input is identical to some value. ```php -v::identical(42)->validate(42); // true -v::identical(42)->validate('42'); // false +v::identical(42)->isValid(42); // true +v::identical(42)->isValid('42'); // false ``` Message template for this validator includes `{{compareTo}}`. diff --git a/docs/rules/Image.md b/docs/rules/Image.md index 71cd37a33..c6f764336 100644 --- a/docs/rules/Image.md +++ b/docs/rules/Image.md @@ -6,9 +6,9 @@ Validates if the file is a valid image by checking its MIME type. ```php -v::image()->validate('image.gif'); // true -v::image()->validate('image.jpg'); // true -v::image()->validate('image.png'); // true +v::image()->isValid('image.gif'); // true +v::image()->isValid('image.jpg'); // true +v::image()->isValid('image.png'); // true ``` All the validations above must return `false` if the input is not a valid file diff --git a/docs/rules/Imei.md b/docs/rules/Imei.md index 0d92f03eb..988f6b163 100644 --- a/docs/rules/Imei.md +++ b/docs/rules/Imei.md @@ -5,8 +5,8 @@ Validates is the input is a valid [IMEI][]. ```php -v::imei()->validate('35-209900-176148-1'); // true -v::imei()->validate('490154203237518'); // true +v::imei()->isValid('35-209900-176148-1'); // true +v::imei()->isValid('490154203237518'); // true ``` ## Categorization diff --git a/docs/rules/In.md b/docs/rules/In.md index 1669dbcbf..8f18da76c 100644 --- a/docs/rules/In.md +++ b/docs/rules/In.md @@ -8,13 +8,13 @@ Validates if the input is contained in a specific haystack. For strings: ```php -v::in('lorem ipsum')->validate('ipsum'); // true +v::in('lorem ipsum')->isValid('ipsum'); // true ``` For arrays: ```php -v::in(['lorem', 'ipsum'])->validate('lorem'); // true +v::in(['lorem', 'ipsum'])->isValid('lorem'); // true ``` A second parameter may be passed for identical comparison instead diff --git a/docs/rules/Infinite.md b/docs/rules/Infinite.md index 6c956931a..30456dc02 100644 --- a/docs/rules/Infinite.md +++ b/docs/rules/Infinite.md @@ -5,7 +5,7 @@ Validates if the input is an infinite number. ```php -v::infinite()->validate(INF); // true +v::infinite()->isValid(INF); // true ``` ## Categorization diff --git a/docs/rules/Instance.md b/docs/rules/Instance.md index f963753c3..f7d23cde8 100644 --- a/docs/rules/Instance.md +++ b/docs/rules/Instance.md @@ -5,8 +5,8 @@ Validates if the input is an instance of the given class or interface. ```php -v::instance('DateTime')->validate(new DateTime); // true -v::instance('Traversable')->validate(new ArrayObject); // true +v::instance('DateTime')->isValid(new DateTime); // true +v::instance('Traversable')->isValid(new ArrayObject); // true ``` Message template for this validator includes `{{instanceName}}`. diff --git a/docs/rules/IntType.md b/docs/rules/IntType.md index 87069a796..3b1c3a48e 100644 --- a/docs/rules/IntType.md +++ b/docs/rules/IntType.md @@ -5,8 +5,8 @@ Validates whether the type of the input is [integer](http://php.net/types.integer). ```php -v::intType()->validate(42); // true -v::intType()->validate('10'); // false +v::intType()->isValid(42); // true +v::intType()->isValid('10'); // false ``` ## Categorization diff --git a/docs/rules/IntVal.md b/docs/rules/IntVal.md index 70ae3372a..e7ce83e86 100644 --- a/docs/rules/IntVal.md +++ b/docs/rules/IntVal.md @@ -5,11 +5,11 @@ Validates if the input is an integer, allowing leading zeros and other number bases. ```php -v::intVal()->validate('10'); // true -v::intVal()->validate('089'); // true -v::intVal()->validate(10); // true -v::intVal()->validate(0b101010); // true -v::intVal()->validate(0x2a); // true +v::intVal()->isValid('10'); // true +v::intVal()->isValid('089'); // true +v::intVal()->isValid(10); // true +v::intVal()->isValid(0b101010); // true +v::intVal()->isValid(0x2a); // true ``` This rule will consider as valid any input that PHP can convert to an integer, @@ -17,8 +17,8 @@ but that does not contain non-integer values. That way, one can safely use the value this rule validates, without having surprises. ```php -v::intVal()->validate(true); // false -v::intVal()->validate('89a'); // false +v::intVal()->isValid(true); // false +v::intVal()->isValid('89a'); // false ``` Even though PHP can cast the values above as integers, this rule will not diff --git a/docs/rules/Ip.md b/docs/rules/Ip.md index 94620d9c9..169284ed5 100644 --- a/docs/rules/Ip.md +++ b/docs/rules/Ip.md @@ -9,28 +9,28 @@ Validates whether the input is a valid IP address. This validator uses the native [filter_var()][] PHP function. ```php -v::ip()->validate('127.0.0.1'); // true -v::ip('220.78.168.0/21')->validate('220.78.173.2'); // true -v::ip('220.78.168.0/21')->validate('220.78.176.2'); // false +v::ip()->isValid('127.0.0.1'); // true +v::ip('220.78.168.0/21')->isValid('220.78.173.2'); // true +v::ip('220.78.168.0/21')->isValid('220.78.176.2'); // false ``` Validating ranges: ```php -v::ip('127.0.0.1-127.0.0.5')->validate('127.0.0.2'); // true -v::ip('127.0.0.1-127.0.0.5')->validate('127.0.0.10'); // false +v::ip('127.0.0.1-127.0.0.5')->isValid('127.0.0.2'); // true +v::ip('127.0.0.1-127.0.0.5')->isValid('127.0.0.10'); // false ``` You can pass a parameter with [filter_var()][] flags for IP. ```php -v::ip('*', FILTER_FLAG_NO_PRIV_RANGE)->validate('192.168.0.1'); // false +v::ip('*', FILTER_FLAG_NO_PRIV_RANGE)->isValid('192.168.0.1'); // false ``` If you want to validate IPv6 you can do as follow: ```php -v::ip('*', FILTER_FLAG_IPV6)->validate('2001:0db8:85a3:08d3:1319:8a2e:0370:7334'); // true +v::ip('*', FILTER_FLAG_IPV6)->isValid('2001:0db8:85a3:08d3:1319:8a2e:0370:7334'); // true ``` ## Categorization diff --git a/docs/rules/Isbn.md b/docs/rules/Isbn.md index 4501ea8b4..12e8cecff 100644 --- a/docs/rules/Isbn.md +++ b/docs/rules/Isbn.md @@ -5,10 +5,10 @@ Validates whether the input is a valid [ISBN][] or not. ```php -v::isbn()->validate('ISBN-13: 978-0-596-52068-7'); // true -v::isbn()->validate('978 0 596 52068 7'); // true -v::isbn()->validate('ISBN-12: 978-0-596-52068-7'); // false -v::isbn()->validate('978 10 596 52068 7'); // false +v::isbn()->isValid('ISBN-13: 978-0-596-52068-7'); // true +v::isbn()->isValid('978 0 596 52068 7'); // true +v::isbn()->isValid('ISBN-12: 978-0-596-52068-7'); // false +v::isbn()->isValid('978 10 596 52068 7'); // false ``` ## Categorization diff --git a/docs/rules/IterableType.md b/docs/rules/IterableType.md index 0123ea7bf..5a57f9b85 100644 --- a/docs/rules/IterableType.md +++ b/docs/rules/IterableType.md @@ -7,10 +7,10 @@ if you're able to iterate over it with [foreach](http://php.net/foreach) languag construct. ```php -v::iterableType()->validate([]); // true -v::iterableType()->validate(new ArrayObject()); // true -v::iterableType()->validate(new stdClass()); // true -v::iterableType()->validate('string'); // false +v::iterableType()->isValid([]); // true +v::iterableType()->isValid(new ArrayObject()); // true +v::iterableType()->isValid(new stdClass()); // true +v::iterableType()->isValid('string'); // false ``` ## Categorization diff --git a/docs/rules/Json.md b/docs/rules/Json.md index e9007d999..e9c1cf5e1 100644 --- a/docs/rules/Json.md +++ b/docs/rules/Json.md @@ -5,7 +5,7 @@ Validates if the given input is a valid JSON. ```php -v::json()->validate('{"foo":"bar"}'); // true +v::json()->isValid('{"foo":"bar"}'); // true ``` ## Categorization diff --git a/docs/rules/Key.md b/docs/rules/Key.md index 3213910df..80055e6a8 100644 --- a/docs/rules/Key.md +++ b/docs/rules/Key.md @@ -11,19 +11,19 @@ $dict = [ 'foo' => 'bar' ]; -v::key('foo')->validate($dict); // true +v::key('foo')->isValid($dict); // true ``` You can also validate the key value itself: ```php -v::key('foo', v::equals('bar'))->validate($dict); // true +v::key('foo', v::equals('bar'))->isValid($dict); // true ``` Third parameter makes the key presence optional: ```php -v::key('lorem', v::stringType(), false)->validate($dict); // true +v::key('lorem', v::stringType(), false)->isValid($dict); // true ``` The name of this validator is automatically set to the key name. diff --git a/docs/rules/KeyNested.md b/docs/rules/KeyNested.md index 803127427..48948a67e 100644 --- a/docs/rules/KeyNested.md +++ b/docs/rules/KeyNested.md @@ -15,7 +15,7 @@ $array = [ ], ]; -v::keyNested('foo.bar')->validate($array); // true +v::keyNested('foo.bar')->isValid($array); // true ``` Validating object properties: @@ -25,7 +25,7 @@ $object = new stdClass(); $object->foo = new stdClass(); $object->foo->bar = 42; -v::keyNested('foo.bar')->validate($object); // true +v::keyNested('foo.bar')->isValid($object); // true ``` This rule was inspired by [Yii2 ArrayHelper][]. diff --git a/docs/rules/KeySet.md b/docs/rules/KeySet.md index ba2f7e0d4..cd3a2c8cc 100644 --- a/docs/rules/KeySet.md +++ b/docs/rules/KeySet.md @@ -9,7 +9,7 @@ $dict = ['foo' => 42]; v::keySet( v::key('foo', v::intVal()) -)->validate($dict); // true +)->isValid($dict); // true ``` Extra keys are not allowed: @@ -18,7 +18,7 @@ $dict = ['foo' => 42, 'bar' => 'String']; v::keySet( v::key('foo', v::intVal()) -)->validate($dict); // false +)->isValid($dict); // false ``` Missing required keys are not allowed: @@ -29,7 +29,7 @@ v::keySet( v::key('foo', v::intVal()), v::key('bar', v::stringType()), v::key('baz', v::boolType()) -)->validate($dict); // false +)->isValid($dict); // false ``` Missing non-required keys are allowed: @@ -40,7 +40,7 @@ v::keySet( v::key('foo', v::intVal()), v::key('bar', v::stringType()), v::key('baz', v::boolType(), false) -)->validate($dict); // true +)->isValid($dict); // true ``` It is not possible to negate `keySet()` rules with `not()`. diff --git a/docs/rules/KeyValue.md b/docs/rules/KeyValue.md index c2211f334..00709e306 100644 --- a/docs/rules/KeyValue.md +++ b/docs/rules/KeyValue.md @@ -10,8 +10,8 @@ another key value and that may cause some ugly code since you need the input before the validation, making some checking manually: ```php -v::key('password', v::notEmpty())->validate($_POST); -v::key('password_confirmation', v::equals($_POST['password'] ?? null))->validate($_POST); +v::key('password', v::notEmpty())->isValid($_POST); +v::key('password_confirmation', v::equals($_POST['password'] ?? null))->isValid($_POST); ``` The problem with the above code is because you do not know if `password` is a @@ -22,7 +22,7 @@ The `keyValue()` rule makes this job easier by creating a rule named on `$ruleName` passing `$baseKey` as the first argument of this rule, see an example: ```php -v::keyValue('password_confirmation', 'equals', 'password')->validate($_POST); +v::keyValue('password_confirmation', 'equals', 'password')->isValid($_POST); ``` The above code will result on `true` if _`$_POST['password_confirmation']` is @@ -31,7 +31,7 @@ The above code will result on `true` if _`$_POST['password_confirmation']` is See another example: ```php -v::keyValue('state', 'subdivisionCode', 'country')->validate($_POST); +v::keyValue('state', 'subdivisionCode', 'country')->isValid($_POST); ``` The above code will result on `true` if _`$_POST['state']` is a diff --git a/docs/rules/LanguageCode.md b/docs/rules/LanguageCode.md index 557a52c13..6a598cb96 100644 --- a/docs/rules/LanguageCode.md +++ b/docs/rules/LanguageCode.md @@ -6,11 +6,11 @@ Validates whether the input is language code based on ISO 639. ```php -v::languageCode()->validate('pt'); // true -v::languageCode()->validate('en'); // true -v::languageCode()->validate('it'); // true -v::languageCode('alpha-3')->validate('ita'); // true -v::languageCode('alpha-3')->validate('eng'); // true +v::languageCode()->isValid('pt'); // true +v::languageCode()->isValid('en'); // true +v::languageCode()->isValid('it'); // true +v::languageCode('alpha-3')->isValid('ita'); // true +v::languageCode('alpha-3')->isValid('eng'); // true ``` You can choose between `alpha-2` and `alpha-3`; `alpha-2` is set by default set. diff --git a/docs/rules/LeapDate.md b/docs/rules/LeapDate.md index c2096facb..963c29e7a 100644 --- a/docs/rules/LeapDate.md +++ b/docs/rules/LeapDate.md @@ -5,7 +5,7 @@ Validates if a date is leap. ```php -v::leapDate('Y-m-d')->validate('1988-02-29'); // true +v::leapDate('Y-m-d')->isValid('1988-02-29'); // true ``` This validator accepts DateTime instances as well. The $format diff --git a/docs/rules/LeapYear.md b/docs/rules/LeapYear.md index 6e281b728..cb1db24fb 100644 --- a/docs/rules/LeapYear.md +++ b/docs/rules/LeapYear.md @@ -5,7 +5,7 @@ Validates if a year is leap. ```php -v::leapYear()->validate('1988'); // true +v::leapYear()->isValid('1988'); // true ``` This validator accepts DateTime instances as well. diff --git a/docs/rules/Length.md b/docs/rules/Length.md index fca3f78b0..408095174 100644 --- a/docs/rules/Length.md +++ b/docs/rules/Length.md @@ -10,32 +10,32 @@ Validates the length of the given input. Most simple example: ```php -v::stringType()->length(1, 5)->validate('abc'); // true +v::stringType()->length(1, 5)->isValid('abc'); // true ``` You can also validate only minimum length: ```php -v::stringType()->length(5, null)->validate('abcdef'); // true +v::stringType()->length(5, null)->isValid('abcdef'); // true ``` Only maximum length: ```php -v::stringType()->length(null, 5)->validate('abc'); // true +v::stringType()->length(null, 5)->isValid('abc'); // true ``` The type as the first validator in a chain is a good practice, since length accepts many types: ```php -v::arrayVal()->length(1, 5)->validate(['foo', 'bar']); // true +v::arrayVal()->length(1, 5)->isValid(['foo', 'bar']); // true ``` A third parameter may be passed to validate the passed values inclusive: ```php -v::stringType()->length(1, 5, true)->validate('a'); // true +v::stringType()->length(1, 5, true)->isValid('a'); // true ``` Message template for this validator includes `{{minValue}}` and `{{maxValue}}`. diff --git a/docs/rules/LessThan.md b/docs/rules/LessThan.md index 3646b71ff..6ae4fda0e 100644 --- a/docs/rules/LessThan.md +++ b/docs/rules/LessThan.md @@ -5,8 +5,8 @@ Validates whether the input is less than a value. ```php -v::lessThan(10)->validate(9); // true -v::lessThan(10)->validate(10); // false +v::lessThan(10)->isValid(9); // true +v::lessThan(10)->isValid(10); // false ``` Validation makes comparison easier, check out our supported diff --git a/docs/rules/Lowercase.md b/docs/rules/Lowercase.md index 7d7e2370e..987764ef6 100644 --- a/docs/rules/Lowercase.md +++ b/docs/rules/Lowercase.md @@ -5,7 +5,7 @@ Validates whether the characters in the input are lowercase. ```php -v::stringType()->lowercase()->validate('xkcd'); // true +v::stringType()->lowercase()->isValid('xkcd'); // true ``` ## Categorization diff --git a/docs/rules/Luhn.md b/docs/rules/Luhn.md index e3603de7c..4f955a779 100644 --- a/docs/rules/Luhn.md +++ b/docs/rules/Luhn.md @@ -5,8 +5,8 @@ Validate whether a given input is a [Luhn][] number. ```php -v::luhn()->validate('2222400041240011'); // true -v::luhn()->validate('respect!'); // false +v::luhn()->isValid('2222400041240011'); // true +v::luhn()->isValid('respect!'); // false ``` ## Categorization diff --git a/docs/rules/MacAddress.md b/docs/rules/MacAddress.md index 26775b2e0..fa986e4c7 100644 --- a/docs/rules/MacAddress.md +++ b/docs/rules/MacAddress.md @@ -5,8 +5,8 @@ Validates whether the input is a valid MAC address. ```php -v::macAddress()->validate('00:11:22:33:44:55'); // true -v::macAddress()->validate('af-AA-22-33-44-55'); // true +v::macAddress()->isValid('00:11:22:33:44:55'); // true +v::macAddress()->isValid('af-AA-22-33-44-55'); // true ``` ## Categorization diff --git a/docs/rules/Max.md b/docs/rules/Max.md index 11550c3f9..79b71011b 100644 --- a/docs/rules/Max.md +++ b/docs/rules/Max.md @@ -5,9 +5,9 @@ Validates whether the input is less than or equal to a value. ```php -v::max(10)->validate(9); // true -v::max(10)->validate(10); // true -v::max(10)->validate(11); // false +v::max(10)->isValid(9); // true +v::max(10)->isValid(10); // true +v::max(10)->isValid(11); // false ``` Validation makes comparison easier, check out our supported diff --git a/docs/rules/MaxAge.md b/docs/rules/MaxAge.md index 5957a91e7..14184e9e2 100644 --- a/docs/rules/MaxAge.md +++ b/docs/rules/MaxAge.md @@ -8,11 +8,11 @@ accordance to PHP's [date()][] function. When `$format` is not given this rule accepts [Supported Date and Time Formats][] by PHP (see [strtotime()][]). ```php -v::maxAge(12)->validate('12 years ago'); // true -v::maxAge(12, 'Y-m-d')->validate('2013-07-31'); // true +v::maxAge(12)->isValid('12 years ago'); // true +v::maxAge(12, 'Y-m-d')->isValid('2013-07-31'); // true -v::maxAge(12)->validate('13 years ago'); // false -v::maxAge(18, 'Y-m-d')->validate('1988-09-09'); // false +v::maxAge(12)->isValid('13 years ago'); // false +v::maxAge(18, 'Y-m-d')->isValid('1988-09-09'); // false ``` Using [Date](Date.md) before is a best-practice. diff --git a/docs/rules/Mimetype.md b/docs/rules/Mimetype.md index bc9911c80..041048636 100644 --- a/docs/rules/Mimetype.md +++ b/docs/rules/Mimetype.md @@ -5,8 +5,8 @@ Validates if the input is a file and if its MIME type matches the expected one. ```php -v::mimetype('image/png')->validate('image.png'); // true -v::mimetype('image/jpeg')->validate('image.jpg'); // true +v::mimetype('image/png')->isValid('image.png'); // true +v::mimetype('image/jpeg')->isValid('image.jpg'); // true ``` This rule is case-sensitive and requires [fileinfo](http://php.net/fileinfo) PHP extension. diff --git a/docs/rules/Min.md b/docs/rules/Min.md index feab67a99..a1f46a8f8 100644 --- a/docs/rules/Min.md +++ b/docs/rules/Min.md @@ -5,9 +5,9 @@ Validates whether the input is greater than or equal to a value. ```php -v::intVal()->min(10)->validate(9); // false -v::intVal()->min(10)->validate(10); // true -v::intVal()->min(10)->validate(11); // true +v::intVal()->min(10)->isValid(9); // false +v::intVal()->min(10)->isValid(10); // true +v::intVal()->min(10)->isValid(11); // true ``` Validation makes comparison easier, check out our supported diff --git a/docs/rules/MinAge.md b/docs/rules/MinAge.md index 25f3d3773..ce78700ac 100644 --- a/docs/rules/MinAge.md +++ b/docs/rules/MinAge.md @@ -8,11 +8,11 @@ accordance to PHP's [date()][] function. When `$format` is not given this rule accepts [Supported Date and Time Formats][] by PHP (see [strtotime()][]). ```php -v::minAge(18)->validate('18 years ago'); // true -v::minAge(18, 'Y-m-d')->validate('1987-01-01'); // true +v::minAge(18)->isValid('18 years ago'); // true +v::minAge(18, 'Y-m-d')->isValid('1987-01-01'); // true -v::minAge(18)->validate('17 years ago'); // false -v::minAge(18, 'Y-m-d')->validate('2010-09-07'); // false +v::minAge(18)->isValid('17 years ago'); // false +v::minAge(18, 'Y-m-d')->isValid('2010-09-07'); // false ``` Using [Date](Date.md) before is a best-practice. diff --git a/docs/rules/Multiple.md b/docs/rules/Multiple.md index 1b45d8944..0a8c7f63f 100644 --- a/docs/rules/Multiple.md +++ b/docs/rules/Multiple.md @@ -5,7 +5,7 @@ Validates if the input is a multiple of the given parameter ```php -v::intVal()->multiple(3)->validate(9); // true +v::intVal()->multiple(3)->isValid(9); // true ``` ## Categorization diff --git a/docs/rules/Negative.md b/docs/rules/Negative.md index d903ed095..293a50921 100644 --- a/docs/rules/Negative.md +++ b/docs/rules/Negative.md @@ -5,7 +5,7 @@ Validates whether the input is a negative number. ```php -v::numericVal()->negative()->validate(-15); // true +v::numericVal()->negative()->isValid(-15); // true ``` ## Categorization diff --git a/docs/rules/NfeAccessKey.md b/docs/rules/NfeAccessKey.md index b5e2e374f..19ee18203 100644 --- a/docs/rules/NfeAccessKey.md +++ b/docs/rules/NfeAccessKey.md @@ -5,7 +5,7 @@ Validates the access key of the Brazilian electronic invoice (NFe). ```php -v::nfeAccessKey()->validate('31841136830118868211870485416765268625116906'); // true +v::nfeAccessKey()->isValid('31841136830118868211870485416765268625116906'); // true ``` ## Categorization diff --git a/docs/rules/Nif.md b/docs/rules/Nif.md index 408391317..207a5edba 100644 --- a/docs/rules/Nif.md +++ b/docs/rules/Nif.md @@ -5,8 +5,8 @@ Validates Spain's fiscal identification number ([NIF](https://es.wikipedia.org/wiki/N%C3%BAmero_de_identificaci%C3%B3n_fiscal)). ```php -v::nif()->validate('49294492H'); // true -v::nif()->validate('P6437358A'); // false +v::nif()->isValid('49294492H'); // true +v::nif()->isValid('P6437358A'); // false ``` ## Categorization diff --git a/docs/rules/Nip.md b/docs/rules/Nip.md index a902ab169..0edd20586 100644 --- a/docs/rules/Nip.md +++ b/docs/rules/Nip.md @@ -5,11 +5,11 @@ Validates whether the input is a Polish VAT identification number (NIP). ```php -v::nip()->validate('1645865777'); // true -v::nip()->validate('1645865778'); // false -v::nip()->validate('1234567890'); // false -v::nip()->validate('164-586-57-77'); // false -v::nip()->validate('164-58-65-777'); // false +v::nip()->isValid('1645865777'); // true +v::nip()->isValid('1645865778'); // false +v::nip()->isValid('1234567890'); // false +v::nip()->isValid('164-586-57-77'); // false +v::nip()->isValid('164-58-65-777'); // false ``` ## Categorization diff --git a/docs/rules/No.md b/docs/rules/No.md index aba24970c..c1c92b238 100644 --- a/docs/rules/No.md +++ b/docs/rules/No.md @@ -6,12 +6,12 @@ Validates if value is considered as "No". ```php -v::no()->validate('N'); // true -v::no()->validate('Nay'); // true -v::no()->validate('Nix'); // true -v::no()->validate('No'); // true -v::no()->validate('Nope'); // true -v::no()->validate('Not'); // true +v::no()->isValid('N'); // true +v::no()->isValid('Nay'); // true +v::no()->isValid('Nix'); // true +v::no()->isValid('No'); // true +v::no()->isValid('Nope'); // true +v::no()->isValid('Not'); // true ``` This rule is case insensitive. @@ -21,13 +21,13 @@ constant, meaning that it will validate the input using your current location: ```php setlocale(LC_ALL, 'ru_RU'); -v::no(true)->validate('нет'); // true +v::no(true)->isValid('нет'); // true ``` Be careful when using `$locale` as `TRUE` because the it's very permissive: ```php -v::no(true)->validate('Never gonna give you up 🎵'); // true +v::no(true)->isValid('Never gonna give you up 🎵'); // true ``` Besides that, with `$locale` as `TRUE` it will consider any character starting @@ -35,7 +35,7 @@ with "N" as valid: ```php setlocale(LC_ALL, 'es_ES'); -v::no(true)->validate('Yes'); // true +v::no(true)->isValid('Yes'); // true ``` ## Categorization diff --git a/docs/rules/NoWhitespace.md b/docs/rules/NoWhitespace.md index 3de02e09a..236722510 100644 --- a/docs/rules/NoWhitespace.md +++ b/docs/rules/NoWhitespace.md @@ -5,8 +5,8 @@ Validates if a string contains no whitespace (spaces, tabs and line breaks); ```php -v::noWhitespace()->validate('foo bar'); //false -v::noWhitespace()->validate("foo\nbar"); // false +v::noWhitespace()->isValid('foo bar'); //false +v::noWhitespace()->isValid("foo\nbar"); // false ``` This is most useful when chaining with other validators such as `Alnum()` diff --git a/docs/rules/NoneOf.md b/docs/rules/NoneOf.md index 59a62e7ba..8ef732c86 100644 --- a/docs/rules/NoneOf.md +++ b/docs/rules/NoneOf.md @@ -8,7 +8,7 @@ Validates if NONE of the given validators validate: v::noneOf( v::intVal(), v::floatVal() -)->validate('foo'); // true +)->isValid('foo'); // true ``` In the sample above, 'foo' isn't a integer nor a float, so noneOf returns true. diff --git a/docs/rules/Not.md b/docs/rules/Not.md index 332c3a765..b46dd501b 100644 --- a/docs/rules/Not.md +++ b/docs/rules/Not.md @@ -5,7 +5,7 @@ Negates any rule. ```php -v::not(v::ip())->validate('foo'); // true +v::not(v::ip())->isValid('foo'); // true ``` In the sample above, validator returns true because 'foo' isn't an IP Address. @@ -13,7 +13,7 @@ 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 +v::not(v::intVal()->positive())->isValid(-1.5); // true ``` Each other validation has custom messages for negated rules. diff --git a/docs/rules/NotBlank.md b/docs/rules/NotBlank.md index 6141e6882..01b5d5e31 100644 --- a/docs/rules/NotBlank.md +++ b/docs/rules/NotBlank.md @@ -6,22 +6,22 @@ Validates if the given input is not a blank value (`null`, zeros, empty strings or empty arrays, recursively). ```php -v::notBlank()->validate(null); // false -v::notBlank()->validate(''); // false -v::notBlank()->validate([]); // false -v::notBlank()->validate(' '); // false -v::notBlank()->validate(0); // false -v::notBlank()->validate('0'); // false -v::notBlank()->validate(0); // false -v::notBlank()->validate('0.0'); // false -v::notBlank()->validate(false); // false -v::notBlank()->validate(['']); // false -v::notBlank()->validate([' ']); // false -v::notBlank()->validate([0]); // false -v::notBlank()->validate(['0']); // false -v::notBlank()->validate([false]); // false -v::notBlank()->validate([[''], [0]]); // false -v::notBlank()->validate(new stdClass()); // false +v::notBlank()->isValid(null); // false +v::notBlank()->isValid(''); // false +v::notBlank()->isValid([]); // false +v::notBlank()->isValid(' '); // false +v::notBlank()->isValid(0); // false +v::notBlank()->isValid('0'); // false +v::notBlank()->isValid(0); // false +v::notBlank()->isValid('0.0'); // false +v::notBlank()->isValid(false); // false +v::notBlank()->isValid(['']); // false +v::notBlank()->isValid([' ']); // false +v::notBlank()->isValid([0]); // false +v::notBlank()->isValid(['0']); // false +v::notBlank()->isValid([false]); // false +v::notBlank()->isValid([[''], [0]]); // false +v::notBlank()->isValid(new stdClass()); // false ``` It's similar to [NotEmpty](NotEmpty.md) but it's way more strict. diff --git a/docs/rules/NotEmoji.md b/docs/rules/NotEmoji.md index 2c4020ea6..53eb5b1d0 100644 --- a/docs/rules/NotEmoji.md +++ b/docs/rules/NotEmoji.md @@ -5,12 +5,12 @@ Validates if the input does not contain an emoji. ```php -v::notEmoji()->validate('Hello World, without emoji'); // true -v::notEmoji()->validate('🍕'); // false -v::notEmoji()->validate('🎈'); // false -v::notEmoji()->validate('⚡'); // false -v::notEmoji()->validate('this is a spark ⚡'); // false -v::notEmoji()->validate('🌊🌊🌊🌊🌊🏄🌊🌊🌊🏖🌴'); // false +v::notEmoji()->isValid('Hello World, without emoji'); // true +v::notEmoji()->isValid('🍕'); // false +v::notEmoji()->isValid('🎈'); // false +v::notEmoji()->isValid('⚡'); // false +v::notEmoji()->isValid('this is a spark ⚡'); // false +v::notEmoji()->isValid('🌊🌊🌊🌊🌊🏄🌊🌊🌊🏖🌴'); // false ``` Please consider that the performance of this validator is linear which diff --git a/docs/rules/NotEmpty.md b/docs/rules/NotEmpty.md index 4b20af350..86a5379fd 100644 --- a/docs/rules/NotEmpty.md +++ b/docs/rules/NotEmpty.md @@ -7,32 +7,32 @@ into account, use `noWhitespace()` if no spaces or linebreaks and other whitespace anywhere in the input is desired. ```php -v::stringType()->notEmpty()->validate(''); // false +v::stringType()->notEmpty()->isValid(''); // false ``` Null values are empty: ```php -v::notEmpty()->validate(null); // false +v::notEmpty()->isValid(null); // false ``` Numbers: ```php -v::intVal()->notEmpty()->validate(0); // false +v::intVal()->notEmpty()->isValid(0); // false ``` Empty arrays: ```php -v::arrayVal()->notEmpty()->validate([]); // false +v::arrayVal()->notEmpty()->isValid([]); // false ``` Whitespace: ```php -v::stringType()->notEmpty()->validate(' '); //false -v::stringType()->notEmpty()->validate("\t \n \r"); //false +v::stringType()->notEmpty()->isValid(' '); //false +v::stringType()->notEmpty()->isValid("\t \n \r"); //false ``` ## Categorization diff --git a/docs/rules/NotOptional.md b/docs/rules/NotOptional.md index 34c470841..5ac077f53 100644 --- a/docs/rules/NotOptional.md +++ b/docs/rules/NotOptional.md @@ -6,27 +6,27 @@ Validates if the given input is not optional. By _optional_ we consider `null` or an empty string (`''`). ```php -v::notOptional()->validate(''); // false -v::notOptional()->validate(null); // false +v::notOptional()->isValid(''); // false +v::notOptional()->isValid(null); // false ``` Other values: ```php -v::notOptional()->validate([]); // true -v::notOptional()->validate(' '); // true -v::notOptional()->validate(0); // true -v::notOptional()->validate('0'); // true -v::notOptional()->validate(0); // true -v::notOptional()->validate('0.0'); // true -v::notOptional()->validate(false); // true -v::notOptional()->validate(['']); // true -v::notOptional()->validate([' ']); // true -v::notOptional()->validate([0]); // true -v::notOptional()->validate(['0']); // true -v::notOptional()->validate([false]); // true -v::notOptional()->validate([[''), [0]]); // true -v::notOptional()->validate(new stdClass()); // true +v::notOptional()->isValid([]); // true +v::notOptional()->isValid(' '); // true +v::notOptional()->isValid(0); // true +v::notOptional()->isValid('0'); // true +v::notOptional()->isValid(0); // true +v::notOptional()->isValid('0.0'); // true +v::notOptional()->isValid(false); // true +v::notOptional()->isValid(['']); // true +v::notOptional()->isValid([' ']); // true +v::notOptional()->isValid([0]); // true +v::notOptional()->isValid(['0']); // true +v::notOptional()->isValid([false]); // true +v::notOptional()->isValid([[''), [0]]); // true +v::notOptional()->isValid(new stdClass()); // true ``` ## Categorization diff --git a/docs/rules/NullType.md b/docs/rules/NullType.md index 9caca2244..0b04d4cd2 100644 --- a/docs/rules/NullType.md +++ b/docs/rules/NullType.md @@ -5,7 +5,7 @@ Validates whether the input is [null](http://php.net/types.null). ```php -v::nullType()->validate(null); // true +v::nullType()->isValid(null); // true ``` ## Categorization diff --git a/docs/rules/Nullable.md b/docs/rules/Nullable.md index d81823e15..1dc91ec21 100644 --- a/docs/rules/Nullable.md +++ b/docs/rules/Nullable.md @@ -5,9 +5,9 @@ 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 +v::nullable(v::email())->isValid(null); // true +v::nullable(v::email())->isValid('example@example.com'); // true +v::nullable(v::email())->isValid('not an email'); // false ``` ## Categorization diff --git a/docs/rules/Number.md b/docs/rules/Number.md index f5f97c344..ad53d0b1e 100644 --- a/docs/rules/Number.md +++ b/docs/rules/Number.md @@ -5,8 +5,8 @@ Validates if the input is a number. ```php -v::number()->validate(42); // true -v::number()->validate(acos(8)); // false +v::number()->isValid(42); // true +v::number()->isValid(acos(8)); // false ``` > "In computing, NaN, standing for not a number, is a numeric data type value diff --git a/docs/rules/NumericVal.md b/docs/rules/NumericVal.md index e713f56b7..f9dc8ff1a 100644 --- a/docs/rules/NumericVal.md +++ b/docs/rules/NumericVal.md @@ -5,8 +5,8 @@ Validates whether the input is numeric. ```php -v::numericVal()->validate(-12); // true -v::numericVal()->validate('135.0'); // true +v::numericVal()->isValid(-12); // true +v::numericVal()->isValid('135.0'); // true ``` This rule doesn't validate if the input is a valid number, for that diff --git a/docs/rules/ObjectType.md b/docs/rules/ObjectType.md index 7e89b26f9..5f5880457 100644 --- a/docs/rules/ObjectType.md +++ b/docs/rules/ObjectType.md @@ -5,7 +5,7 @@ Validates whether the input is an [object](http://php.net/types.object). ```php -v::objectType()->validate(new stdClass); // true +v::objectType()->isValid(new stdClass); // true ``` ## Categorization diff --git a/docs/rules/Odd.md b/docs/rules/Odd.md index dafb5865b..d256077e9 100644 --- a/docs/rules/Odd.md +++ b/docs/rules/Odd.md @@ -5,8 +5,8 @@ Validates whether the input is an odd number or not. ```php -v::odd()->validate(0); // false -v::odd()->validate(3); // true +v::odd()->isValid(0); // false +v::odd()->isValid(3); // true ``` Using `intVal()` before `odd()` is a best practice. diff --git a/docs/rules/OneOf.md b/docs/rules/OneOf.md index 1e5990964..073ea4642 100644 --- a/docs/rules/OneOf.md +++ b/docs/rules/OneOf.md @@ -5,10 +5,10 @@ Will validate if exactly one inner validator passes. ```php -v::oneOf(v::digit(), v::alpha())->validate('AB'); // true -v::oneOf(v::digit(), v::alpha())->validate('12'); // true -v::oneOf(v::digit(), v::alpha())->validate('AB12'); // false -v::oneOf(v::digit(), v::alpha())->validate('*'); // false +v::oneOf(v::digit(), v::alpha())->isValid('AB'); // true +v::oneOf(v::digit(), v::alpha())->isValid('12'); // true +v::oneOf(v::digit(), v::alpha())->isValid('AB12'); // false +v::oneOf(v::digit(), v::alpha())->isValid('*'); // false ``` The chains above validate if the input is either a digit or an alphabetic diff --git a/docs/rules/Optional.md b/docs/rules/Optional.md index ab6c68dea..28315570c 100644 --- a/docs/rules/Optional.md +++ b/docs/rules/Optional.md @@ -6,8 +6,8 @@ Validates if the given input is optional or not. By _optional_ we consider `null or an empty string (`''`). ```php -v::optional(v::alpha())->validate(''); // true -v::optional(v::digit())->validate(null); // true +v::optional(v::alpha())->isValid(''); // true +v::optional(v::digit())->isValid(null); // true ``` ## Categorization diff --git a/docs/rules/PerfectSquare.md b/docs/rules/PerfectSquare.md index bad1891b3..75a4818af 100644 --- a/docs/rules/PerfectSquare.md +++ b/docs/rules/PerfectSquare.md @@ -5,8 +5,8 @@ Validates whether the input is a perfect square. ```php -v::perfectSquare()->validate(25); // true (5*5) -v::perfectSquare()->validate(9); // true (3*3) +v::perfectSquare()->isValid(25); // true (5*5) +v::perfectSquare()->isValid(9); // true (3*3) ``` ## Categorization diff --git a/docs/rules/Pesel.md b/docs/rules/Pesel.md index aa9b476ab..97682637e 100644 --- a/docs/rules/Pesel.md +++ b/docs/rules/Pesel.md @@ -5,10 +5,10 @@ Validates PESEL (Polish human identification number). ```php -v::pesel()->validate('21120209256'); // true -v::pesel()->validate('97072704800'); // true -v::pesel()->validate('97072704801'); // false -v::pesel()->validate('PESEL123456'); // false +v::pesel()->isValid('21120209256'); // true +v::pesel()->isValid('97072704800'); // true +v::pesel()->isValid('97072704801'); // false +v::pesel()->isValid('PESEL123456'); // false ``` ## Categorization diff --git a/docs/rules/Phone.md b/docs/rules/Phone.md index a1e0b8567..38faf1479 100644 --- a/docs/rules/Phone.md +++ b/docs/rules/Phone.md @@ -6,9 +6,9 @@ Validates whether the input is a valid phone number. ```php -v::phone()->validate('+1 650 253 00 00'); // true -v::phone('BR')->validate('+55 11 91111 1111'); // true -v::phone('BR')->validate('11 91111 1111'); // false +v::phone()->isValid('+1 650 253 00 00'); // true +v::phone('BR')->isValid('+55 11 91111 1111'); // true +v::phone('BR')->isValid('11 91111 1111'); // false ``` ## Note diff --git a/docs/rules/PhpLabel.md b/docs/rules/PhpLabel.md index 184d07727..9b7d133be 100644 --- a/docs/rules/PhpLabel.md +++ b/docs/rules/PhpLabel.md @@ -9,9 +9,9 @@ Reference: http://php.net/manual/en/language.variables.basics.php ```php -v::phpLabel()->validate('person'); //true -v::phpLabel()->validate('foo'); //true -v::phpLabel()->validate('4ccess'); //false +v::phpLabel()->isValid('person'); //true +v::phpLabel()->isValid('foo'); //true +v::phpLabel()->isValid('4ccess'); //false ``` ## Categorization diff --git a/docs/rules/Pis.md b/docs/rules/Pis.md index 38de2d4ca..6ce926f95 100644 --- a/docs/rules/Pis.md +++ b/docs/rules/Pis.md @@ -5,11 +5,11 @@ Validates a Brazilian PIS/NIS number ignoring any non-digit char. ```php -v::pis()->validate('120.0340.678-8'); // true -v::pis()->validate('120.03406788'); // true -v::pis()->validate('120.0340.6788'); // true -v::pis()->validate('1.2.0.0.3.4.0.6.7.8.8'); // true -v::pis()->validate('12003406788'); // true +v::pis()->isValid('120.0340.678-8'); // true +v::pis()->isValid('120.03406788'); // true +v::pis()->isValid('120.0340.6788'); // true +v::pis()->isValid('1.2.0.0.3.4.0.6.7.8.8'); // true +v::pis()->isValid('12003406788'); // true ``` ## Categorization diff --git a/docs/rules/PolishIdCard.md b/docs/rules/PolishIdCard.md index 4a1187af5..01b18cd10 100644 --- a/docs/rules/PolishIdCard.md +++ b/docs/rules/PolishIdCard.md @@ -5,10 +5,10 @@ Validates whether the input is a Polish identity card (Dowód Osobisty). ```php -v::polishIdCard()->validate('AYW036733'); // true -v::polishIdCard()->validate('APH505567'); // true -v::polishIdCard()->validate('APH 505567'); // false -v::polishIdCard()->validate('AYW036731'); // false +v::polishIdCard()->isValid('AYW036733'); // true +v::polishIdCard()->isValid('APH505567'); // true +v::polishIdCard()->isValid('APH 505567'); // false +v::polishIdCard()->isValid('AYW036731'); // false ``` ## Categorization diff --git a/docs/rules/PortugueseNif.md b/docs/rules/PortugueseNif.md index a17b1afd3..9e5bdbaee 100644 --- a/docs/rules/PortugueseNif.md +++ b/docs/rules/PortugueseNif.md @@ -5,8 +5,8 @@ Validates Portugal's fiscal identification number ([NIF](https://pt.wikipedia.org/wiki/N%C3%BAmero_de_identifica%C3%A7%C3%A3o_fiscal)). ```php -v::portugueseNif()->validate('124885446'); // true -v::portugueseNif()->validate('220005245'); // false +v::portugueseNif()->isValid('124885446'); // true +v::portugueseNif()->isValid('220005245'); // false ``` ## Categorization diff --git a/docs/rules/Positive.md b/docs/rules/Positive.md index 2d8756d33..312983148 100644 --- a/docs/rules/Positive.md +++ b/docs/rules/Positive.md @@ -5,9 +5,9 @@ Validates whether the input is a positive number. ```php -v::positive()->validate(1); // true -v::positive()->validate(0); // false -v::positive()->validate(-15); // false +v::positive()->isValid(1); // true +v::positive()->isValid(0); // false +v::positive()->isValid(-15); // false ``` ## Categorization diff --git a/docs/rules/PostalCode.md b/docs/rules/PostalCode.md index 3658c693b..116be8b40 100644 --- a/docs/rules/PostalCode.md +++ b/docs/rules/PostalCode.md @@ -5,19 +5,19 @@ Validates whether the input is a valid postal code or not. ```php -v::postalCode('BR')->validate('02179000'); // true -v::postalCode('BR')->validate('02179-000'); // true -v::postalCode('US')->validate('02179-000'); // false -v::postalCode('US')->validate('55372'); // true -v::postalCode('PL')->validate('99-300'); // true +v::postalCode('BR')->isValid('02179000'); // true +v::postalCode('BR')->isValid('02179-000'); // true +v::postalCode('US')->isValid('02179-000'); // false +v::postalCode('US')->isValid('55372'); // true +v::postalCode('PL')->isValid('99-300'); // true ``` By default, `PostalCode` won't validate the format (puncts, spaces), unless you pass `$formatted = true`: ```php -v::postalCode('BR', true)->validate('02179000'); // false -v::postalCode('BR', true)->validate('02179-000'); // true +v::postalCode('BR', true)->isValid('02179000'); // false +v::postalCode('BR', true)->isValid('02179-000'); // true ``` Message template for this validator includes `{{countryCode}}`. diff --git a/docs/rules/PrimeNumber.md b/docs/rules/PrimeNumber.md index cd6669434..b3b7eee61 100644 --- a/docs/rules/PrimeNumber.md +++ b/docs/rules/PrimeNumber.md @@ -5,7 +5,7 @@ Validates a prime number ```php -v::primeNumber()->validate(7); // true +v::primeNumber()->isValid(7); // true ``` ## Categorization diff --git a/docs/rules/Printable.md b/docs/rules/Printable.md index e61473b05..9a83628fa 100644 --- a/docs/rules/Printable.md +++ b/docs/rules/Printable.md @@ -6,7 +6,7 @@ Similar to `Graph` but accepts whitespace. ```php -v::printable()->validate('LMKA0$% _123'); // true +v::printable()->isValid('LMKA0$% _123'); // true ``` ## Categorization diff --git a/docs/rules/PublicDomainSuffix.md b/docs/rules/PublicDomainSuffix.md index 281f4e925..ff529ef22 100644 --- a/docs/rules/PublicDomainSuffix.md +++ b/docs/rules/PublicDomainSuffix.md @@ -5,17 +5,17 @@ Validates whether the input is a public ICANN domain suffix. ```php -v::publicDomainSuffix->validate('co.uk'); // true -v::publicDomainSuffix->validate('CO.UK'); // true -v::publicDomainSuffix->validate('nom.br'); // true -v::publicDomainSuffix->validate('invalid.com'); // false +v::publicDomainSuffix->isValid('co.uk'); // true +v::publicDomainSuffix->isValid('CO.UK'); // true +v::publicDomainSuffix->isValid('nom.br'); // true +v::publicDomainSuffix->isValid('invalid.com'); // false ``` This rule will not match top level domains such as `tk`. If you want to match either, use a combination with `Tld`: ```php -v::oneOf(v::tld(), v::publicDomainSuffix())->validate('tk'); // true +v::oneOf(v::tld(), v::publicDomainSuffix())->isValid('tk'); // true ``` ## Categorization diff --git a/docs/rules/Punct.md b/docs/rules/Punct.md index ad06a35b0..43df7c403 100644 --- a/docs/rules/Punct.md +++ b/docs/rules/Punct.md @@ -6,7 +6,7 @@ Validates whether the input composed by only punctuation characters. ```php -v::punct()->validate('&,.;[]'); // true +v::punct()->isValid('&,.;[]'); // true ``` ## Categorization diff --git a/docs/rules/Readable.md b/docs/rules/Readable.md index 53d88da3f..4332fb214 100644 --- a/docs/rules/Readable.md +++ b/docs/rules/Readable.md @@ -5,7 +5,7 @@ Validates if the given data is a file exists and is readable. ```php -v::readable()->validate('file.txt'); // true +v::readable()->isValid('file.txt'); // true ``` ## Categorization diff --git a/docs/rules/Regex.md b/docs/rules/Regex.md index 88a299788..863bde5eb 100644 --- a/docs/rules/Regex.md +++ b/docs/rules/Regex.md @@ -5,7 +5,7 @@ Validates whether the input matches a defined regular expression. ```php -v::regex('/[a-z]/')->validate('a'); // true +v::regex('/[a-z]/')->isValid('a'); // true ``` Message template for this validator includes `{{regex}}`. diff --git a/docs/rules/ResourceType.md b/docs/rules/ResourceType.md index 5aaec706d..098f0488c 100644 --- a/docs/rules/ResourceType.md +++ b/docs/rules/ResourceType.md @@ -5,7 +5,7 @@ Validates whether the input is a [resource](http://php.net/types.resource). ```php -v::resourceType()->validate(fopen('/path/to/file.txt', 'w')); // true +v::resourceType()->isValid(fopen('/path/to/file.txt', 'w')); // true ``` ## Categorization diff --git a/docs/rules/Roman.md b/docs/rules/Roman.md index 6d1271a68..394a564cc 100644 --- a/docs/rules/Roman.md +++ b/docs/rules/Roman.md @@ -5,7 +5,7 @@ Validates if the input is a Roman numeral. ```php -v::roman()->validate('IV'); // true +v::roman()->isValid('IV'); // true ``` ## Categorization diff --git a/docs/rules/ScalarVal.md b/docs/rules/ScalarVal.md index a92b975a6..b1a7270ac 100644 --- a/docs/rules/ScalarVal.md +++ b/docs/rules/ScalarVal.md @@ -5,8 +5,8 @@ Validates whether the input is a scalar value or not. ```php -v::scalarVal()->validate([]); // false -v::scalarVal()->validate(135.0); // true +v::scalarVal()->isValid([]); // false +v::scalarVal()->isValid(135.0); // true ``` ## Categorization diff --git a/docs/rules/Size.md b/docs/rules/Size.md index db325d66a..a3f39fd1a 100644 --- a/docs/rules/Size.md +++ b/docs/rules/Size.md @@ -7,9 +7,9 @@ Validates whether the input is a file that is of a certain size or not. ```php -v::size('1KB')->validate($filename); // Must have at least 1KB size -v::size('1MB', '2MB')->validate($filename); // Must have the size between 1MB and 2MB -v::size(null, '1GB')->validate($filename); // Must not be greater than 1GB +v::size('1KB')->isValid($filename); // Must have at least 1KB size +v::size('1MB', '2MB')->isValid($filename); // Must have the size between 1MB and 2MB +v::size(null, '1GB')->isValid($filename); // Must not be greater than 1GB ``` Sizes are not case-sensitive and the accepted values are: @@ -27,7 +27,7 @@ Sizes are not case-sensitive and the accepted values are: This validator will consider `SplFileInfo` instances, like: ```php -v::size('1.5mb')->validate(new SplFileInfo($filename)); // Will return true or false +v::size('1.5mb')->isValid(new SplFileInfo($filename)); // Will return true or false ``` Message template for this validator includes `{{minSize}}` and `{{maxSize}}`. diff --git a/docs/rules/Slug.md b/docs/rules/Slug.md index 983eb35de..312ec85ad 100644 --- a/docs/rules/Slug.md +++ b/docs/rules/Slug.md @@ -5,9 +5,9 @@ Validates whether the input is a valid slug. ```php -v::slug()->validate('my-wordpress-title'); // true -v::slug()->validate('my-wordpress--title'); // false -v::slug()->validate('my-wordpress-title-'); // false +v::slug()->isValid('my-wordpress-title'); // true +v::slug()->isValid('my-wordpress--title'); // false +v::slug()->isValid('my-wordpress-title-'); // false ``` ## Categorization diff --git a/docs/rules/Sorted.md b/docs/rules/Sorted.md index d1162413c..4eb4cb96e 100644 --- a/docs/rules/Sorted.md +++ b/docs/rules/Sorted.md @@ -5,11 +5,11 @@ Validates whether the input is sorted in a certain order or not. ```php -v::sorted('ASC')->validate([1, 2, 3]); // true -v::sorted('ASC')->validate('ABC'); // true -v::sorted('DESC')->validate([3, 2, 1]); // true -v::sorted('ASC')->validate([]); // true -v::sorted('ASC')->validate([1]); // true +v::sorted('ASC')->isValid([1, 2, 3]); // true +v::sorted('ASC')->isValid('ABC'); // true +v::sorted('DESC')->isValid([3, 2, 1]); // true +v::sorted('ASC')->isValid([]); // true +v::sorted('ASC')->isValid([1]); // true ``` You can also combine [Call](Call.md) to create custom validations: @@ -20,15 +20,15 @@ v::call( return array_column($input, 'key'); }, v::sorted('ASC') - )->validate([ + )->isValid([ ['key' => 1], ['key' => 5], ['key' => 9], ]); // true -v::call('strval', v::sorted('DESC'))->validate(4321); // true +v::call('strval', v::sorted('DESC'))->isValid(4321); // true -v::call('iterator_to_array', v::sorted())->validate(new ArrayIterator([1, 7, 4])); // false +v::call('iterator_to_array', v::sorted())->isValid(new ArrayIterator([1, 7, 4])); // false ``` ## Categorization diff --git a/docs/rules/Space.md b/docs/rules/Space.md index f0081dfc4..14ab059f0 100644 --- a/docs/rules/Space.md +++ b/docs/rules/Space.md @@ -6,7 +6,7 @@ Validates whether the input contains only whitespaces characters. ```php -v::space()->validate(' '); // true +v::space()->isValid(' '); // true ``` ## Categorization diff --git a/docs/rules/StartsWith.md b/docs/rules/StartsWith.md index 38138d256..f206da277 100644 --- a/docs/rules/StartsWith.md +++ b/docs/rules/StartsWith.md @@ -11,13 +11,13 @@ if the value is at the beginning of the input. For strings: ```php -v::startsWith('lorem')->validate('lorem ipsum'); // true +v::startsWith('lorem')->isValid('lorem ipsum'); // true ``` For arrays: ```php -v::startsWith('lorem')->validate(['lorem', 'ipsum']); // true +v::startsWith('lorem')->isValid(['lorem', 'ipsum']); // true ``` `true` may be passed as a parameter to indicate identical comparison diff --git a/docs/rules/StringType.md b/docs/rules/StringType.md index 5191e4dd1..84535d159 100644 --- a/docs/rules/StringType.md +++ b/docs/rules/StringType.md @@ -5,7 +5,7 @@ Validates whether the type of an input is string or not. ```php -v::stringType()->validate('hi'); // true +v::stringType()->isValid('hi'); // true ``` ## Categorization diff --git a/docs/rules/StringVal.md b/docs/rules/StringVal.md index c1707b59d..64478a5e9 100644 --- a/docs/rules/StringVal.md +++ b/docs/rules/StringVal.md @@ -5,13 +5,13 @@ Validates whether the input can be used as a string. ```php -v::stringVal()->validate('6'); // true -v::stringVal()->validate('String'); // true -v::stringVal()->validate(1.0); // true -v::stringVal()->validate(42); // true -v::stringVal()->validate(false); // true -v::stringVal()->validate(true); // true -v::stringVal()->validate(new ClassWithToString()); // true if ClassWithToString implements `__toString` +v::stringVal()->isValid('6'); // true +v::stringVal()->isValid('String'); // true +v::stringVal()->isValid(1.0); // true +v::stringVal()->isValid(42); // true +v::stringVal()->isValid(false); // true +v::stringVal()->isValid(true); // true +v::stringVal()->isValid(new ClassWithToString()); // true if ClassWithToString implements `__toString` ``` ## Categorization diff --git a/docs/rules/SubdivisionCode.md b/docs/rules/SubdivisionCode.md index 5a6cc1a2b..a8d4a62cd 100644 --- a/docs/rules/SubdivisionCode.md +++ b/docs/rules/SubdivisionCode.md @@ -7,8 +7,8 @@ Validates subdivision country codes according to [ISO 3166-2][]. The `$countryCode` must be a country in [ISO 3166-1 alpha-2][] format. ```php -v::subdivisionCode('BR')->validate('SP'); // true -v::subdivisionCode('US')->validate('CA'); // true +v::subdivisionCode('BR')->isValid('SP'); // true +v::subdivisionCode('US')->isValid('CA'); // true ``` This rules uses data from [iso-codes][]. diff --git a/docs/rules/Subset.md b/docs/rules/Subset.md index 1fc1c9e07..cacba0bd9 100644 --- a/docs/rules/Subset.md +++ b/docs/rules/Subset.md @@ -5,8 +5,8 @@ Validates whether the input is a subset of a given value. ```php -v::subset([1, 2, 3])->validate([1, 2]); // true -v::subset([1, 2])->validate([1, 2, 3]); // false +v::subset([1, 2, 3])->isValid([1, 2]); // true +v::subset([1, 2])->isValid([1, 2, 3]); // false ``` ## Categorization diff --git a/docs/rules/SymbolicLink.md b/docs/rules/SymbolicLink.md index 175c4aaeb..d9c443876 100644 --- a/docs/rules/SymbolicLink.md +++ b/docs/rules/SymbolicLink.md @@ -5,9 +5,9 @@ Validates if the given input is a symbolic link. ```php -v::symbolicLink()->validate('/path/of/valid/symbolic/link'); // true -v::symbolicLink()->validate(new SplFileInfo('/path/of/valid/symbolic/link)); // true -v::symbolicLink()->validate(new SplFileObject('/path/of/valid/symbolic/link')); // true +v::symbolicLink()->isValid('/path/of/valid/symbolic/link'); // true +v::symbolicLink()->isValid(new SplFileInfo('/path/of/valid/symbolic/link)); // true +v::symbolicLink()->isValid(new SplFileObject('/path/of/valid/symbolic/link')); // true ``` ## Categorization diff --git a/docs/rules/Time.md b/docs/rules/Time.md index 4a7db9768..73f9a1d15 100644 --- a/docs/rules/Time.md +++ b/docs/rules/Time.md @@ -23,15 +23,15 @@ Format | Description | Values When a `$format` is not given its default value is `H:i:s`. ```php -v::time()->validate('00:00:00'); // true -v::time()->validate('23:20:59'); // true -v::time('H:i')->validate('23:59'); // true -v::time('g:i A')->validate('8:13 AM'); // true -v::time('His')->validate(232059); // true - -v::time()->validate('24:00:00'); // false -v::time()->validate(new DateTime()); // false -v::time()->validate(new DateTimeImmutable()); // false +v::time()->isValid('00:00:00'); // true +v::time()->isValid('23:20:59'); // true +v::time('H:i')->isValid('23:59'); // true +v::time('g:i A')->isValid('8:13 AM'); // true +v::time('His')->isValid(232059); // true + +v::time()->isValid('24:00:00'); // false +v::time()->isValid(new DateTime()); // false +v::time()->isValid(new DateTimeImmutable()); // false ``` ## Categorization diff --git a/docs/rules/Tld.md b/docs/rules/Tld.md index b2859d2ab..731dc0746 100644 --- a/docs/rules/Tld.md +++ b/docs/rules/Tld.md @@ -5,10 +5,10 @@ Validates whether the input is a top-level domain. ```php -v::tld()->validate('com'); // true -v::tld()->validate('ly'); // true -v::tld()->validate('org'); // true -v::tld()->validate('COM'); // true +v::tld()->isValid('com'); // true +v::tld()->isValid('ly'); // true +v::tld()->isValid('org'); // true +v::tld()->isValid('COM'); // true ``` ## Categorization diff --git a/docs/rules/TrueVal.md b/docs/rules/TrueVal.md index a59c96f7c..94524a0d5 100644 --- a/docs/rules/TrueVal.md +++ b/docs/rules/TrueVal.md @@ -5,14 +5,14 @@ Validates if a value is considered as `true`. ```php -v::trueVal()->validate(true); // true -v::trueVal()->validate(1); // true -v::trueVal()->validate('1'); // true -v::trueVal()->validate('true'); // true -v::trueVal()->validate('on'); // true -v::trueVal()->validate('yes'); // true -v::trueVal()->validate('0.5'); // false -v::trueVal()->validate('2'); // false +v::trueVal()->isValid(true); // true +v::trueVal()->isValid(1); // true +v::trueVal()->isValid('1'); // true +v::trueVal()->isValid('true'); // true +v::trueVal()->isValid('on'); // true +v::trueVal()->isValid('yes'); // true +v::trueVal()->isValid('0.5'); // false +v::trueVal()->isValid('2'); // false ``` ## Categorization diff --git a/docs/rules/Type.md b/docs/rules/Type.md index f4275f8a2..e204883b9 100644 --- a/docs/rules/Type.md +++ b/docs/rules/Type.md @@ -5,9 +5,9 @@ Validates the type of input. ```php -v::type('bool')->validate(true); // true -v::type('callable')->validate(function (){}); // true -v::type('object')->validate(new stdClass()); // true +v::type('bool')->isValid(true); // true +v::type('callable')->isValid(function (){}); // true +v::type('object')->isValid(new stdClass()); // true ``` ## Categorization diff --git a/docs/rules/Unique.md b/docs/rules/Unique.md index 1d3d29fb3..683214533 100644 --- a/docs/rules/Unique.md +++ b/docs/rules/Unique.md @@ -5,10 +5,10 @@ Validates whether the input array contains only unique values. ```php -v::unique()->validate([]); // true -v::unique()->validate([1, 2, 3]); // true -v::unique()->validate([1, 2, 2, 3]); // false -v::unique()->validate([1, 2, 3, 1]); // false +v::unique()->isValid([]); // true +v::unique()->isValid([1, 2, 3]); // true +v::unique()->isValid([1, 2, 2, 3]); // false +v::unique()->isValid([1, 2, 3, 1]); // false ``` ## Categorization diff --git a/docs/rules/Uploaded.md b/docs/rules/Uploaded.md index 59766275e..27a5d0f47 100644 --- a/docs/rules/Uploaded.md +++ b/docs/rules/Uploaded.md @@ -5,7 +5,7 @@ Validates if the given data is a file that was uploaded via HTTP POST. ```php -v::uploaded()->validate('/path/of/an/uploaded/file'); // true +v::uploaded()->isValid('/path/of/an/uploaded/file'); // true ``` ## Categorization diff --git a/docs/rules/Uppercase.md b/docs/rules/Uppercase.md index 8f64ef06e..c9f5eab76 100644 --- a/docs/rules/Uppercase.md +++ b/docs/rules/Uppercase.md @@ -5,7 +5,7 @@ Validates whether the characters in the input are uppercase. ```php -v::uppercase()->validate('W3C'); // true +v::uppercase()->isValid('W3C'); // true ``` This rule does not validate if the input a numeric value, so `123` and `%` will @@ -13,9 +13,9 @@ be valid. Please add more validations to the chain if you want to refine your validation. ```php -v::not(v::numericVal())->uppercase()->validate('42'); // false -v::alnum()->uppercase()->validate('#$%!'); // false -v::not(v::numericVal())->alnum()->uppercase()->validate('W3C'); // true +v::not(v::numericVal())->uppercase()->isValid('42'); // false +v::alnum()->uppercase()->isValid('#$%!'); // false +v::not(v::numericVal())->alnum()->uppercase()->isValid('W3C'); // true ``` ## Categorization diff --git a/docs/rules/Url.md b/docs/rules/Url.md index 72bfd9758..d27c0b41d 100644 --- a/docs/rules/Url.md +++ b/docs/rules/Url.md @@ -5,11 +5,11 @@ Validates whether the input is a URL. ```php -v::url()->validate('http://example.com'); // true -v::url()->validate('https://www.youtube.com/watch?v=6FOUqQt3Kg0'); // true -v::url()->validate('ldap://[::1]'); // true -v::url()->validate('mailto:john.doe@example.com'); // true -v::url()->validate('news:new.example.com'); // true +v::url()->isValid('http://example.com'); // true +v::url()->isValid('https://www.youtube.com/watch?v=6FOUqQt3Kg0'); // true +v::url()->isValid('ldap://[::1]'); // true +v::url()->isValid('mailto:john.doe@example.com'); // true +v::url()->isValid('news:new.example.com'); // true ``` ## Categorization diff --git a/docs/rules/Uuid.md b/docs/rules/Uuid.md index 2a06ed6dc..b7d14bd3d 100644 --- a/docs/rules/Uuid.md +++ b/docs/rules/Uuid.md @@ -7,10 +7,10 @@ Validates whether the input is a valid UUID. It also supports validation of specific versions 1, 3, 4 and 5. ```php -v::uuid()->validate('Hello World!'); // false -v::uuid()->validate('eb3115e5-bd16-4939-ab12-2b95745a30f3'); // true -v::uuid(1)->validate('eb3115e5-bd16-4939-ab12-2b95745a30f3'); // false -v::uuid(4)->validate('eb3115e5-bd16-4939-ab12-2b95745a30f3'); // true +v::uuid()->isValid('Hello World!'); // false +v::uuid()->isValid('eb3115e5-bd16-4939-ab12-2b95745a30f3'); // true +v::uuid(1)->isValid('eb3115e5-bd16-4939-ab12-2b95745a30f3'); // false +v::uuid(4)->isValid('eb3115e5-bd16-4939-ab12-2b95745a30f3'); // true ``` ## Categorization diff --git a/docs/rules/Version.md b/docs/rules/Version.md index 6d2670929..db0c13a89 100644 --- a/docs/rules/Version.md +++ b/docs/rules/Version.md @@ -5,7 +5,7 @@ Validates version numbers using Semantic Versioning. ```php -v::version()->validate('1.0.0'); +v::version()->isValid('1.0.0'); ``` ## Categorization diff --git a/docs/rules/VideoUrl.md b/docs/rules/VideoUrl.md index b3a6cfbd9..22a15f813 100644 --- a/docs/rules/VideoUrl.md +++ b/docs/rules/VideoUrl.md @@ -6,23 +6,23 @@ Validates if the input is a video URL value. ```php -v::videoUrl()->validate('https://player.vimeo.com/video/71787467'); // true -v::videoUrl()->validate('https://vimeo.com/71787467'); // true -v::videoUrl()->validate('https://www.youtube.com/embed/netHLn9TScY'); // true -v::videoUrl()->validate('https://www.youtube.com/watch?v=netHLn9TScY'); // true -v::videoUrl()->validate('https://youtu.be/netHLn9TScY'); // true -v::videoUrl()->validate('https://www.twitch.tv/videos/320689092'); // true -v::videoUrl()->validate('https://clips.twitch.tv/BitterLazyMangetoutHumbleLife'); // true - -v::videoUrl('youtube')->validate('https://www.youtube.com/watch?v=netHLn9TScY'); // true -v::videoUrl('vimeo')->validate('https://vimeo.com/71787467'); // true -v::videoUrl('twitch')->validate('https://www.twitch.tv/videos/320689092'); // true -v::videoUrl('twitch')->validate('https://clips.twitch.tv/BitterLazyMangetoutHumbleLife'); // true - -v::videoUrl()->validate('https://youtube.com'); // false -v::videoUrl('youtube')->validate('https://vimeo.com/71787467'); // false -v::videoUrl('twitch')->validate('https://clips.twitch.tv/videos/90210'); // false -v::videoUrl('twitch')->validate('https://twitch.tv/TakeTeaAndNoTea'); // false +v::videoUrl()->isValid('https://player.vimeo.com/video/71787467'); // true +v::videoUrl()->isValid('https://vimeo.com/71787467'); // true +v::videoUrl()->isValid('https://www.youtube.com/embed/netHLn9TScY'); // true +v::videoUrl()->isValid('https://www.youtube.com/watch?v=netHLn9TScY'); // true +v::videoUrl()->isValid('https://youtu.be/netHLn9TScY'); // true +v::videoUrl()->isValid('https://www.twitch.tv/videos/320689092'); // true +v::videoUrl()->isValid('https://clips.twitch.tv/BitterLazyMangetoutHumbleLife'); // true + +v::videoUrl('youtube')->isValid('https://www.youtube.com/watch?v=netHLn9TScY'); // true +v::videoUrl('vimeo')->isValid('https://vimeo.com/71787467'); // true +v::videoUrl('twitch')->isValid('https://www.twitch.tv/videos/320689092'); // true +v::videoUrl('twitch')->isValid('https://clips.twitch.tv/BitterLazyMangetoutHumbleLife'); // true + +v::videoUrl()->isValid('https://youtube.com'); // false +v::videoUrl('youtube')->isValid('https://vimeo.com/71787467'); // false +v::videoUrl('twitch')->isValid('https://clips.twitch.tv/videos/90210'); // false +v::videoUrl('twitch')->isValid('https://twitch.tv/TakeTeaAndNoTea'); // false ``` The services accepted are: diff --git a/docs/rules/Vowel.md b/docs/rules/Vowel.md index 6d65179db..c91ba3bc0 100644 --- a/docs/rules/Vowel.md +++ b/docs/rules/Vowel.md @@ -6,7 +6,7 @@ Validates whether the input contains only vowels. ```php -v::vowel()->validate('aei'); // true +v::vowel()->isValid('aei'); // true ``` ## Categorization diff --git a/docs/rules/When.md b/docs/rules/When.md index 0d0635c74..e5eda8012 100644 --- a/docs/rules/When.md +++ b/docs/rules/When.md @@ -9,11 +9,11 @@ When the `$if` validates, returns validation for `$then`. When the `$if` doesn't validate, returns validation for `$else`, if defined. ```php -v::when(v::intVal(), v::positive(), v::notEmpty())->validate(1); // true -v::when(v::intVal(), v::positive(), v::notEmpty())->validate('not empty'); // true +v::when(v::intVal(), v::positive(), v::notEmpty())->isValid(1); // true +v::when(v::intVal(), v::positive(), v::notEmpty())->isValid('not empty'); // true -v::when(v::intVal(), v::positive(), v::notEmpty())->validate(-1); // false -v::when(v::intVal(), v::positive(), v::notEmpty())->validate(''); // false +v::when(v::intVal(), v::positive(), v::notEmpty())->isValid(-1); // false +v::when(v::intVal(), v::positive(), v::notEmpty())->isValid(''); // false ``` In the sample above, if `$input` is an integer, then it must be positive. diff --git a/docs/rules/Writable.md b/docs/rules/Writable.md index 1e987c50c..f51d91930 100644 --- a/docs/rules/Writable.md +++ b/docs/rules/Writable.md @@ -5,7 +5,7 @@ Validates if the given input is writable file. ```php -v::writable()->validate('file.txt'); // true +v::writable()->isValid('file.txt'); // true ``` ## Categorization diff --git a/docs/rules/Xdigit.md b/docs/rules/Xdigit.md index ae4d926f1..e077a096d 100644 --- a/docs/rules/Xdigit.md +++ b/docs/rules/Xdigit.md @@ -6,13 +6,13 @@ Validates whether the input is an hexadecimal number or not. ```php -v::xdigit()->validate('abc123'); // true +v::xdigit()->isValid('abc123'); // true ``` Notice, however, that it doesn't accept strings starting with 0x: ```php -v::xdigit()->validate('0x1f'); // false +v::xdigit()->isValid('0x1f'); // false ``` ## Categorization diff --git a/docs/rules/Yes.md b/docs/rules/Yes.md index c46205cd3..79b601018 100644 --- a/docs/rules/Yes.md +++ b/docs/rules/Yes.md @@ -6,11 +6,11 @@ Validates if the input considered as "Yes". ```php -v::yes()->validate('Y'); // true -v::yes()->validate('Yea'); // true -v::yes()->validate('Yeah'); // true -v::yes()->validate('Yep'); // true -v::yes()->validate('Yes'); // true +v::yes()->isValid('Y'); // true +v::yes()->isValid('Yea'); // true +v::yes()->isValid('Yeah'); // true +v::yes()->isValid('Yep'); // true +v::yes()->isValid('Yes'); // true ``` This rule is case insensitive. @@ -20,13 +20,13 @@ constant, meaning that it will validate the input using your current location: ```php setlocale(LC_ALL, 'pt_BR'); -v::yes(true)->validate('Sim'); // true +v::yes(true)->isValid('Sim'); // true ``` Be careful when using `$locale` as `TRUE` because the it's very permissive: ```php -v::yes(true)->validate('Yydoesnotmatter'); // true +v::yes(true)->isValid('Yydoesnotmatter'); // true ``` Besides that, with `$locale` as `TRUE` it will consider any character starting @@ -34,7 +34,7 @@ with "Y" as valid: ```php setlocale(LC_ALL, 'ru_RU'); -v::yes(true)->validate('Yes'); // true +v::yes(true)->isValid('Yes'); // true ``` ## Categorization diff --git a/library/Exceptions/AllOfException.php b/library/Exceptions/AllOfException.php index fc615d4fe..b19a7a3d5 100644 --- a/library/Exceptions/AllOfException.php +++ b/library/Exceptions/AllOfException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see NestedValidationException} instead. */ class AllOfException extends GroupedValidationException { diff --git a/library/Exceptions/AlnumException.php b/library/Exceptions/AlnumException.php index 05843c76b..73964d3c7 100644 --- a/library/Exceptions/AlnumException.php +++ b/library/Exceptions/AlnumException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class AlnumException extends FilteredValidationException { diff --git a/library/Exceptions/AlphaException.php b/library/Exceptions/AlphaException.php index d233818b9..a3d676e84 100644 --- a/library/Exceptions/AlphaException.php +++ b/library/Exceptions/AlphaException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class AlphaException extends FilteredValidationException { diff --git a/library/Exceptions/AlwaysInvalidException.php b/library/Exceptions/AlwaysInvalidException.php index 1b9dac271..a83e24755 100644 --- a/library/Exceptions/AlwaysInvalidException.php +++ b/library/Exceptions/AlwaysInvalidException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class AlwaysInvalidException extends ValidationException { diff --git a/library/Exceptions/AlwaysValidException.php b/library/Exceptions/AlwaysValidException.php index d7f56a357..286468ccd 100644 --- a/library/Exceptions/AlwaysValidException.php +++ b/library/Exceptions/AlwaysValidException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class AlwaysValidException extends ValidationException { diff --git a/library/Exceptions/AnyOfException.php b/library/Exceptions/AnyOfException.php index 3d2f77f20..578b60806 100644 --- a/library/Exceptions/AnyOfException.php +++ b/library/Exceptions/AnyOfException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class AnyOfException extends NestedValidationException { diff --git a/library/Exceptions/ArrayTypeException.php b/library/Exceptions/ArrayTypeException.php index b4d184533..05f95832b 100644 --- a/library/Exceptions/ArrayTypeException.php +++ b/library/Exceptions/ArrayTypeException.php @@ -14,6 +14,7 @@ * @author Emmerson Siqueira * @author Henrique Moody * @author João Torquato + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ArrayTypeException extends ValidationException { diff --git a/library/Exceptions/ArrayValException.php b/library/Exceptions/ArrayValException.php index dbb4b3570..2f667113a 100644 --- a/library/Exceptions/ArrayValException.php +++ b/library/Exceptions/ArrayValException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Emmerson Siqueira * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ArrayValException extends ValidationException { diff --git a/library/Exceptions/AttributeException.php b/library/Exceptions/AttributeException.php index d80e98b04..278c5de7c 100644 --- a/library/Exceptions/AttributeException.php +++ b/library/Exceptions/AttributeException.php @@ -15,6 +15,7 @@ * @author Alexandre Gomes Gaigalas * @author Emmerson Siqueira * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class AttributeException extends NestedValidationException implements NonOmissibleException { diff --git a/library/Exceptions/Base64Exception.php b/library/Exceptions/Base64Exception.php index ecce9be2c..72c806b7a 100644 --- a/library/Exceptions/Base64Exception.php +++ b/library/Exceptions/Base64Exception.php @@ -13,6 +13,7 @@ * @author Henrique Moody * @author Jens Segers * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class Base64Exception extends ValidationException { diff --git a/library/Exceptions/BaseException.php b/library/Exceptions/BaseException.php index 053f0ff78..74d7b4a86 100644 --- a/library/Exceptions/BaseException.php +++ b/library/Exceptions/BaseException.php @@ -13,6 +13,7 @@ * @author Carlos André Ferrari * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class BaseException extends ValidationException { diff --git a/library/Exceptions/BetweenException.php b/library/Exceptions/BetweenException.php index 45daa9cb0..d1704286d 100644 --- a/library/Exceptions/BetweenException.php +++ b/library/Exceptions/BetweenException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class BetweenException extends NestedValidationException { diff --git a/library/Exceptions/BoolTypeException.php b/library/Exceptions/BoolTypeException.php index f34c07cbd..f66c194f4 100644 --- a/library/Exceptions/BoolTypeException.php +++ b/library/Exceptions/BoolTypeException.php @@ -14,6 +14,7 @@ * * @author Devin Torres * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class BoolTypeException extends ValidationException { diff --git a/library/Exceptions/BoolValException.php b/library/Exceptions/BoolValException.php index 70b8ad3f4..8dc3ac1bd 100644 --- a/library/Exceptions/BoolValException.php +++ b/library/Exceptions/BoolValException.php @@ -13,6 +13,7 @@ * @author Emmerson Siqueira * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class BoolValException extends ValidationException { diff --git a/library/Exceptions/BsnException.php b/library/Exceptions/BsnException.php index 31ecd41ac..2645f6f8d 100644 --- a/library/Exceptions/BsnException.php +++ b/library/Exceptions/BsnException.php @@ -13,6 +13,7 @@ * @author Henrique Moody * @author Ronald Drenth * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class BsnException extends ValidationException { diff --git a/library/Exceptions/CallException.php b/library/Exceptions/CallException.php index 9a822d021..f86f09166 100644 --- a/library/Exceptions/CallException.php +++ b/library/Exceptions/CallException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class CallException extends NestedValidationException { diff --git a/library/Exceptions/CallableTypeException.php b/library/Exceptions/CallableTypeException.php index dc0ac467e..5a802f490 100644 --- a/library/Exceptions/CallableTypeException.php +++ b/library/Exceptions/CallableTypeException.php @@ -13,6 +13,7 @@ * Exception class for CallableType rule. * * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class CallableTypeException extends ValidationException { diff --git a/library/Exceptions/CallbackException.php b/library/Exceptions/CallbackException.php index 548ee147e..dda6e952b 100644 --- a/library/Exceptions/CallbackException.php +++ b/library/Exceptions/CallbackException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class CallbackException extends NestedValidationException { diff --git a/library/Exceptions/CharsetException.php b/library/Exceptions/CharsetException.php index cac33c47a..568ca08b8 100644 --- a/library/Exceptions/CharsetException.php +++ b/library/Exceptions/CharsetException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class CharsetException extends ValidationException { diff --git a/library/Exceptions/CnhException.php b/library/Exceptions/CnhException.php index dc1340e78..ed7248a43 100644 --- a/library/Exceptions/CnhException.php +++ b/library/Exceptions/CnhException.php @@ -13,6 +13,7 @@ * @author Henrique Moody * @author Kinn Coelho Julião * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class CnhException extends ValidationException { diff --git a/library/Exceptions/CnpjException.php b/library/Exceptions/CnpjException.php index 8ecff68c4..4b0cdb33e 100644 --- a/library/Exceptions/CnpjException.php +++ b/library/Exceptions/CnpjException.php @@ -13,6 +13,7 @@ * @author Henrique Moody * @author Leonn Leite * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class CnpjException extends ValidationException { diff --git a/library/Exceptions/ConsonantException.php b/library/Exceptions/ConsonantException.php index 5977e45df..66c1db23e 100644 --- a/library/Exceptions/ConsonantException.php +++ b/library/Exceptions/ConsonantException.php @@ -13,6 +13,7 @@ * @author Henrique Moody * @author Danilo Correa * @author Kleber Hamada Sato + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ConsonantException extends FilteredValidationException { diff --git a/library/Exceptions/ContainsAnyException.php b/library/Exceptions/ContainsAnyException.php index c65b60893..702a65abd 100644 --- a/library/Exceptions/ContainsAnyException.php +++ b/library/Exceptions/ContainsAnyException.php @@ -11,6 +11,7 @@ /** * @author Kirill Dlussky + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ContainsAnyException extends ValidationException { diff --git a/library/Exceptions/ContainsException.php b/library/Exceptions/ContainsException.php index 54b68b91a..d54c808cb 100644 --- a/library/Exceptions/ContainsException.php +++ b/library/Exceptions/ContainsException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ContainsException extends ValidationException { diff --git a/library/Exceptions/ControlException.php b/library/Exceptions/ControlException.php index e2d26ff23..b100aa98b 100644 --- a/library/Exceptions/ControlException.php +++ b/library/Exceptions/ControlException.php @@ -13,6 +13,7 @@ * @author Andre Ramaciotti * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ControlException extends FilteredValidationException { diff --git a/library/Exceptions/CountableException.php b/library/Exceptions/CountableException.php index ed941ac5f..510a96cc4 100644 --- a/library/Exceptions/CountableException.php +++ b/library/Exceptions/CountableException.php @@ -13,6 +13,7 @@ * @author Henrique Moody * @author João Torquato * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class CountableException extends ValidationException { diff --git a/library/Exceptions/CountryCodeException.php b/library/Exceptions/CountryCodeException.php index 1dc2f1ba4..6b9fbec2f 100644 --- a/library/Exceptions/CountryCodeException.php +++ b/library/Exceptions/CountryCodeException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class CountryCodeException extends ValidationException { diff --git a/library/Exceptions/CpfException.php b/library/Exceptions/CpfException.php index f52c134cf..26eff0f37 100644 --- a/library/Exceptions/CpfException.php +++ b/library/Exceptions/CpfException.php @@ -13,6 +13,7 @@ * @author Henrique Moody * @author Jair Henrique * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class CpfException extends ValidationException { diff --git a/library/Exceptions/CreditCardException.php b/library/Exceptions/CreditCardException.php index 8ea0194b8..bbac76ae3 100644 --- a/library/Exceptions/CreditCardException.php +++ b/library/Exceptions/CreditCardException.php @@ -15,6 +15,7 @@ * @author Henrique Moody * @author Jean Pimentel * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class CreditCardException extends ValidationException { diff --git a/library/Exceptions/CurrencyCodeException.php b/library/Exceptions/CurrencyCodeException.php index ca41fc4f2..2c81c3100 100644 --- a/library/Exceptions/CurrencyCodeException.php +++ b/library/Exceptions/CurrencyCodeException.php @@ -13,6 +13,7 @@ * @author Henrique Moody * @author Justin Hook * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class CurrencyCodeException extends ValidationException { diff --git a/library/Exceptions/DateException.php b/library/Exceptions/DateException.php index 9eaec3041..0dbfa8706 100644 --- a/library/Exceptions/DateException.php +++ b/library/Exceptions/DateException.php @@ -12,6 +12,7 @@ /** * @author Bruno Luiz da Silva * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class DateException extends ValidationException { diff --git a/library/Exceptions/DateTimeException.php b/library/Exceptions/DateTimeException.php index edaac29c7..dd7ebf6d0 100644 --- a/library/Exceptions/DateTimeException.php +++ b/library/Exceptions/DateTimeException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class DateTimeException extends ValidationException { diff --git a/library/Exceptions/DecimalException.php b/library/Exceptions/DecimalException.php index 69cf14d52..2b78fc68a 100644 --- a/library/Exceptions/DecimalException.php +++ b/library/Exceptions/DecimalException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class DecimalException extends ValidationException { diff --git a/library/Exceptions/DigitException.php b/library/Exceptions/DigitException.php index bd5a2b51c..b97adad51 100644 --- a/library/Exceptions/DigitException.php +++ b/library/Exceptions/DigitException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class DigitException extends FilteredValidationException { diff --git a/library/Exceptions/DirectoryException.php b/library/Exceptions/DirectoryException.php index 885a340b2..9e52de831 100644 --- a/library/Exceptions/DirectoryException.php +++ b/library/Exceptions/DirectoryException.php @@ -12,6 +12,7 @@ /** * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class DirectoryException extends ValidationException { diff --git a/library/Exceptions/DomainException.php b/library/Exceptions/DomainException.php index 6a8fd8eb8..447472a31 100644 --- a/library/Exceptions/DomainException.php +++ b/library/Exceptions/DomainException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class DomainException extends NestedValidationException { diff --git a/library/Exceptions/EachException.php b/library/Exceptions/EachException.php index 893ba09a7..51cc21cdd 100644 --- a/library/Exceptions/EachException.php +++ b/library/Exceptions/EachException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class EachException extends NestedValidationException { diff --git a/library/Exceptions/EmailException.php b/library/Exceptions/EmailException.php index 29927c754..424345a91 100644 --- a/library/Exceptions/EmailException.php +++ b/library/Exceptions/EmailException.php @@ -17,6 +17,7 @@ * @author Eduardo Gulias Davis * @author Henrique Moody * @author Paul Karikari + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class EmailException extends ValidationException { diff --git a/library/Exceptions/EndsWithException.php b/library/Exceptions/EndsWithException.php index 5fd6bf720..0073c63b6 100644 --- a/library/Exceptions/EndsWithException.php +++ b/library/Exceptions/EndsWithException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class EndsWithException extends ValidationException { diff --git a/library/Exceptions/EqualsException.php b/library/Exceptions/EqualsException.php index 5d9aebe42..729d1ac4f 100644 --- a/library/Exceptions/EqualsException.php +++ b/library/Exceptions/EqualsException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Henrique Moody * @author Ian Nisbet + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class EqualsException extends ValidationException { diff --git a/library/Exceptions/EquivalentException.php b/library/Exceptions/EquivalentException.php index 830401b49..8d795e42d 100644 --- a/library/Exceptions/EquivalentException.php +++ b/library/Exceptions/EquivalentException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class EquivalentException extends ValidationException { diff --git a/library/Exceptions/EvenException.php b/library/Exceptions/EvenException.php index 50c7321ae..03e782447 100644 --- a/library/Exceptions/EvenException.php +++ b/library/Exceptions/EvenException.php @@ -15,6 +15,7 @@ * @author Henrique Moody * @author Jean Pimentel * @author Paul Karikari + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class EvenException extends ValidationException { diff --git a/library/Exceptions/ExecutableException.php b/library/Exceptions/ExecutableException.php index 9584d4131..2469e5bb7 100644 --- a/library/Exceptions/ExecutableException.php +++ b/library/Exceptions/ExecutableException.php @@ -12,6 +12,7 @@ /** * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ExecutableException extends ValidationException { diff --git a/library/Exceptions/ExistsException.php b/library/Exceptions/ExistsException.php index 99ddb643d..4447e17f4 100644 --- a/library/Exceptions/ExistsException.php +++ b/library/Exceptions/ExistsException.php @@ -12,6 +12,7 @@ /** * @author Henrique Moody * @author William Espindola + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ExistsException extends ValidationException { diff --git a/library/Exceptions/ExtensionException.php b/library/Exceptions/ExtensionException.php index 382aa6e46..e5ad2e1d6 100644 --- a/library/Exceptions/ExtensionException.php +++ b/library/Exceptions/ExtensionException.php @@ -14,6 +14,7 @@ * * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ExtensionException extends ValidationException { diff --git a/library/Exceptions/FactorException.php b/library/Exceptions/FactorException.php index 8ac8308c4..bda713e94 100644 --- a/library/Exceptions/FactorException.php +++ b/library/Exceptions/FactorException.php @@ -13,6 +13,7 @@ * @author Danilo Correa * @author David Meister * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class FactorException extends ValidationException { diff --git a/library/Exceptions/FalseValException.php b/library/Exceptions/FalseValException.php index 37a78cc5c..59d7610ed 100644 --- a/library/Exceptions/FalseValException.php +++ b/library/Exceptions/FalseValException.php @@ -12,6 +12,7 @@ /** * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class FalseValException extends ValidationException { diff --git a/library/Exceptions/FibonacciException.php b/library/Exceptions/FibonacciException.php index 395ec8093..c2e70e5bb 100644 --- a/library/Exceptions/FibonacciException.php +++ b/library/Exceptions/FibonacciException.php @@ -13,6 +13,7 @@ * @author Danilo Correa * @author Henrique Moody * @author Samuel Heinzmann + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class FibonacciException extends ValidationException { diff --git a/library/Exceptions/FileException.php b/library/Exceptions/FileException.php index f39113570..0e54b2028 100644 --- a/library/Exceptions/FileException.php +++ b/library/Exceptions/FileException.php @@ -12,6 +12,7 @@ /** * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class FileException extends ValidationException { diff --git a/library/Exceptions/FilterVarException.php b/library/Exceptions/FilterVarException.php index 798b373a8..0a55c63fa 100644 --- a/library/Exceptions/FilterVarException.php +++ b/library/Exceptions/FilterVarException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class FilterVarException extends ValidationException { diff --git a/library/Exceptions/FiniteException.php b/library/Exceptions/FiniteException.php index 500dfb080..4fcca6713 100644 --- a/library/Exceptions/FiniteException.php +++ b/library/Exceptions/FiniteException.php @@ -12,6 +12,7 @@ /** * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class FiniteException extends ValidationException { diff --git a/library/Exceptions/FloatTypeException.php b/library/Exceptions/FloatTypeException.php index b3b72261b..a08890936 100644 --- a/library/Exceptions/FloatTypeException.php +++ b/library/Exceptions/FloatTypeException.php @@ -14,6 +14,7 @@ * * @author Henrique Moody * @author Reginaldo Junior <76regi@gmail.com> + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class FloatTypeException extends ValidationException { diff --git a/library/Exceptions/FloatValException.php b/library/Exceptions/FloatValException.php index e64c57f90..5dd8c961b 100644 --- a/library/Exceptions/FloatValException.php +++ b/library/Exceptions/FloatValException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Danilo Benevides * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class FloatValException extends ValidationException { diff --git a/library/Exceptions/GraphException.php b/library/Exceptions/GraphException.php index d5f5b6884..8c7694112 100644 --- a/library/Exceptions/GraphException.php +++ b/library/Exceptions/GraphException.php @@ -13,6 +13,7 @@ * @author Andre Ramaciotti * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class GraphException extends FilteredValidationException { diff --git a/library/Exceptions/GreaterThanException.php b/library/Exceptions/GreaterThanException.php index 006c1a273..4e0d1ada5 100644 --- a/library/Exceptions/GreaterThanException.php +++ b/library/Exceptions/GreaterThanException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class GreaterThanException extends ValidationException { diff --git a/library/Exceptions/HexRgbColorException.php b/library/Exceptions/HexRgbColorException.php index ca4d05b86..dee83251b 100644 --- a/library/Exceptions/HexRgbColorException.php +++ b/library/Exceptions/HexRgbColorException.php @@ -12,6 +12,7 @@ /** * @author Davide Pastore * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class HexRgbColorException extends ValidationException { diff --git a/library/Exceptions/IbanException.php b/library/Exceptions/IbanException.php index a702559d3..286ce937b 100644 --- a/library/Exceptions/IbanException.php +++ b/library/Exceptions/IbanException.php @@ -11,6 +11,7 @@ /** * @author Mazen Touati + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class IbanException extends ValidationException { diff --git a/library/Exceptions/IdenticalException.php b/library/Exceptions/IdenticalException.php index e99e8a2a9..795ed22f1 100644 --- a/library/Exceptions/IdenticalException.php +++ b/library/Exceptions/IdenticalException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class IdenticalException extends ValidationException { diff --git a/library/Exceptions/ImageException.php b/library/Exceptions/ImageException.php index ee59a2274..2fdd822f9 100644 --- a/library/Exceptions/ImageException.php +++ b/library/Exceptions/ImageException.php @@ -13,6 +13,7 @@ * @author Danilo Benevides * @author Guilherme Siani * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ImageException extends ValidationException { diff --git a/library/Exceptions/ImeiException.php b/library/Exceptions/ImeiException.php index f485b6522..7a5760af3 100644 --- a/library/Exceptions/ImeiException.php +++ b/library/Exceptions/ImeiException.php @@ -13,6 +13,7 @@ * @author Danilo Benevides * @author Diego Oliveira * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ImeiException extends ValidationException { diff --git a/library/Exceptions/InException.php b/library/Exceptions/InException.php index ef42c1303..976adfaf1 100644 --- a/library/Exceptions/InException.php +++ b/library/Exceptions/InException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Danilo Benevides * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class InException extends ValidationException { diff --git a/library/Exceptions/InfiniteException.php b/library/Exceptions/InfiniteException.php index c480ffb92..a163b2213 100644 --- a/library/Exceptions/InfiniteException.php +++ b/library/Exceptions/InfiniteException.php @@ -12,6 +12,7 @@ /** * @author Danilo Benevides * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class InfiniteException extends ValidationException { diff --git a/library/Exceptions/InstanceException.php b/library/Exceptions/InstanceException.php index ccff60ba2..f75f9a833 100644 --- a/library/Exceptions/InstanceException.php +++ b/library/Exceptions/InstanceException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Danilo Benevides * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class InstanceException extends ValidationException { diff --git a/library/Exceptions/IntTypeException.php b/library/Exceptions/IntTypeException.php index 7617f4c61..9bb3cb0c7 100644 --- a/library/Exceptions/IntTypeException.php +++ b/library/Exceptions/IntTypeException.php @@ -13,6 +13,7 @@ * Exception class for IntType rule. * * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class IntTypeException extends ValidationException { diff --git a/library/Exceptions/IntValException.php b/library/Exceptions/IntValException.php index 694b83429..fc1955156 100644 --- a/library/Exceptions/IntValException.php +++ b/library/Exceptions/IntValException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Danilo Benevides * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class IntValException extends ValidationException { diff --git a/library/Exceptions/InvalidClassException.php b/library/Exceptions/InvalidClassException.php index 72361fd8e..482de83ba 100644 --- a/library/Exceptions/InvalidClassException.php +++ b/library/Exceptions/InvalidClassException.php @@ -15,6 +15,7 @@ * @since 2.0.0 * * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class InvalidClassException extends ComponentException { diff --git a/library/Exceptions/IpException.php b/library/Exceptions/IpException.php index 3809e89a7..9a2a1ee0a 100644 --- a/library/Exceptions/IpException.php +++ b/library/Exceptions/IpException.php @@ -14,6 +14,7 @@ * @author Danilo Benevides * @author Henrique Moody * @author Luís Otávio Cobucci Oblonczyk + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class IpException extends ValidationException { diff --git a/library/Exceptions/IsbnException.php b/library/Exceptions/IsbnException.php index ba0d5ee7f..73580ec46 100644 --- a/library/Exceptions/IsbnException.php +++ b/library/Exceptions/IsbnException.php @@ -12,6 +12,7 @@ /** * @author Henrique Moody * @author Moritz Fromm + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class IsbnException extends ValidationException { diff --git a/library/Exceptions/IterableTypeException.php b/library/Exceptions/IterableTypeException.php index aad3b4e2d..1bac9f072 100644 --- a/library/Exceptions/IterableTypeException.php +++ b/library/Exceptions/IterableTypeException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class IterableTypeException extends ValidationException { diff --git a/library/Exceptions/JsonException.php b/library/Exceptions/JsonException.php index 73cffd8b2..eb36d52d7 100644 --- a/library/Exceptions/JsonException.php +++ b/library/Exceptions/JsonException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Danilo Benevides * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class JsonException extends ValidationException { diff --git a/library/Exceptions/KeyException.php b/library/Exceptions/KeyException.php index 7f27c94e9..5ba2b347d 100644 --- a/library/Exceptions/KeyException.php +++ b/library/Exceptions/KeyException.php @@ -15,6 +15,7 @@ * @author Alexandre Gomes Gaigalas * @author Emmerson Siqueira * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class KeyException extends NestedValidationException implements NonOmissibleException { diff --git a/library/Exceptions/KeyNestedException.php b/library/Exceptions/KeyNestedException.php index 6d35ec3cc..fa172668b 100644 --- a/library/Exceptions/KeyNestedException.php +++ b/library/Exceptions/KeyNestedException.php @@ -15,6 +15,7 @@ * @author Emmerson Siqueira * @author Henrique Moody * @author Ivan Zinovyev + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class KeyNestedException extends NestedValidationException implements NonOmissibleException { diff --git a/library/Exceptions/KeySetException.php b/library/Exceptions/KeySetException.php index c0d5cd7e3..99ae4fc81 100644 --- a/library/Exceptions/KeySetException.php +++ b/library/Exceptions/KeySetException.php @@ -13,6 +13,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class KeySetException extends GroupedValidationException implements NonOmissibleException { diff --git a/library/Exceptions/KeyValueException.php b/library/Exceptions/KeyValueException.php index fdbbe99fe..b2e94f4f5 100644 --- a/library/Exceptions/KeyValueException.php +++ b/library/Exceptions/KeyValueException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class KeyValueException extends ValidationException { diff --git a/library/Exceptions/LanguageCodeException.php b/library/Exceptions/LanguageCodeException.php index 45f8e544c..9a4e06aac 100644 --- a/library/Exceptions/LanguageCodeException.php +++ b/library/Exceptions/LanguageCodeException.php @@ -13,6 +13,7 @@ * @author Danilo Benevides * @author Emmerson Siqueira * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class LanguageCodeException extends ValidationException { diff --git a/library/Exceptions/LeapDateException.php b/library/Exceptions/LeapDateException.php index ee85a6c1c..9965e851c 100644 --- a/library/Exceptions/LeapDateException.php +++ b/library/Exceptions/LeapDateException.php @@ -12,6 +12,7 @@ /** * @author Danilo Benevides * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class LeapDateException extends ValidationException { diff --git a/library/Exceptions/LeapYearException.php b/library/Exceptions/LeapYearException.php index a15d6bbb1..f3263e1f3 100644 --- a/library/Exceptions/LeapYearException.php +++ b/library/Exceptions/LeapYearException.php @@ -12,6 +12,7 @@ /** * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class LeapYearException extends ValidationException { diff --git a/library/Exceptions/LengthException.php b/library/Exceptions/LengthException.php index 8621644f3..490cc5c67 100644 --- a/library/Exceptions/LengthException.php +++ b/library/Exceptions/LengthException.php @@ -14,6 +14,7 @@ * @author Danilo Correa * @author Henrique Moody * @author Mazen Touati + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class LengthException extends ValidationException { diff --git a/library/Exceptions/LessThanException.php b/library/Exceptions/LessThanException.php index 54a543101..054c82700 100644 --- a/library/Exceptions/LessThanException.php +++ b/library/Exceptions/LessThanException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class LessThanException extends ValidationException { diff --git a/library/Exceptions/LowercaseException.php b/library/Exceptions/LowercaseException.php index 70faa5aee..3b1cb8aed 100644 --- a/library/Exceptions/LowercaseException.php +++ b/library/Exceptions/LowercaseException.php @@ -13,6 +13,7 @@ * @author Danilo Benevides * @author Henrique Moody * @author Jean Pimentel + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class LowercaseException extends ValidationException { diff --git a/library/Exceptions/LuhnException.php b/library/Exceptions/LuhnException.php index a344f0d37..10bc59eae 100644 --- a/library/Exceptions/LuhnException.php +++ b/library/Exceptions/LuhnException.php @@ -13,6 +13,7 @@ * @author Alexander Gorshkov * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class LuhnException extends ValidationException { diff --git a/library/Exceptions/MacAddressException.php b/library/Exceptions/MacAddressException.php index 16ea23e0f..6a479c443 100644 --- a/library/Exceptions/MacAddressException.php +++ b/library/Exceptions/MacAddressException.php @@ -13,6 +13,7 @@ * @author Danilo Correa * @author Fábio da Silva Ribeiro * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class MacAddressException extends ValidationException { diff --git a/library/Exceptions/MaxAgeException.php b/library/Exceptions/MaxAgeException.php index 43f6a4b1a..17eadc603 100644 --- a/library/Exceptions/MaxAgeException.php +++ b/library/Exceptions/MaxAgeException.php @@ -12,6 +12,7 @@ /** * @author Emmerson Siqueira * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class MaxAgeException extends ValidationException { diff --git a/library/Exceptions/MaxException.php b/library/Exceptions/MaxException.php index cac3fe396..c2626f24e 100644 --- a/library/Exceptions/MaxException.php +++ b/library/Exceptions/MaxException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Andrew Peters * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class MaxException extends ValidationException { diff --git a/library/Exceptions/MimetypeException.php b/library/Exceptions/MimetypeException.php index 43f4c2f10..c628b0904 100644 --- a/library/Exceptions/MimetypeException.php +++ b/library/Exceptions/MimetypeException.php @@ -14,6 +14,7 @@ * * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class MimetypeException extends ValidationException { diff --git a/library/Exceptions/MinAgeException.php b/library/Exceptions/MinAgeException.php index d007eac9d..1a0743f18 100644 --- a/library/Exceptions/MinAgeException.php +++ b/library/Exceptions/MinAgeException.php @@ -13,6 +13,7 @@ * @author Emmerson Siqueira * @author Henrique Moody * @author Jean Pimentel + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class MinAgeException extends ValidationException { diff --git a/library/Exceptions/MinException.php b/library/Exceptions/MinException.php index b5fa65e54..be9d71fe2 100644 --- a/library/Exceptions/MinException.php +++ b/library/Exceptions/MinException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class MinException extends ValidationException { diff --git a/library/Exceptions/MultipleException.php b/library/Exceptions/MultipleException.php index 24322c370..b0b7453ad 100644 --- a/library/Exceptions/MultipleException.php +++ b/library/Exceptions/MultipleException.php @@ -13,6 +13,7 @@ * @author Danilo Benevides * @author Henrique Moody * @author Jean Pimentel + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class MultipleException extends ValidationException { diff --git a/library/Exceptions/NegativeException.php b/library/Exceptions/NegativeException.php index d6e5a8071..07a889a8d 100644 --- a/library/Exceptions/NegativeException.php +++ b/library/Exceptions/NegativeException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Henrique Moody * @author Ismael Elias + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NegativeException extends ValidationException { diff --git a/library/Exceptions/NfeAccessKeyException.php b/library/Exceptions/NfeAccessKeyException.php index b347ef62a..9d806dff4 100644 --- a/library/Exceptions/NfeAccessKeyException.php +++ b/library/Exceptions/NfeAccessKeyException.php @@ -13,6 +13,7 @@ * @author Andrey Knupp Vital * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NfeAccessKeyException extends ValidationException { diff --git a/library/Exceptions/NifException.php b/library/Exceptions/NifException.php index 7db04a58b..c12c8416e 100644 --- a/library/Exceptions/NifException.php +++ b/library/Exceptions/NifException.php @@ -12,6 +12,7 @@ /** * @author Henrique Moody * @author Julián Gutiérrez + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NifException extends ValidationException { diff --git a/library/Exceptions/NipException.php b/library/Exceptions/NipException.php index 5aa0d930e..896f548b5 100644 --- a/library/Exceptions/NipException.php +++ b/library/Exceptions/NipException.php @@ -12,6 +12,7 @@ /** * @author Henrique Moody * @author Tomasz Regdos + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NipException extends ValidationException { diff --git a/library/Exceptions/NoException.php b/library/Exceptions/NoException.php index 227b5a93e..09824373c 100644 --- a/library/Exceptions/NoException.php +++ b/library/Exceptions/NoException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NoException extends ValidationException { diff --git a/library/Exceptions/NoWhitespaceException.php b/library/Exceptions/NoWhitespaceException.php index dd128e5ad..500122a3c 100644 --- a/library/Exceptions/NoWhitespaceException.php +++ b/library/Exceptions/NoWhitespaceException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Danilo Benevides * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NoWhitespaceException extends ValidationException { diff --git a/library/Exceptions/NoneOfException.php b/library/Exceptions/NoneOfException.php index af8b3f601..48e875e5c 100644 --- a/library/Exceptions/NoneOfException.php +++ b/library/Exceptions/NoneOfException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NoneOfException extends NestedValidationException { diff --git a/library/Exceptions/NotBlankException.php b/library/Exceptions/NotBlankException.php index a320dea57..f6b411373 100644 --- a/library/Exceptions/NotBlankException.php +++ b/library/Exceptions/NotBlankException.php @@ -12,6 +12,7 @@ /** * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NotBlankException extends ValidationException { diff --git a/library/Exceptions/NotEmojiException.php b/library/Exceptions/NotEmojiException.php index a406acf4a..ebd599a1d 100644 --- a/library/Exceptions/NotEmojiException.php +++ b/library/Exceptions/NotEmojiException.php @@ -11,6 +11,7 @@ /** * @author Mazen Touati + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NotEmojiException extends ValidationException { diff --git a/library/Exceptions/NotEmptyException.php b/library/Exceptions/NotEmptyException.php index 50e67cd6e..7392786ee 100644 --- a/library/Exceptions/NotEmptyException.php +++ b/library/Exceptions/NotEmptyException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Bram Van der Sype * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NotEmptyException extends ValidationException { diff --git a/library/Exceptions/NotException.php b/library/Exceptions/NotException.php index 9763d8752..4444b1d28 100644 --- a/library/Exceptions/NotException.php +++ b/library/Exceptions/NotException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NotException extends GroupedValidationException { diff --git a/library/Exceptions/NotOptionalException.php b/library/Exceptions/NotOptionalException.php index 0b18bf484..3ddd33aed 100644 --- a/library/Exceptions/NotOptionalException.php +++ b/library/Exceptions/NotOptionalException.php @@ -12,6 +12,7 @@ /** * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NotOptionalException extends ValidationException { diff --git a/library/Exceptions/NullTypeException.php b/library/Exceptions/NullTypeException.php index 8c163c7b3..af07f5f38 100644 --- a/library/Exceptions/NullTypeException.php +++ b/library/Exceptions/NullTypeException.php @@ -14,6 +14,7 @@ * * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NullTypeException extends ValidationException { diff --git a/library/Exceptions/NullableException.php b/library/Exceptions/NullableException.php index 6d790b50c..5784e1815 100644 --- a/library/Exceptions/NullableException.php +++ b/library/Exceptions/NullableException.php @@ -12,6 +12,7 @@ /** * @author Henrique Moody * @author Jens Segers + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NullableException extends ValidationException { diff --git a/library/Exceptions/NumberException.php b/library/Exceptions/NumberException.php index a978a6275..56d0e26ad 100644 --- a/library/Exceptions/NumberException.php +++ b/library/Exceptions/NumberException.php @@ -13,6 +13,7 @@ * @author Henrique Moody * @author Ismael Elias * @author Vitaliy + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NumberException extends ValidationException { diff --git a/library/Exceptions/NumericValException.php b/library/Exceptions/NumericValException.php index dfcee99ba..88cd7e06d 100644 --- a/library/Exceptions/NumericValException.php +++ b/library/Exceptions/NumericValException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class NumericValException extends ValidationException { diff --git a/library/Exceptions/ObjectTypeException.php b/library/Exceptions/ObjectTypeException.php index d31b3f445..df46187cb 100644 --- a/library/Exceptions/ObjectTypeException.php +++ b/library/Exceptions/ObjectTypeException.php @@ -14,6 +14,7 @@ * * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ObjectTypeException extends ValidationException { diff --git a/library/Exceptions/OddException.php b/library/Exceptions/OddException.php index 44b3ce8c8..e5bb7cf58 100644 --- a/library/Exceptions/OddException.php +++ b/library/Exceptions/OddException.php @@ -13,6 +13,7 @@ * @author Danilo Benevides * @author Henrique Moody * @author Jean Pimentel + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class OddException extends ValidationException { diff --git a/library/Exceptions/OneOfException.php b/library/Exceptions/OneOfException.php index cb089a727..f315d16c2 100644 --- a/library/Exceptions/OneOfException.php +++ b/library/Exceptions/OneOfException.php @@ -12,6 +12,7 @@ /** * @author Bradyn Poulsen * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class OneOfException extends NestedValidationException { diff --git a/library/Exceptions/OptionalException.php b/library/Exceptions/OptionalException.php index 6251fbc5a..b7d9cc7aa 100644 --- a/library/Exceptions/OptionalException.php +++ b/library/Exceptions/OptionalException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class OptionalException extends ValidationException { diff --git a/library/Exceptions/PerfectSquareException.php b/library/Exceptions/PerfectSquareException.php index 64b369422..a3019cb67 100644 --- a/library/Exceptions/PerfectSquareException.php +++ b/library/Exceptions/PerfectSquareException.php @@ -13,6 +13,7 @@ * @author Danilo Benevides * @author Henrique Moody * @author Kleber Hamada Sato + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class PerfectSquareException extends ValidationException { diff --git a/library/Exceptions/PeselException.php b/library/Exceptions/PeselException.php index e2553305f..dd62be402 100644 --- a/library/Exceptions/PeselException.php +++ b/library/Exceptions/PeselException.php @@ -13,6 +13,7 @@ * @author Danilo Correa * @author Henrique Moody * @author Tomasz Regdos + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class PeselException extends ValidationException { diff --git a/library/Exceptions/PhoneException.php b/library/Exceptions/PhoneException.php index ea708452c..2e942b616 100644 --- a/library/Exceptions/PhoneException.php +++ b/library/Exceptions/PhoneException.php @@ -15,6 +15,7 @@ * @author Danilo Correa * @author Henrique Moody * @author Michael Firsikov + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class PhoneException extends ValidationException { diff --git a/library/Exceptions/PhpLabelException.php b/library/Exceptions/PhpLabelException.php index 58eaa38c9..948957f69 100644 --- a/library/Exceptions/PhpLabelException.php +++ b/library/Exceptions/PhpLabelException.php @@ -13,6 +13,7 @@ * @author Danilo Correa * @author Emmerson Siqueira * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class PhpLabelException extends ValidationException { diff --git a/library/Exceptions/PisException.php b/library/Exceptions/PisException.php index 60d2d1669..f7173ce63 100644 --- a/library/Exceptions/PisException.php +++ b/library/Exceptions/PisException.php @@ -13,6 +13,7 @@ * @author Bruno Koga * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class PisException extends ValidationException { diff --git a/library/Exceptions/PolishIdCardException.php b/library/Exceptions/PolishIdCardException.php index be67234b0..f7aa71da4 100644 --- a/library/Exceptions/PolishIdCardException.php +++ b/library/Exceptions/PolishIdCardException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class PolishIdCardException extends ValidationException { diff --git a/library/Exceptions/PortugueseNifException.php b/library/Exceptions/PortugueseNifException.php index d3b991da6..74b085722 100644 --- a/library/Exceptions/PortugueseNifException.php +++ b/library/Exceptions/PortugueseNifException.php @@ -11,6 +11,7 @@ /** * @author Gonçalo Andrade + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class PortugueseNifException extends ValidationException { diff --git a/library/Exceptions/PositiveException.php b/library/Exceptions/PositiveException.php index ea6175ba9..6004bbdf9 100644 --- a/library/Exceptions/PositiveException.php +++ b/library/Exceptions/PositiveException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Henrique Moody * @author Ismael Elias + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class PositiveException extends ValidationException { diff --git a/library/Exceptions/PostalCodeException.php b/library/Exceptions/PostalCodeException.php index 2e1f943f1..53b47a242 100644 --- a/library/Exceptions/PostalCodeException.php +++ b/library/Exceptions/PostalCodeException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class PostalCodeException extends ValidationException { diff --git a/library/Exceptions/PrimeNumberException.php b/library/Exceptions/PrimeNumberException.php index df91845f9..2ce111f62 100644 --- a/library/Exceptions/PrimeNumberException.php +++ b/library/Exceptions/PrimeNumberException.php @@ -13,6 +13,7 @@ * @author Henrique Moody * @author Ismael Elias * @author Kleber Hamada Sato + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class PrimeNumberException extends ValidationException { diff --git a/library/Exceptions/PrintableException.php b/library/Exceptions/PrintableException.php index 7563b6209..e139ecdd5 100644 --- a/library/Exceptions/PrintableException.php +++ b/library/Exceptions/PrintableException.php @@ -16,6 +16,7 @@ * @author Andre Ramaciotti * @author Emmerson Siqueira * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class PrintableException extends FilteredValidationException { diff --git a/library/Exceptions/PunctException.php b/library/Exceptions/PunctException.php index 48304eed8..7eb55d805 100644 --- a/library/Exceptions/PunctException.php +++ b/library/Exceptions/PunctException.php @@ -13,6 +13,7 @@ * @author Andre Ramaciotti * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class PunctException extends FilteredValidationException { diff --git a/library/Exceptions/ReadableException.php b/library/Exceptions/ReadableException.php index ce1c568c4..afa020659 100644 --- a/library/Exceptions/ReadableException.php +++ b/library/Exceptions/ReadableException.php @@ -12,6 +12,7 @@ /** * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ReadableException extends ValidationException { diff --git a/library/Exceptions/RegexException.php b/library/Exceptions/RegexException.php index 2b425e990..93786e388 100644 --- a/library/Exceptions/RegexException.php +++ b/library/Exceptions/RegexException.php @@ -13,6 +13,7 @@ * @author Alexandre Gomes Gaigalas * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class RegexException extends ValidationException { diff --git a/library/Exceptions/ResourceTypeException.php b/library/Exceptions/ResourceTypeException.php index 458e8403c..f05de9b2b 100644 --- a/library/Exceptions/ResourceTypeException.php +++ b/library/Exceptions/ResourceTypeException.php @@ -13,6 +13,7 @@ * Exception class for ResourceType. * * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ResourceTypeException extends ValidationException { diff --git a/library/Exceptions/RomanException.php b/library/Exceptions/RomanException.php index 8fe333ee9..18dc88600 100644 --- a/library/Exceptions/RomanException.php +++ b/library/Exceptions/RomanException.php @@ -12,6 +12,7 @@ /** * @author Henrique Moody * @author Jean Pimentel + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class RomanException extends ValidationException { diff --git a/library/Exceptions/ScalarValException.php b/library/Exceptions/ScalarValException.php index 35ca1b8e8..b4b463ded 100644 --- a/library/Exceptions/ScalarValException.php +++ b/library/Exceptions/ScalarValException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ScalarValException extends ValidationException { diff --git a/library/Exceptions/SizeException.php b/library/Exceptions/SizeException.php index 5aa7a1e11..6e2c36a27 100644 --- a/library/Exceptions/SizeException.php +++ b/library/Exceptions/SizeException.php @@ -13,6 +13,7 @@ * Exception class for Size rule. * * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class SizeException extends NestedValidationException { diff --git a/library/Exceptions/SlugException.php b/library/Exceptions/SlugException.php index 9395b2527..20708def8 100644 --- a/library/Exceptions/SlugException.php +++ b/library/Exceptions/SlugException.php @@ -13,6 +13,7 @@ * @author Carlos André Ferrari * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class SlugException extends ValidationException { diff --git a/library/Exceptions/SortedException.php b/library/Exceptions/SortedException.php index 64b041cba..c173a5ff4 100644 --- a/library/Exceptions/SortedException.php +++ b/library/Exceptions/SortedException.php @@ -14,6 +14,7 @@ /** * @author Henrique Moody * @author Mikhail Vyrtsev + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class SortedException extends ValidationException { diff --git a/library/Exceptions/SpaceException.php b/library/Exceptions/SpaceException.php index afd477dfe..9eb5ffba8 100644 --- a/library/Exceptions/SpaceException.php +++ b/library/Exceptions/SpaceException.php @@ -12,6 +12,7 @@ /** * @author Andre Ramaciotti * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class SpaceException extends FilteredValidationException { diff --git a/library/Exceptions/StartsWithException.php b/library/Exceptions/StartsWithException.php index f1607993f..f21ce9bf2 100644 --- a/library/Exceptions/StartsWithException.php +++ b/library/Exceptions/StartsWithException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class StartsWithException extends ValidationException { diff --git a/library/Exceptions/StringTypeException.php b/library/Exceptions/StringTypeException.php index f52514ef8..0620acedb 100644 --- a/library/Exceptions/StringTypeException.php +++ b/library/Exceptions/StringTypeException.php @@ -12,6 +12,7 @@ /** * @author Alexandre Gomes Gaigalas * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class StringTypeException extends ValidationException { diff --git a/library/Exceptions/StringValException.php b/library/Exceptions/StringValException.php index 6ad750e50..50899c4d4 100644 --- a/library/Exceptions/StringValException.php +++ b/library/Exceptions/StringValException.php @@ -12,6 +12,7 @@ /** * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class StringValException extends ValidationException { diff --git a/library/Exceptions/SubsetException.php b/library/Exceptions/SubsetException.php index 3857f68d9..54a9e2beb 100644 --- a/library/Exceptions/SubsetException.php +++ b/library/Exceptions/SubsetException.php @@ -12,6 +12,7 @@ /** * @author Henrique Moody * @author Singwai Chan + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class SubsetException extends ValidationException { diff --git a/library/Exceptions/SymbolicLinkException.php b/library/Exceptions/SymbolicLinkException.php index 63ba223f3..e927937cb 100644 --- a/library/Exceptions/SymbolicLinkException.php +++ b/library/Exceptions/SymbolicLinkException.php @@ -12,6 +12,7 @@ /** * @author Gus Antoniassi * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class SymbolicLinkException extends ValidationException { diff --git a/library/Exceptions/TimeException.php b/library/Exceptions/TimeException.php index db5ae5596..cb3296772 100644 --- a/library/Exceptions/TimeException.php +++ b/library/Exceptions/TimeException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class TimeException extends ValidationException { diff --git a/library/Exceptions/TldException.php b/library/Exceptions/TldException.php index 34b098bae..93e9d62c2 100644 --- a/library/Exceptions/TldException.php +++ b/library/Exceptions/TldException.php @@ -16,6 +16,7 @@ * @author Henrique Moody * @author Nick Lombard * @author Paul Karikari + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class TldException extends ValidationException { diff --git a/library/Exceptions/TrueValException.php b/library/Exceptions/TrueValException.php index f0a4fe2a1..edb034588 100644 --- a/library/Exceptions/TrueValException.php +++ b/library/Exceptions/TrueValException.php @@ -14,6 +14,7 @@ * * @author Henrique Moody * @author Paul Karikari + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class TrueValException extends ValidationException { diff --git a/library/Exceptions/TypeException.php b/library/Exceptions/TypeException.php index d9238433a..862f52df2 100644 --- a/library/Exceptions/TypeException.php +++ b/library/Exceptions/TypeException.php @@ -14,6 +14,7 @@ * * @author Henrique Moody * @author Paul Karikari + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class TypeException extends ValidationException { diff --git a/library/Exceptions/UniqueException.php b/library/Exceptions/UniqueException.php index 87e43af97..e87632133 100644 --- a/library/Exceptions/UniqueException.php +++ b/library/Exceptions/UniqueException.php @@ -15,6 +15,7 @@ * @author Henrique Moody * @author Krzysztof Śmiałek * @author Paul Karikari + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class UniqueException extends ValidationException { diff --git a/library/Exceptions/UploadedException.php b/library/Exceptions/UploadedException.php index afed96b1e..923fc4a7c 100644 --- a/library/Exceptions/UploadedException.php +++ b/library/Exceptions/UploadedException.php @@ -15,6 +15,7 @@ * @author Fajar Khairil * @author Henrique Moody * @author Paul Karikari + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class UploadedException extends ValidationException { diff --git a/library/Exceptions/UppercaseException.php b/library/Exceptions/UppercaseException.php index 839660126..fe8f00763 100644 --- a/library/Exceptions/UppercaseException.php +++ b/library/Exceptions/UppercaseException.php @@ -13,6 +13,7 @@ * @author Danilo Benevides * @author Henrique Moody * @author Jean Pimentel + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class UppercaseException extends ValidationException { diff --git a/library/Exceptions/UrlException.php b/library/Exceptions/UrlException.php index 3e300e0ac..a25461729 100644 --- a/library/Exceptions/UrlException.php +++ b/library/Exceptions/UrlException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class UrlException extends ValidationException { diff --git a/library/Exceptions/UuidException.php b/library/Exceptions/UuidException.php index a8f7c148c..28626d8f8 100644 --- a/library/Exceptions/UuidException.php +++ b/library/Exceptions/UuidException.php @@ -13,6 +13,7 @@ * @author Dick van der Heiden * @author Henrique Moody * @author Michael Weimann + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class UuidException extends ValidationException { diff --git a/library/Exceptions/ValidatorException.php b/library/Exceptions/ValidatorException.php index 7a27c397c..ac2e939e2 100644 --- a/library/Exceptions/ValidatorException.php +++ b/library/Exceptions/ValidatorException.php @@ -11,6 +11,7 @@ /** * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class ValidatorException extends AllOfException { diff --git a/library/Exceptions/VersionException.php b/library/Exceptions/VersionException.php index e5ae5418e..846556b7c 100644 --- a/library/Exceptions/VersionException.php +++ b/library/Exceptions/VersionException.php @@ -12,6 +12,7 @@ /** * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class VersionException extends ValidationException { diff --git a/library/Exceptions/VideoUrlException.php b/library/Exceptions/VideoUrlException.php index 6e044a69a..67adb1a98 100644 --- a/library/Exceptions/VideoUrlException.php +++ b/library/Exceptions/VideoUrlException.php @@ -13,6 +13,7 @@ * @author Danilo Correa * @author Henrique Moody * @author Ricardo Gobbo + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class VideoUrlException extends ValidationException { diff --git a/library/Exceptions/VowelException.php b/library/Exceptions/VowelException.php index c88f3a5c0..ab829b5d7 100644 --- a/library/Exceptions/VowelException.php +++ b/library/Exceptions/VowelException.php @@ -12,6 +12,7 @@ /** * @author Henrique Moody * @author Kleber Hamada Sato + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class VowelException extends FilteredValidationException { diff --git a/library/Exceptions/WhenException.php b/library/Exceptions/WhenException.php index 76d1812a7..b774f8c8b 100644 --- a/library/Exceptions/WhenException.php +++ b/library/Exceptions/WhenException.php @@ -13,6 +13,7 @@ * @author Antonio Spinelli * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class WhenException extends ValidationException { diff --git a/library/Exceptions/WritableException.php b/library/Exceptions/WritableException.php index b304dc097..be1f186ad 100644 --- a/library/Exceptions/WritableException.php +++ b/library/Exceptions/WritableException.php @@ -12,6 +12,7 @@ /** * @author Danilo Correa * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class WritableException extends ValidationException { diff --git a/library/Exceptions/XdigitException.php b/library/Exceptions/XdigitException.php index ef6d13b63..ca932c28c 100644 --- a/library/Exceptions/XdigitException.php +++ b/library/Exceptions/XdigitException.php @@ -12,6 +12,7 @@ /** * @author Andre Ramaciotti * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class XdigitException extends FilteredValidationException { diff --git a/library/Exceptions/YesException.php b/library/Exceptions/YesException.php index 7df71f097..5adaf51a2 100644 --- a/library/Exceptions/YesException.php +++ b/library/Exceptions/YesException.php @@ -12,6 +12,7 @@ /** * @author Cameron Hall * @author Henrique Moody + * @deprecated Using rule exceptions directly is deprecated, and will be removed in the next major version. Please use {@see ValidationException} instead. */ final class YesException extends ValidationException { diff --git a/library/Rules/AbstractAge.php b/library/Rules/AbstractAge.php index d8a788691..778da0f33 100644 --- a/library/Rules/AbstractAge.php +++ b/library/Rules/AbstractAge.php @@ -59,7 +59,7 @@ public function __construct(int $age, ?string $format = null) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AbstractComparison.php b/library/Rules/AbstractComparison.php index c65deb901..beec5ea33 100644 --- a/library/Rules/AbstractComparison.php +++ b/library/Rules/AbstractComparison.php @@ -44,7 +44,7 @@ public function __construct($maxValue) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AbstractComposite.php b/library/Rules/AbstractComposite.php index fd9c30177..1eca00f7b 100644 --- a/library/Rules/AbstractComposite.php +++ b/library/Rules/AbstractComposite.php @@ -39,7 +39,7 @@ public function __construct(Validatable ...$rules) } /** - * {@inheritDoc} + * @deprecated Calling `setName()` directly from rules is deprecated. Please use {@see Validator::setName()} instead. */ public function setName(string $name): Validatable { diff --git a/library/Rules/AbstractEnvelope.php b/library/Rules/AbstractEnvelope.php index 650e48e67..1cdd365ff 100644 --- a/library/Rules/AbstractEnvelope.php +++ b/library/Rules/AbstractEnvelope.php @@ -44,7 +44,7 @@ public function __construct(Validatable $validatable, array $parameters = []) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AbstractFilterRule.php b/library/Rules/AbstractFilterRule.php index 2c658a0be..4b4867822 100644 --- a/library/Rules/AbstractFilterRule.php +++ b/library/Rules/AbstractFilterRule.php @@ -36,7 +36,7 @@ public function __construct(string ...$additionalChars) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AbstractRelated.php b/library/Rules/AbstractRelated.php index 876755253..ad4918c23 100644 --- a/library/Rules/AbstractRelated.php +++ b/library/Rules/AbstractRelated.php @@ -80,7 +80,7 @@ public function isMandatory(): bool } /** - * {@inheritDoc} + * @deprecated Calling `setName()` directly from rules is deprecated. Please use {@see Validator::setName()} instead. */ public function setName(string $name): Validatable { @@ -94,7 +94,7 @@ public function setName(string $name): Validatable } /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -119,7 +119,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { @@ -136,7 +136,7 @@ public function check($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AbstractRule.php b/library/Rules/AbstractRule.php index cb31c597a..0b09f8545 100644 --- a/library/Rules/AbstractRule.php +++ b/library/Rules/AbstractRule.php @@ -18,6 +18,8 @@ * @author Henrique Moody * @author Nick Lombard * @author Vicente Mendoza + * + * @deprecated This class is deprecated, and will be removed in the next major version. Use {@see Simple} instead. */ abstract class AbstractRule implements Validatable { @@ -32,7 +34,7 @@ abstract class AbstractRule implements Validatable protected $template; /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -44,7 +46,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { @@ -52,7 +54,7 @@ public function check($input): void } /** - * {@inheritDoc} + * @deprecated Calling `getName()` directly from rules is deprecated. Please use {@see Validator::getName()} instead. */ public function getName(): ?string { @@ -60,7 +62,8 @@ public function getName(): ?string } /** - * {@inheritDoc} + * @param mixed[] $extraParams + * @deprecated Calling `reportError()` directly is deprecated, and will be removed in the next major version. */ public function reportError($input, array $extraParams = []): ValidationException { @@ -68,7 +71,7 @@ public function reportError($input, array $extraParams = []): ValidationExceptio } /** - * {@inheritDoc} + * @deprecated Calling `setName()` directly from rules is deprecated. Please use {@see Validator::setName()} instead. */ public function setName(string $name): Validatable { @@ -78,7 +81,7 @@ public function setName(string $name): Validatable } /** - * {@inheritDoc} + * @deprecated Calling `setTemplate()` directly from rules is deprecated. Please use {@see Validator::setTemplate()} instead. */ public function setTemplate(string $template): Validatable { @@ -88,7 +91,8 @@ public function setTemplate(string $template): Validatable } /** - * @param mixed$input + * @deprecated Calling validator as a function is deprecated, and will be removed in the next major version. + * @param mixed $input */ public function __invoke($input): bool { diff --git a/library/Rules/AbstractSearcher.php b/library/Rules/AbstractSearcher.php index b749bb381..73d80b395 100644 --- a/library/Rules/AbstractSearcher.php +++ b/library/Rules/AbstractSearcher.php @@ -30,7 +30,7 @@ abstract class AbstractSearcher extends AbstractRule abstract protected function getDataSource($input = null): array; /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AbstractWrapper.php b/library/Rules/AbstractWrapper.php index 75a5738f9..bc89af295 100644 --- a/library/Rules/AbstractWrapper.php +++ b/library/Rules/AbstractWrapper.php @@ -33,7 +33,7 @@ public function __construct(Validatable $validatable) } /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -41,7 +41,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { @@ -49,7 +49,7 @@ public function check($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { @@ -57,7 +57,7 @@ public function validate($input): bool } /** - * {@inheritDoc} + * @deprecated Calling `setName()` directly from rules is deprecated. Please use {@see Validator::setName()} instead. */ public function setName(string $name): Validatable { diff --git a/library/Rules/AllOf.php b/library/Rules/AllOf.php index ebbc42ca3..1303be8d7 100644 --- a/library/Rules/AllOf.php +++ b/library/Rules/AllOf.php @@ -20,7 +20,7 @@ class AllOf extends AbstractComposite { /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -42,7 +42,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { @@ -52,7 +52,7 @@ public function check($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AlwaysInvalid.php b/library/Rules/AlwaysInvalid.php index b3eb7738b..b84479503 100644 --- a/library/Rules/AlwaysInvalid.php +++ b/library/Rules/AlwaysInvalid.php @@ -19,7 +19,7 @@ final class AlwaysInvalid extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AlwaysValid.php b/library/Rules/AlwaysValid.php index c8a821286..3fafa654d 100644 --- a/library/Rules/AlwaysValid.php +++ b/library/Rules/AlwaysValid.php @@ -19,7 +19,7 @@ final class AlwaysValid extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AnyOf.php b/library/Rules/AnyOf.php index ddf213c2e..425cf07af 100644 --- a/library/Rules/AnyOf.php +++ b/library/Rules/AnyOf.php @@ -21,7 +21,7 @@ final class AnyOf extends AbstractComposite { /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -39,7 +39,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { @@ -53,7 +53,7 @@ public function validate($input): bool } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { diff --git a/library/Rules/ArrayType.php b/library/Rules/ArrayType.php index cbfe7d9f7..7cf9300c1 100644 --- a/library/Rules/ArrayType.php +++ b/library/Rules/ArrayType.php @@ -22,7 +22,7 @@ final class ArrayType extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/ArrayVal.php b/library/Rules/ArrayVal.php index 53bd4e84e..24d71d102 100644 --- a/library/Rules/ArrayVal.php +++ b/library/Rules/ArrayVal.php @@ -26,7 +26,7 @@ final class ArrayVal extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Base.php b/library/Rules/Base.php index 03f6d77b3..015da7ca3 100644 --- a/library/Rules/Base.php +++ b/library/Rules/Base.php @@ -53,7 +53,7 @@ public function __construct(int $base, ?string $chars = null) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Base64.php b/library/Rules/Base64.php index 11a070704..66e3d601e 100644 --- a/library/Rules/Base64.php +++ b/library/Rules/Base64.php @@ -23,7 +23,7 @@ final class Base64 extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/BoolType.php b/library/Rules/BoolType.php index 0f32be573..7ba2cdabd 100644 --- a/library/Rules/BoolType.php +++ b/library/Rules/BoolType.php @@ -20,7 +20,7 @@ final class BoolType extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/BoolVal.php b/library/Rules/BoolVal.php index b9cef6990..887a4a0fc 100644 --- a/library/Rules/BoolVal.php +++ b/library/Rules/BoolVal.php @@ -25,7 +25,7 @@ final class BoolVal extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Bsn.php b/library/Rules/Bsn.php index a5cb5125c..da7167df4 100644 --- a/library/Rules/Bsn.php +++ b/library/Rules/Bsn.php @@ -27,7 +27,7 @@ final class Bsn extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Call.php b/library/Rules/Call.php index 940323909..a83ef7c41 100644 --- a/library/Rules/Call.php +++ b/library/Rules/Call.php @@ -46,7 +46,7 @@ public function __construct(callable $callable, Validatable $rule) } /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -64,7 +64,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { @@ -82,7 +82,7 @@ public function check($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/CallableType.php b/library/Rules/CallableType.php index 0fa9eb12f..e6db91211 100644 --- a/library/Rules/CallableType.php +++ b/library/Rules/CallableType.php @@ -19,7 +19,7 @@ final class CallableType extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Callback.php b/library/Rules/Callback.php index 3c057a256..a3bbe2b7b 100644 --- a/library/Rules/Callback.php +++ b/library/Rules/Callback.php @@ -44,7 +44,7 @@ public function __construct(callable $callback, ...$arguments) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Charset.php b/library/Rules/Charset.php index 00640e206..cfbee36d3 100644 --- a/library/Rules/Charset.php +++ b/library/Rules/Charset.php @@ -46,7 +46,7 @@ public function __construct(string ...$charset) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Cnh.php b/library/Rules/Cnh.php index 4b180fd63..4cb8e59b0 100644 --- a/library/Rules/Cnh.php +++ b/library/Rules/Cnh.php @@ -24,7 +24,7 @@ final class Cnh extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Cnpj.php b/library/Rules/Cnpj.php index 78081f24f..84073fa95 100644 --- a/library/Rules/Cnpj.php +++ b/library/Rules/Cnpj.php @@ -29,7 +29,7 @@ final class Cnpj extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Contains.php b/library/Rules/Contains.php index 0a92b9297..0496939b3 100644 --- a/library/Rules/Contains.php +++ b/library/Rules/Contains.php @@ -48,7 +48,7 @@ public function __construct($containsValue, bool $identical = false) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Core/Simple.php b/library/Rules/Core/Simple.php new file mode 100644 index 000000000..7dcd9268d --- /dev/null +++ b/library/Rules/Core/Simple.php @@ -0,0 +1,28 @@ + + * SPDX-License-Identifier: MIT + */ + +declare(strict_types=1); + +namespace Respect\Validation\Rules\Core; + +use Respect\Validation\Rules\AbstractRule; + +abstract class Simple extends AbstractRule +{ + public function isValid(mixed $input): bool + { + return true; + } + + /** + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. + */ + public function validate($input): bool + { + return $this->isValid($input); + } +} diff --git a/library/Rules/Countable.php b/library/Rules/Countable.php index 8f2d8d6b1..6b1b269f3 100644 --- a/library/Rules/Countable.php +++ b/library/Rules/Countable.php @@ -23,7 +23,7 @@ final class Countable extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Cpf.php b/library/Rules/Cpf.php index 62f75037e..b300bbb42 100644 --- a/library/Rules/Cpf.php +++ b/library/Rules/Cpf.php @@ -27,7 +27,7 @@ final class Cpf extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/CreditCard.php b/library/Rules/CreditCard.php index 3008497f0..30ad8399a 100644 --- a/library/Rules/CreditCard.php +++ b/library/Rules/CreditCard.php @@ -84,7 +84,7 @@ public function __construct(string $brand = self::ANY) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Date.php b/library/Rules/Date.php index d39a75818..982cd61b2 100644 --- a/library/Rules/Date.php +++ b/library/Rules/Date.php @@ -54,7 +54,7 @@ public function __construct(string $format = 'Y-m-d') } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/DateTime.php b/library/Rules/DateTime.php index cc1e6d2c3..1dc805d51 100644 --- a/library/Rules/DateTime.php +++ b/library/Rules/DateTime.php @@ -45,7 +45,7 @@ public function __construct(?string $format = null) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Decimal.php b/library/Rules/Decimal.php index 49161ea4a..1b9750a5c 100644 --- a/library/Rules/Decimal.php +++ b/library/Rules/Decimal.php @@ -33,7 +33,7 @@ public function __construct(int $decimals) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Directory.php b/library/Rules/Directory.php index 70bd3d237..3c57d577a 100644 --- a/library/Rules/Directory.php +++ b/library/Rules/Directory.php @@ -24,7 +24,7 @@ final class Directory extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Domain.php b/library/Rules/Domain.php index a73191670..2619704fc 100644 --- a/library/Rules/Domain.php +++ b/library/Rules/Domain.php @@ -55,7 +55,7 @@ public function __construct(bool $tldCheck = true) } /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -77,7 +77,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { @@ -91,7 +91,7 @@ public function validate($input): bool } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { diff --git a/library/Rules/Each.php b/library/Rules/Each.php index 2da5fe188..ac4bddd4f 100644 --- a/library/Rules/Each.php +++ b/library/Rules/Each.php @@ -40,7 +40,7 @@ public function __construct(Validatable $rule) } /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -67,7 +67,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { @@ -81,7 +81,7 @@ public function check($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Email.php b/library/Rules/Email.php index f638cb35d..3d46a975d 100644 --- a/library/Rules/Email.php +++ b/library/Rules/Email.php @@ -44,7 +44,7 @@ public function __construct(?EmailValidator $validator = null) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/EndsWith.php b/library/Rules/EndsWith.php index 790db183e..ff9ee6744 100644 --- a/library/Rules/EndsWith.php +++ b/library/Rules/EndsWith.php @@ -45,7 +45,7 @@ public function __construct($endValue, bool $identical = false) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Equals.php b/library/Rules/Equals.php index 012984b60..1cc21df6f 100644 --- a/library/Rules/Equals.php +++ b/library/Rules/Equals.php @@ -34,7 +34,7 @@ public function __construct($compareTo) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Equivalent.php b/library/Rules/Equivalent.php index 3945f1c0b..7d800960f 100644 --- a/library/Rules/Equivalent.php +++ b/library/Rules/Equivalent.php @@ -35,7 +35,7 @@ public function __construct($compareTo) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Even.php b/library/Rules/Even.php index b21268eca..eb5283446 100644 --- a/library/Rules/Even.php +++ b/library/Rules/Even.php @@ -23,7 +23,7 @@ final class Even extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Executable.php b/library/Rules/Executable.php index a1f2ce2a3..17438f6dc 100644 --- a/library/Rules/Executable.php +++ b/library/Rules/Executable.php @@ -23,7 +23,7 @@ final class Executable extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Exists.php b/library/Rules/Exists.php index c1bff939d..886be2606 100644 --- a/library/Rules/Exists.php +++ b/library/Rules/Exists.php @@ -21,7 +21,7 @@ final class Exists extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Extension.php b/library/Rules/Extension.php index ed2a9a48c..8101305d8 100644 --- a/library/Rules/Extension.php +++ b/library/Rules/Extension.php @@ -38,7 +38,7 @@ public function __construct(string $extension) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Factor.php b/library/Rules/Factor.php index 170f99a61..f2557469b 100644 --- a/library/Rules/Factor.php +++ b/library/Rules/Factor.php @@ -36,7 +36,7 @@ public function __construct(int $dividend) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/FalseVal.php b/library/Rules/FalseVal.php index aba23d5ea..ec4a22a18 100644 --- a/library/Rules/FalseVal.php +++ b/library/Rules/FalseVal.php @@ -23,7 +23,7 @@ final class FalseVal extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Fibonacci.php b/library/Rules/Fibonacci.php index c48476da3..75f29f0b4 100644 --- a/library/Rules/Fibonacci.php +++ b/library/Rules/Fibonacci.php @@ -21,7 +21,7 @@ final class Fibonacci extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/File.php b/library/Rules/File.php index fcf8a7c1a..55edc3e91 100644 --- a/library/Rules/File.php +++ b/library/Rules/File.php @@ -23,7 +23,7 @@ final class File extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Finite.php b/library/Rules/Finite.php index 26f77544f..e6b0cde71 100644 --- a/library/Rules/Finite.php +++ b/library/Rules/Finite.php @@ -21,7 +21,7 @@ final class Finite extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/FloatType.php b/library/Rules/FloatType.php index 70d49644c..7fad668f0 100644 --- a/library/Rules/FloatType.php +++ b/library/Rules/FloatType.php @@ -20,7 +20,7 @@ final class FloatType extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/FloatVal.php b/library/Rules/FloatVal.php index 2b7c55b79..6f94043cb 100644 --- a/library/Rules/FloatVal.php +++ b/library/Rules/FloatVal.php @@ -25,7 +25,7 @@ final class FloatVal extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Iban.php b/library/Rules/Iban.php index 89484f4a7..fef7f696d 100644 --- a/library/Rules/Iban.php +++ b/library/Rules/Iban.php @@ -102,7 +102,7 @@ final class Iban extends AbstractRule ]; /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Identical.php b/library/Rules/Identical.php index 02ee01cd4..0eed393c3 100644 --- a/library/Rules/Identical.php +++ b/library/Rules/Identical.php @@ -32,7 +32,7 @@ public function __construct($compareTo) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Image.php b/library/Rules/Image.php index 619d8c2a9..e163df757 100644 --- a/library/Rules/Image.php +++ b/library/Rules/Image.php @@ -41,7 +41,7 @@ public function __construct(?finfo $fileInfo = null) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Imei.php b/library/Rules/Imei.php index 130e5c768..8c091beb0 100644 --- a/library/Rules/Imei.php +++ b/library/Rules/Imei.php @@ -27,8 +27,7 @@ final class Imei extends AbstractRule /** * @see https://en.wikipedia.org/wiki/International_Mobile_Station_Equipment_Identity - * - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/In.php b/library/Rules/In.php index f7374489b..10e31ea9e 100644 --- a/library/Rules/In.php +++ b/library/Rules/In.php @@ -45,7 +45,7 @@ public function __construct($haystack, bool $compareIdentical = false) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Infinite.php b/library/Rules/Infinite.php index 55c4706f5..cca1eb860 100644 --- a/library/Rules/Infinite.php +++ b/library/Rules/Infinite.php @@ -21,7 +21,7 @@ final class Infinite extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Instance.php b/library/Rules/Instance.php index d7a6744dc..dbb233b5f 100644 --- a/library/Rules/Instance.php +++ b/library/Rules/Instance.php @@ -32,7 +32,7 @@ public function __construct(string $instanceName) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/IntType.php b/library/Rules/IntType.php index 561dc438e..6f7cf6235 100644 --- a/library/Rules/IntType.php +++ b/library/Rules/IntType.php @@ -19,7 +19,7 @@ final class IntType extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/IntVal.php b/library/Rules/IntVal.php index d147a4411..d2252913a 100644 --- a/library/Rules/IntVal.php +++ b/library/Rules/IntVal.php @@ -25,7 +25,7 @@ final class IntVal extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Ip.php b/library/Rules/Ip.php index a72553339..393079748 100644 --- a/library/Rules/Ip.php +++ b/library/Rules/Ip.php @@ -76,7 +76,7 @@ public function __construct(string $range = '*', ?int $options = null) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Isbn.php b/library/Rules/Isbn.php index 4c0dd14b3..5e7711e01 100644 --- a/library/Rules/Isbn.php +++ b/library/Rules/Isbn.php @@ -32,7 +32,7 @@ final class Isbn extends AbstractRule ]; /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/IterableType.php b/library/Rules/IterableType.php index 92bd300d1..db593f504 100644 --- a/library/Rules/IterableType.php +++ b/library/Rules/IterableType.php @@ -21,7 +21,7 @@ final class IterableType extends AbstractRule use CanValidateIterable; /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Json.php b/library/Rules/Json.php index 64b263f5c..23d0afdf7 100644 --- a/library/Rules/Json.php +++ b/library/Rules/Json.php @@ -26,7 +26,7 @@ final class Json extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/KeySet.php b/library/Rules/KeySet.php index accc5ed9e..60cac840f 100644 --- a/library/Rules/KeySet.php +++ b/library/Rules/KeySet.php @@ -57,7 +57,7 @@ public function __construct(Validatable ...$validatables) } /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -69,7 +69,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { @@ -81,7 +81,7 @@ public function check($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/KeyValue.php b/library/Rules/KeyValue.php index dee38e32a..b78fef5e4 100644 --- a/library/Rules/KeyValue.php +++ b/library/Rules/KeyValue.php @@ -49,7 +49,7 @@ public function __construct($comparedKey, string $ruleName, $baseKey) } /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -63,7 +63,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { @@ -77,7 +77,7 @@ public function check($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/LeapDate.php b/library/Rules/LeapDate.php index fa432a839..8bf7b05c8 100644 --- a/library/Rules/LeapDate.php +++ b/library/Rules/LeapDate.php @@ -37,7 +37,7 @@ public function __construct(string $format) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/LeapYear.php b/library/Rules/LeapYear.php index 0a964bb51..38a8b4344 100644 --- a/library/Rules/LeapYear.php +++ b/library/Rules/LeapYear.php @@ -27,7 +27,7 @@ final class LeapYear extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Length.php b/library/Rules/Length.php index b815db112..eba90830a 100644 --- a/library/Rules/Length.php +++ b/library/Rules/Length.php @@ -66,7 +66,7 @@ public function __construct(?int $min = null, ?int $max = null, bool $inclusive } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Lowercase.php b/library/Rules/Lowercase.php index 9318fa49e..a671fe02f 100644 --- a/library/Rules/Lowercase.php +++ b/library/Rules/Lowercase.php @@ -23,7 +23,7 @@ final class Lowercase extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Luhn.php b/library/Rules/Luhn.php index e5c0cec00..e6ee89791 100644 --- a/library/Rules/Luhn.php +++ b/library/Rules/Luhn.php @@ -25,7 +25,7 @@ final class Luhn extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/MacAddress.php b/library/Rules/MacAddress.php index f82a583d3..81f3175df 100644 --- a/library/Rules/MacAddress.php +++ b/library/Rules/MacAddress.php @@ -23,7 +23,7 @@ final class MacAddress extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Mimetype.php b/library/Rules/Mimetype.php index 05a537e57..99b39a4aa 100644 --- a/library/Rules/Mimetype.php +++ b/library/Rules/Mimetype.php @@ -45,7 +45,7 @@ public function __construct(string $mimetype, ?finfo $fileInfo = null) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Multiple.php b/library/Rules/Multiple.php index 722922ff2..93c6e5365 100644 --- a/library/Rules/Multiple.php +++ b/library/Rules/Multiple.php @@ -31,7 +31,7 @@ public function __construct(int $multipleOf) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Negative.php b/library/Rules/Negative.php index 937a5dd84..9167a7271 100644 --- a/library/Rules/Negative.php +++ b/library/Rules/Negative.php @@ -21,7 +21,7 @@ final class Negative extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NfeAccessKey.php b/library/Rules/NfeAccessKey.php index fb74f2ac8..6af0a416f 100644 --- a/library/Rules/NfeAccessKey.php +++ b/library/Rules/NfeAccessKey.php @@ -29,7 +29,7 @@ final class NfeAccessKey extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Nif.php b/library/Rules/Nif.php index f47bcf07d..d65d0de7e 100644 --- a/library/Rules/Nif.php +++ b/library/Rules/Nif.php @@ -30,7 +30,7 @@ final class Nif extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Nip.php b/library/Rules/Nip.php index 66bb76e28..e2446547c 100644 --- a/library/Rules/Nip.php +++ b/library/Rules/Nip.php @@ -25,7 +25,7 @@ final class Nip extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NoWhitespace.php b/library/Rules/NoWhitespace.php index c8d848b76..6e63c51d2 100644 --- a/library/Rules/NoWhitespace.php +++ b/library/Rules/NoWhitespace.php @@ -24,7 +24,7 @@ final class NoWhitespace extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NoneOf.php b/library/Rules/NoneOf.php index 80adde73d..f1b19fa50 100644 --- a/library/Rules/NoneOf.php +++ b/library/Rules/NoneOf.php @@ -20,7 +20,7 @@ final class NoneOf extends AbstractComposite { /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -37,7 +37,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Not.php b/library/Rules/Not.php index 919a902c7..7ab68ff16 100644 --- a/library/Rules/Not.php +++ b/library/Rules/Not.php @@ -42,6 +42,9 @@ public function getNegatedRule(): Validatable return $this->rule; } + /** + * @deprecated Calling `setName()` directly from rules is deprecated. Please use {@see Validator::setName()} instead. + */ public function setName(string $name): Validatable { $this->rule->setName($name); @@ -50,7 +53,7 @@ public function setName(string $name): Validatable } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { @@ -58,7 +61,7 @@ public function validate($input): bool } /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { diff --git a/library/Rules/NotBlank.php b/library/Rules/NotBlank.php index 26fc4ea3e..3ce771aa0 100644 --- a/library/Rules/NotBlank.php +++ b/library/Rules/NotBlank.php @@ -26,7 +26,7 @@ final class NotBlank extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NotEmoji.php b/library/Rules/NotEmoji.php index 87b4ef944..622929803 100644 --- a/library/Rules/NotEmoji.php +++ b/library/Rules/NotEmoji.php @@ -193,7 +193,7 @@ final class NotEmoji extends AbstractRule ]; /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NotEmpty.php b/library/Rules/NotEmpty.php index 2faaadc7d..2d2629c20 100644 --- a/library/Rules/NotEmpty.php +++ b/library/Rules/NotEmpty.php @@ -22,7 +22,7 @@ final class NotEmpty extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NotOptional.php b/library/Rules/NotOptional.php index 59fec580e..3b0b12b28 100644 --- a/library/Rules/NotOptional.php +++ b/library/Rules/NotOptional.php @@ -24,7 +24,7 @@ final class NotOptional extends AbstractRule use CanValidateUndefined; /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NullType.php b/library/Rules/NullType.php index cd64750d9..1840d4d5e 100644 --- a/library/Rules/NullType.php +++ b/library/Rules/NullType.php @@ -20,7 +20,7 @@ final class NullType extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Nullable.php b/library/Rules/Nullable.php index 526044c20..8c6fa1319 100644 --- a/library/Rules/Nullable.php +++ b/library/Rules/Nullable.php @@ -17,7 +17,7 @@ final class Nullable extends AbstractWrapper { /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -29,7 +29,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { @@ -41,7 +41,7 @@ public function check($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Number.php b/library/Rules/Number.php index 6d6ac9f53..f7289761d 100644 --- a/library/Rules/Number.php +++ b/library/Rules/Number.php @@ -22,7 +22,7 @@ final class Number extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NumericVal.php b/library/Rules/NumericVal.php index 05029991a..03f33fb5e 100644 --- a/library/Rules/NumericVal.php +++ b/library/Rules/NumericVal.php @@ -21,7 +21,7 @@ final class NumericVal extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/ObjectType.php b/library/Rules/ObjectType.php index 747b1cb20..b2502ba82 100644 --- a/library/Rules/ObjectType.php +++ b/library/Rules/ObjectType.php @@ -20,7 +20,7 @@ final class ObjectType extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Odd.php b/library/Rules/Odd.php index 658260a9b..ee2a42f10 100644 --- a/library/Rules/Odd.php +++ b/library/Rules/Odd.php @@ -24,7 +24,7 @@ final class Odd extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/OneOf.php b/library/Rules/OneOf.php index e8434e656..f11b0ee2d 100644 --- a/library/Rules/OneOf.php +++ b/library/Rules/OneOf.php @@ -22,7 +22,7 @@ final class OneOf extends AbstractComposite { /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -40,7 +40,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { @@ -57,7 +57,7 @@ public function validate($input): bool } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { diff --git a/library/Rules/Optional.php b/library/Rules/Optional.php index cb666f9e4..71acec864 100644 --- a/library/Rules/Optional.php +++ b/library/Rules/Optional.php @@ -19,7 +19,7 @@ final class Optional extends AbstractWrapper use CanValidateUndefined; /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -31,7 +31,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { @@ -43,7 +43,7 @@ public function check($input): void } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/PerfectSquare.php b/library/Rules/PerfectSquare.php index 204da99f7..0034e2904 100644 --- a/library/Rules/PerfectSquare.php +++ b/library/Rules/PerfectSquare.php @@ -24,7 +24,7 @@ final class PerfectSquare extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Pesel.php b/library/Rules/Pesel.php index 48c822707..33b4895d5 100644 --- a/library/Rules/Pesel.php +++ b/library/Rules/Pesel.php @@ -22,7 +22,7 @@ final class Pesel extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Phone.php b/library/Rules/Phone.php index 3d7ff533f..ece3dcc6c 100644 --- a/library/Rules/Phone.php +++ b/library/Rules/Phone.php @@ -51,6 +51,9 @@ public function __construct(?string $countryCode = null) } } + /** + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. + */ public function validate($input): bool { if (!is_scalar($input)) { diff --git a/library/Rules/PhpLabel.php b/library/Rules/PhpLabel.php index 7f64f7732..42aeb6834 100644 --- a/library/Rules/PhpLabel.php +++ b/library/Rules/PhpLabel.php @@ -22,7 +22,7 @@ final class PhpLabel extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Pis.php b/library/Rules/Pis.php index 683bd546c..5fb7a1e41 100644 --- a/library/Rules/Pis.php +++ b/library/Rules/Pis.php @@ -24,7 +24,7 @@ final class Pis extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/PolishIdCard.php b/library/Rules/PolishIdCard.php index f8d103dba..76bae02af 100644 --- a/library/Rules/PolishIdCard.php +++ b/library/Rules/PolishIdCard.php @@ -28,7 +28,7 @@ final class PolishIdCard extends AbstractRule private const ASCII_CODE_A = 65; /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/PortugueseNif.php b/library/Rules/PortugueseNif.php index bfbdb6a1f..f3d7810cb 100644 --- a/library/Rules/PortugueseNif.php +++ b/library/Rules/PortugueseNif.php @@ -30,7 +30,7 @@ final class PortugueseNif extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Positive.php b/library/Rules/Positive.php index d6857cffb..0aba71c60 100644 --- a/library/Rules/Positive.php +++ b/library/Rules/Positive.php @@ -21,7 +21,7 @@ final class Positive extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/PrimeNumber.php b/library/Rules/PrimeNumber.php index c5aa2f92a..8c2036514 100644 --- a/library/Rules/PrimeNumber.php +++ b/library/Rules/PrimeNumber.php @@ -25,7 +25,7 @@ final class PrimeNumber extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/PublicDomainSuffix.php b/library/Rules/PublicDomainSuffix.php index d25980b48..9eab12650 100644 --- a/library/Rules/PublicDomainSuffix.php +++ b/library/Rules/PublicDomainSuffix.php @@ -22,6 +22,9 @@ final class PublicDomainSuffix extends AbstractRule { use CanValidateUndefined; + /** + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. + */ public function validate($input): bool { if (!is_scalar($input)) { diff --git a/library/Rules/Readable.php b/library/Rules/Readable.php index c27b9a407..f62900720 100644 --- a/library/Rules/Readable.php +++ b/library/Rules/Readable.php @@ -24,7 +24,7 @@ final class Readable extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Regex.php b/library/Rules/Regex.php index 2eba94e7d..3ce5f5823 100644 --- a/library/Rules/Regex.php +++ b/library/Rules/Regex.php @@ -35,7 +35,7 @@ public function __construct(string $regex) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/ResourceType.php b/library/Rules/ResourceType.php index d5cf062c4..9198b614b 100644 --- a/library/Rules/ResourceType.php +++ b/library/Rules/ResourceType.php @@ -19,7 +19,7 @@ final class ResourceType extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/ScalarVal.php b/library/Rules/ScalarVal.php index 955303b06..0576a9323 100644 --- a/library/Rules/ScalarVal.php +++ b/library/Rules/ScalarVal.php @@ -19,7 +19,7 @@ final class ScalarVal extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Size.php b/library/Rules/Size.php index d7e1d472f..0ca887597 100644 --- a/library/Rules/Size.php +++ b/library/Rules/Size.php @@ -63,7 +63,7 @@ public function __construct($minSize = null, $maxSize = null) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Slug.php b/library/Rules/Slug.php index a8263eb78..38b5803a4 100644 --- a/library/Rules/Slug.php +++ b/library/Rules/Slug.php @@ -24,7 +24,7 @@ final class Slug extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Sorted.php b/library/Rules/Sorted.php index 84037f366..ab1a9e929 100644 --- a/library/Rules/Sorted.php +++ b/library/Rules/Sorted.php @@ -46,7 +46,7 @@ public function __construct(string $direction) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/StartsWith.php b/library/Rules/StartsWith.php index dc5e0a326..a7cf41b0c 100644 --- a/library/Rules/StartsWith.php +++ b/library/Rules/StartsWith.php @@ -44,7 +44,7 @@ public function __construct($startValue, bool $identical = false) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/StringType.php b/library/Rules/StringType.php index 0dce1d523..b35c99cd7 100644 --- a/library/Rules/StringType.php +++ b/library/Rules/StringType.php @@ -20,7 +20,7 @@ final class StringType extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/StringVal.php b/library/Rules/StringVal.php index 469cec986..65988bc0d 100644 --- a/library/Rules/StringVal.php +++ b/library/Rules/StringVal.php @@ -22,7 +22,7 @@ final class StringVal extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Subset.php b/library/Rules/Subset.php index fddc5d13b..c868a7f43 100644 --- a/library/Rules/Subset.php +++ b/library/Rules/Subset.php @@ -36,7 +36,7 @@ public function __construct(array $superset) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/SymbolicLink.php b/library/Rules/SymbolicLink.php index 6fe9d0fd5..773006d88 100644 --- a/library/Rules/SymbolicLink.php +++ b/library/Rules/SymbolicLink.php @@ -23,7 +23,7 @@ final class SymbolicLink extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Time.php b/library/Rules/Time.php index dc9f646cf..9026d9616 100644 --- a/library/Rules/Time.php +++ b/library/Rules/Time.php @@ -53,7 +53,7 @@ public function __construct(string $format = 'H:i:s') } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Tld.php b/library/Rules/Tld.php index e297513d1..a429a83df 100644 --- a/library/Rules/Tld.php +++ b/library/Rules/Tld.php @@ -236,7 +236,7 @@ final class Tld extends AbstractRule ]; /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/TrueVal.php b/library/Rules/TrueVal.php index c9018e255..82e432b6f 100644 --- a/library/Rules/TrueVal.php +++ b/library/Rules/TrueVal.php @@ -23,7 +23,7 @@ final class TrueVal extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Type.php b/library/Rules/Type.php index f16d80a30..5e28b5d38 100644 --- a/library/Rules/Type.php +++ b/library/Rules/Type.php @@ -73,7 +73,7 @@ public function __construct(string $type) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Unique.php b/library/Rules/Unique.php index 2ce865c6f..dce2c3acb 100644 --- a/library/Rules/Unique.php +++ b/library/Rules/Unique.php @@ -24,7 +24,7 @@ final class Unique extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Uploaded.php b/library/Rules/Uploaded.php index 9bc7edaa9..5a445ba60 100644 --- a/library/Rules/Uploaded.php +++ b/library/Rules/Uploaded.php @@ -24,7 +24,7 @@ final class Uploaded extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Uppercase.php b/library/Rules/Uppercase.php index 58ae4e06b..fc1948c6d 100644 --- a/library/Rules/Uppercase.php +++ b/library/Rules/Uppercase.php @@ -23,7 +23,7 @@ final class Uppercase extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Uuid.php b/library/Rules/Uuid.php index 1ea7659c3..126fcbbd8 100644 --- a/library/Rules/Uuid.php +++ b/library/Rules/Uuid.php @@ -53,7 +53,7 @@ public function __construct(?int $version = null) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Version.php b/library/Rules/Version.php index 6dfb0cf37..d65df2dfb 100644 --- a/library/Rules/Version.php +++ b/library/Rules/Version.php @@ -23,7 +23,7 @@ final class Version extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/VideoUrl.php b/library/Rules/VideoUrl.php index 7ba7d3ca6..d6272a8e7 100644 --- a/library/Rules/VideoUrl.php +++ b/library/Rules/VideoUrl.php @@ -55,7 +55,7 @@ public function __construct(?string $service = null) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/When.php b/library/Rules/When.php index 292b47bd3..8fa4c11a7 100644 --- a/library/Rules/When.php +++ b/library/Rules/When.php @@ -50,7 +50,7 @@ public function __construct(Validatable $when, Validatable $then, ?Validatable $ } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { @@ -62,7 +62,7 @@ public function validate($input): bool } /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see Validator::assert()} instead. */ public function assert($input): void { @@ -76,7 +76,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see Validator::check()} instead. */ public function check($input): void { diff --git a/library/Rules/Writable.php b/library/Rules/Writable.php index 7b87a8cd3..d812e6a85 100644 --- a/library/Rules/Writable.php +++ b/library/Rules/Writable.php @@ -24,7 +24,7 @@ final class Writable extends AbstractRule { /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Yes.php b/library/Rules/Yes.php index fc8b27f1f..dd4ffea20 100644 --- a/library/Rules/Yes.php +++ b/library/Rules/Yes.php @@ -37,7 +37,7 @@ public function __construct(bool $useLocale = false) } /** - * {@inheritDoc} + * @deprecated Calling `validate()` directly from rules is deprecated. Please use {@see Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Validator.php b/library/Validator.php index 1dfb10366..a21690999 100644 --- a/library/Validator.php +++ b/library/Validator.php @@ -26,13 +26,41 @@ final class Validator extends AllOf /** * Create instance validator. */ - public static function create(): self + public static function create(Validatable ...$rules): self { - return new self(); + return new self(...$rules); } /** - * {@inheritDoc} + * @param mixed $input + */ + public function assert($input): void + { + parent::assert($input); + } + + public function isValid(mixed $input): bool + { + return parent::validate($input); + } + + public function setName(string $name): Validatable + { + return parent::setName($name); + } + + public function getName(): ?string + { + return parent::getName(); + } + + public function setTemplate(string $template): Validatable + { + return parent::setTemplate($template); + } + + /** + * @param mixed $input */ public function check($input): void { diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 1ef752f92..fb9690812 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -23,5 +23,6 @@ + diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 1fc2e5c1d..423ac8068 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -30,6 +30,32 @@ parameters: # Why: I don't want to make changes to the code just to make phpstan happy message: '/Parameter #2 \$values of function vsprintf expects array, array\|bool\|float\|int\|string> given./' path: library/Rules/AbstractAge.php + + # Why: Deprecations of version 3.0 + - + message: '/Using rule exceptions directly is deprecated, and will be removed in the next major version\./' + + - + message: '/Calling `.+\(\)` directly from rules is deprecated. Please use {@see Validator::.+\(\)} instead./' + path: tests/unit/Rules + - + message: '/Calling `.+\(\)` directly from rules is deprecated. Please use {@see Validator::.+\(\)} instead./' + path: tests/unit/FactoryTest.php + - + message: '/Calling `.+\(\)` directly from rules is deprecated. Please use {@see Validator::.+\(\)} instead./' + path: library/Validator.php + - + message: '/Calling validator as a function is deprecated, and will be removed in the next major version./' + path: tests/unit/Rules + - + message: '/Calling `reportError\(\)` directly is deprecated, and will be removed in the next major version./' + path: tests/unit/Rules + - + message: '/Calling `.+\(\)` directly from rules is deprecated. Please use {@see Validator::.+\(\)} instead./' + path: library/Rules + - + message: '/Calling `reportError\(\)` directly is deprecated, and will be removed in the next major version./' + path: library/Rules level: 8 paths: - library/