From 9740e240070ffc812e6612b8765c8c941158a7ac Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Mon, 6 Jan 2025 23:28:16 +0100 Subject: [PATCH 1/4] Prepare library for the next major version Version 3.0 will include a few crucial deprecations. This commit adds some soft deprecations to warn users about these changes. Some of the biggest changes are: * The method `validate()` will be renamed to `isValid()`. * The method `validate()` will be repurposed to return an object with failures. * It won't be possible to handle rules directly; users will need to use the `Validator` class to validate with any rule. There will some more changes, but those are some of the most important ones, and are the ones that are easy to deprecate right now. --- .github/workflows/continuous-integration.yml | 1 + README.md | 2 +- composer.json | 2 +- docs/02-feature-guide.md | 28 ++++++++-------- docs/05-concrete-api.md | 17 ++++++---- docs/07-comparable-values.md | 10 +++--- docs/index.md | 2 +- docs/rules/AllOf.md | 2 +- docs/rules/Alnum.md | 12 +++---- docs/rules/Alpha.md | 12 +++---- docs/rules/AlwaysInvalid.md | 2 +- docs/rules/AlwaysValid.md | 2 +- docs/rules/AnyOf.md | 2 +- docs/rules/ArrayType.md | 6 ++-- docs/rules/ArrayVal.md | 6 ++-- docs/rules/Attribute.md | 6 ++-- docs/rules/Base.md | 10 +++--- docs/rules/Base64.md | 4 +-- docs/rules/Between.md | 6 ++-- docs/rules/BoolType.md | 4 +-- docs/rules/BoolVal.md | 12 +++---- docs/rules/Bsn.md | 2 +- docs/rules/Call.md | 2 +- docs/rules/CallableType.md | 6 ++-- docs/rules/Callback.md | 2 +- docs/rules/Charset.md | 6 ++-- docs/rules/Cnh.md | 2 +- docs/rules/Consonant.md | 2 +- docs/rules/Contains.md | 4 +-- docs/rules/ContainsAny.md | 4 +-- docs/rules/Control.md | 2 +- docs/rules/Countable.md | 6 ++-- docs/rules/CountryCode.md | 8 ++--- docs/rules/Cpf.md | 6 ++-- docs/rules/CreditCard.md | 24 +++++++------- docs/rules/CurrencyCode.md | 2 +- docs/rules/Date.md | 12 +++---- docs/rules/DateTime.md | 14 ++++---- docs/rules/Decimal.md | 8 ++--- docs/rules/Digit.md | 8 ++--- docs/rules/Directory.md | 8 ++--- docs/rules/Domain.md | 4 +-- docs/rules/Each.md | 8 ++--- docs/rules/Email.md | 2 +- docs/rules/EndsWith.md | 4 +-- docs/rules/Equals.md | 2 +- docs/rules/Equivalent.md | 6 ++-- docs/rules/Even.md | 2 +- docs/rules/Executable.md | 2 +- docs/rules/Exists.md | 6 ++-- docs/rules/Extension.md | 2 +- docs/rules/Factor.md | 6 ++-- docs/rules/FalseVal.md | 16 ++++----- docs/rules/Fibonacci.md | 6 ++-- docs/rules/File.md | 6 ++-- docs/rules/FilterVar.md | 14 ++++---- docs/rules/Finite.md | 4 +-- docs/rules/FloatType.md | 6 ++-- docs/rules/FloatVal.md | 4 +-- docs/rules/Graph.md | 2 +- docs/rules/GreaterThan.md | 4 +-- docs/rules/HexRgbColor.md | 8 ++--- docs/rules/Iban.md | 10 +++--- docs/rules/Identical.md | 4 +-- docs/rules/Image.md | 6 ++-- docs/rules/Imei.md | 4 +-- docs/rules/In.md | 4 +-- docs/rules/Infinite.md | 2 +- docs/rules/Instance.md | 4 +-- docs/rules/IntType.md | 4 +-- docs/rules/IntVal.md | 14 ++++---- docs/rules/Ip.md | 14 ++++---- docs/rules/Isbn.md | 8 ++--- docs/rules/IterableType.md | 8 ++--- docs/rules/Json.md | 2 +- docs/rules/Key.md | 6 ++-- docs/rules/KeyNested.md | 4 +-- docs/rules/KeySet.md | 8 ++--- docs/rules/KeyValue.md | 8 ++--- docs/rules/LanguageCode.md | 10 +++--- docs/rules/LeapDate.md | 2 +- docs/rules/LeapYear.md | 2 +- docs/rules/Length.md | 10 +++--- docs/rules/LessThan.md | 4 +-- docs/rules/Lowercase.md | 2 +- docs/rules/Luhn.md | 4 +-- docs/rules/MacAddress.md | 4 +-- docs/rules/Max.md | 6 ++-- docs/rules/MaxAge.md | 8 ++--- docs/rules/Mimetype.md | 4 +-- docs/rules/Min.md | 6 ++-- docs/rules/MinAge.md | 8 ++--- docs/rules/Multiple.md | 2 +- docs/rules/Negative.md | 2 +- docs/rules/NfeAccessKey.md | 2 +- docs/rules/Nif.md | 4 +-- docs/rules/Nip.md | 10 +++--- docs/rules/No.md | 18 +++++------ docs/rules/NoWhitespace.md | 4 +-- docs/rules/NoneOf.md | 2 +- docs/rules/Not.md | 4 +-- docs/rules/NotBlank.md | 32 +++++++++--------- docs/rules/NotEmoji.md | 12 +++---- docs/rules/NotEmpty.md | 12 +++---- docs/rules/NotOptional.md | 32 +++++++++--------- docs/rules/NullType.md | 2 +- docs/rules/Nullable.md | 6 ++-- docs/rules/Number.md | 4 +-- docs/rules/NumericVal.md | 4 +-- docs/rules/ObjectType.md | 2 +- docs/rules/Odd.md | 4 +-- docs/rules/OneOf.md | 8 ++--- docs/rules/Optional.md | 4 +-- docs/rules/PerfectSquare.md | 4 +-- docs/rules/Pesel.md | 8 ++--- docs/rules/Phone.md | 6 ++-- docs/rules/PhpLabel.md | 6 ++-- docs/rules/Pis.md | 10 +++--- docs/rules/PolishIdCard.md | 8 ++--- docs/rules/PortugueseNif.md | 4 +-- docs/rules/Positive.md | 6 ++-- docs/rules/PostalCode.md | 14 ++++---- docs/rules/PrimeNumber.md | 2 +- docs/rules/Printable.md | 2 +- docs/rules/PublicDomainSuffix.md | 10 +++--- docs/rules/Punct.md | 2 +- docs/rules/Readable.md | 2 +- docs/rules/Regex.md | 2 +- docs/rules/ResourceType.md | 2 +- docs/rules/Roman.md | 2 +- docs/rules/ScalarVal.md | 4 +-- docs/rules/Size.md | 8 ++--- docs/rules/Slug.md | 6 ++-- docs/rules/Sorted.md | 16 ++++----- docs/rules/Space.md | 2 +- docs/rules/StartsWith.md | 4 +-- docs/rules/StringType.md | 2 +- docs/rules/StringVal.md | 14 ++++---- docs/rules/SubdivisionCode.md | 4 +-- docs/rules/Subset.md | 4 +-- docs/rules/SymbolicLink.md | 6 ++-- docs/rules/Time.md | 18 +++++------ docs/rules/Tld.md | 8 ++--- docs/rules/TrueVal.md | 16 ++++----- docs/rules/Type.md | 6 ++-- docs/rules/Unique.md | 8 ++--- docs/rules/Uploaded.md | 2 +- docs/rules/Uppercase.md | 8 ++--- docs/rules/Url.md | 10 +++--- docs/rules/Uuid.md | 8 ++--- docs/rules/Version.md | 2 +- docs/rules/VideoUrl.md | 34 ++++++++++---------- docs/rules/Vowel.md | 2 +- docs/rules/When.md | 8 ++--- docs/rules/Writable.md | 2 +- docs/rules/Xdigit.md | 4 +-- docs/rules/Yes.md | 16 ++++----- library/Rules/AbstractAge.php | 2 +- library/Rules/AbstractComparison.php | 2 +- library/Rules/AbstractComposite.php | 2 +- library/Rules/AbstractEnvelope.php | 2 +- library/Rules/AbstractFilterRule.php | 2 +- library/Rules/AbstractRelated.php | 8 ++--- library/Rules/AbstractRule.php | 16 +++++---- library/Rules/AbstractSearcher.php | 2 +- library/Rules/AbstractWrapper.php | 8 ++--- library/Rules/AllOf.php | 6 ++-- library/Rules/AlwaysInvalid.php | 2 +- library/Rules/AlwaysValid.php | 2 +- library/Rules/AnyOf.php | 6 ++-- library/Rules/ArrayType.php | 2 +- library/Rules/ArrayVal.php | 2 +- library/Rules/Base.php | 2 +- library/Rules/Base64.php | 2 +- library/Rules/BoolType.php | 2 +- library/Rules/BoolVal.php | 2 +- library/Rules/Bsn.php | 2 +- library/Rules/Call.php | 6 ++-- library/Rules/CallableType.php | 2 +- library/Rules/Callback.php | 2 +- library/Rules/Charset.php | 2 +- library/Rules/Cnh.php | 2 +- library/Rules/Cnpj.php | 2 +- library/Rules/Contains.php | 2 +- library/Rules/Countable.php | 2 +- library/Rules/Cpf.php | 2 +- library/Rules/CreditCard.php | 2 +- library/Rules/Date.php | 2 +- library/Rules/DateTime.php | 2 +- library/Rules/Decimal.php | 2 +- library/Rules/Directory.php | 2 +- library/Rules/Domain.php | 6 ++-- library/Rules/Each.php | 6 ++-- library/Rules/Email.php | 2 +- library/Rules/EndsWith.php | 2 +- library/Rules/Equals.php | 2 +- library/Rules/Equivalent.php | 2 +- library/Rules/Even.php | 2 +- library/Rules/Executable.php | 2 +- library/Rules/Exists.php | 2 +- library/Rules/Extension.php | 2 +- library/Rules/Factor.php | 2 +- library/Rules/FalseVal.php | 2 +- library/Rules/Fibonacci.php | 2 +- library/Rules/File.php | 2 +- library/Rules/Finite.php | 2 +- library/Rules/FloatType.php | 2 +- library/Rules/FloatVal.php | 2 +- library/Rules/Iban.php | 2 +- library/Rules/Identical.php | 2 +- library/Rules/Image.php | 2 +- library/Rules/Imei.php | 3 +- library/Rules/In.php | 2 +- library/Rules/Infinite.php | 2 +- library/Rules/Instance.php | 2 +- library/Rules/IntType.php | 2 +- library/Rules/IntVal.php | 2 +- library/Rules/Ip.php | 2 +- library/Rules/Isbn.php | 2 +- library/Rules/IterableType.php | 2 +- library/Rules/Json.php | 2 +- library/Rules/KeySet.php | 6 ++-- library/Rules/KeyValue.php | 6 ++-- library/Rules/LeapDate.php | 2 +- library/Rules/LeapYear.php | 2 +- library/Rules/Length.php | 2 +- library/Rules/Lowercase.php | 2 +- library/Rules/Luhn.php | 2 +- library/Rules/MacAddress.php | 2 +- library/Rules/Mimetype.php | 2 +- library/Rules/Multiple.php | 2 +- library/Rules/Negative.php | 2 +- library/Rules/NfeAccessKey.php | 2 +- library/Rules/Nif.php | 2 +- library/Rules/Nip.php | 2 +- library/Rules/NoWhitespace.php | 2 +- library/Rules/NoneOf.php | 4 +-- library/Rules/Not.php | 7 ++-- library/Rules/NotBlank.php | 2 +- library/Rules/NotEmoji.php | 2 +- library/Rules/NotEmpty.php | 2 +- library/Rules/NotOptional.php | 2 +- library/Rules/NullType.php | 2 +- library/Rules/Nullable.php | 6 ++-- library/Rules/Number.php | 2 +- library/Rules/NumericVal.php | 2 +- library/Rules/ObjectType.php | 2 +- library/Rules/Odd.php | 2 +- library/Rules/OneOf.php | 6 ++-- library/Rules/Optional.php | 6 ++-- library/Rules/PerfectSquare.php | 2 +- library/Rules/Pesel.php | 2 +- library/Rules/Phone.php | 3 ++ library/Rules/PhpLabel.php | 2 +- library/Rules/Pis.php | 2 +- library/Rules/PolishIdCard.php | 2 +- library/Rules/PortugueseNif.php | 2 +- library/Rules/Positive.php | 2 +- library/Rules/PrimeNumber.php | 2 +- library/Rules/PublicDomainSuffix.php | 3 ++ library/Rules/Readable.php | 2 +- library/Rules/Regex.php | 2 +- library/Rules/ResourceType.php | 2 +- library/Rules/ScalarVal.php | 2 +- library/Rules/Size.php | 2 +- library/Rules/Slug.php | 2 +- library/Rules/Sorted.php | 2 +- library/Rules/StartsWith.php | 2 +- library/Rules/StringType.php | 2 +- library/Rules/StringVal.php | 2 +- library/Rules/Subset.php | 2 +- library/Rules/SymbolicLink.php | 2 +- library/Rules/Time.php | 2 +- library/Rules/Tld.php | 2 +- library/Rules/TrueVal.php | 2 +- library/Rules/Type.php | 2 +- library/Rules/Unique.php | 2 +- library/Rules/Uploaded.php | 2 +- library/Rules/Uppercase.php | 2 +- library/Rules/Uuid.php | 2 +- library/Rules/Version.php | 2 +- library/Rules/VideoUrl.php | 2 +- library/Rules/When.php | 6 ++-- library/Rules/Writable.php | 2 +- library/Rules/Yes.php | 2 +- library/Validator.php | 34 ++++++++++++++++++-- phpcs.xml.dist | 1 + phpstan.neon.dist | 23 +++++++++++++ 288 files changed, 756 insertions(+), 690 deletions(-) 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/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..9e2e40506 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()` @@ -78,7 +78,7 @@ v::key( ->key('field2', v::stringType()) ->key('field3', v::boolType()) ) - ->assert($data); // You can also use check() or validate() + ->assert($data); // You can also use check() or isValid() ``` ## Input optional @@ -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 @@ -144,7 +144,7 @@ $usernameValidator->validate('#$%'); //false ## Informative exceptions When something goes wrong, Validation can tell you exactly what's going on. For this, -we use the `assert()` method instead of `validate()`: +we use the `assert()` method instead of `isValid()`: ```php use Respect\Validation\Exceptions\NestedValidationException; @@ -239,7 +239,7 @@ v::dateTime('Y-m-d')->between('1980-02-02', 'now')->setName('Member Since'); ## Validation methods -We've seen `validate()` that returns true or false and `assert()` that throws a complete +We've seen `isValid()` that returns true or false and `assert()` that throws a complete validation report. There is also a `check()` method that returns an Exception only with the first error found: 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/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/Rules/AbstractAge.php b/library/Rules/AbstractAge.php index d8a788691..8f7dddce3 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AbstractComparison.php b/library/Rules/AbstractComparison.php index c65deb901..02a65d495 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AbstractComposite.php b/library/Rules/AbstractComposite.php index fd9c30177..f49287e25 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 \Respect\Validation\Validator::setName()} instead. */ public function setName(string $name): Validatable { diff --git a/library/Rules/AbstractEnvelope.php b/library/Rules/AbstractEnvelope.php index 650e48e67..e05644218 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AbstractFilterRule.php b/library/Rules/AbstractFilterRule.php index 2c658a0be..0be581e41 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AbstractRelated.php b/library/Rules/AbstractRelated.php index 876755253..824d446a2 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AbstractRule.php b/library/Rules/AbstractRule.php index cb31c597a..861b02039 100644 --- a/library/Rules/AbstractRule.php +++ b/library/Rules/AbstractRule.php @@ -32,7 +32,7 @@ abstract class AbstractRule implements Validatable protected $template; /** - * {@inheritDoc} + * @deprecated Calling `assert()` directly from rules is deprecated. Please use {@see \Respect\Validation\Validator::assert()} instead. */ public function assert($input): void { @@ -44,7 +44,7 @@ public function assert($input): void } /** - * {@inheritDoc} + * @deprecated Calling `check()` directly from rules is deprecated. Please use {@see \Respect\Validation\Validator::check()} instead. */ public function check($input): void { @@ -52,7 +52,7 @@ public function check($input): void } /** - * {@inheritDoc} + * @deprecated Calling `getName()` directly from rules is deprecated. Please use {@see \Respect\Validation\Validator::getName()} instead. */ public function getName(): ?string { @@ -60,7 +60,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 +69,7 @@ public function reportError($input, array $extraParams = []): ValidationExceptio } /** - * {@inheritDoc} + * @deprecated Calling `setName()` directly from rules is deprecated. Please use {@see \Respect\Validation\Validator::setName()} instead. */ public function setName(string $name): Validatable { @@ -78,7 +79,7 @@ public function setName(string $name): Validatable } /** - * {@inheritDoc} + * @deprecated Calling `setTemplate()` directly from rules is deprecated. Please use {@see \Respect\Validation\Validator::setTemplate()} instead. */ public function setTemplate(string $template): Validatable { @@ -88,7 +89,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..79c93e6e8 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AbstractWrapper.php b/library/Rules/AbstractWrapper.php index 75a5738f9..a26bed1bf 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::setName()} instead. */ public function setName(string $name): Validatable { diff --git a/library/Rules/AllOf.php b/library/Rules/AllOf.php index ebbc42ca3..9990efa9e 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AlwaysInvalid.php b/library/Rules/AlwaysInvalid.php index b3eb7738b..11110450c 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AlwaysValid.php b/library/Rules/AlwaysValid.php index c8a821286..afc7fd3cd 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/AnyOf.php b/library/Rules/AnyOf.php index ddf213c2e..cdf64f106 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::check()} instead. */ public function check($input): void { diff --git a/library/Rules/ArrayType.php b/library/Rules/ArrayType.php index cbfe7d9f7..dce241803 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/ArrayVal.php b/library/Rules/ArrayVal.php index 53bd4e84e..e01ac1357 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Base.php b/library/Rules/Base.php index 03f6d77b3..be1f1beb4 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Base64.php b/library/Rules/Base64.php index 11a070704..2e44d5924 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/BoolType.php b/library/Rules/BoolType.php index 0f32be573..3bc2dedf3 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/BoolVal.php b/library/Rules/BoolVal.php index b9cef6990..6ddd203fd 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Bsn.php b/library/Rules/Bsn.php index a5cb5125c..b8d70de07 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Call.php b/library/Rules/Call.php index 940323909..040aa92e2 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/CallableType.php b/library/Rules/CallableType.php index 0fa9eb12f..def74be71 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Callback.php b/library/Rules/Callback.php index 3c057a256..560c7a6f2 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Charset.php b/library/Rules/Charset.php index 00640e206..180394219 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Cnh.php b/library/Rules/Cnh.php index 4b180fd63..04ce825ca 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Cnpj.php b/library/Rules/Cnpj.php index 78081f24f..53ad0b022 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Contains.php b/library/Rules/Contains.php index 0a92b9297..b1fb957bb 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Countable.php b/library/Rules/Countable.php index 8f2d8d6b1..0f0e6c374 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Cpf.php b/library/Rules/Cpf.php index 62f75037e..55a9f0acc 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/CreditCard.php b/library/Rules/CreditCard.php index 3008497f0..5a4930081 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Date.php b/library/Rules/Date.php index d39a75818..853005435 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/DateTime.php b/library/Rules/DateTime.php index cc1e6d2c3..7012eef7e 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Decimal.php b/library/Rules/Decimal.php index 49161ea4a..c0e5f5a66 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Directory.php b/library/Rules/Directory.php index 70bd3d237..8dda463d3 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Domain.php b/library/Rules/Domain.php index a73191670..950903ad5 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::check()} instead. */ public function check($input): void { diff --git a/library/Rules/Each.php b/library/Rules/Each.php index 2da5fe188..aa270adeb 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Email.php b/library/Rules/Email.php index f638cb35d..b406d8d21 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/EndsWith.php b/library/Rules/EndsWith.php index 790db183e..a58d799ab 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Equals.php b/library/Rules/Equals.php index 012984b60..136ee0af5 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Equivalent.php b/library/Rules/Equivalent.php index 3945f1c0b..af2a5ec1c 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Even.php b/library/Rules/Even.php index b21268eca..2448a337f 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Executable.php b/library/Rules/Executable.php index a1f2ce2a3..cbd555a23 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Exists.php b/library/Rules/Exists.php index c1bff939d..7243aa8e7 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Extension.php b/library/Rules/Extension.php index ed2a9a48c..334fd7e3a 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Factor.php b/library/Rules/Factor.php index 170f99a61..3a1e82c3a 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/FalseVal.php b/library/Rules/FalseVal.php index aba23d5ea..baf78fdc4 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Fibonacci.php b/library/Rules/Fibonacci.php index c48476da3..57d46f59e 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/File.php b/library/Rules/File.php index fcf8a7c1a..c0723270f 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Finite.php b/library/Rules/Finite.php index 26f77544f..aa666f45a 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/FloatType.php b/library/Rules/FloatType.php index 70d49644c..f7517d811 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/FloatVal.php b/library/Rules/FloatVal.php index 2b7c55b79..0619b8357 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Iban.php b/library/Rules/Iban.php index 89484f4a7..cd2c57f7c 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Identical.php b/library/Rules/Identical.php index 02ee01cd4..66e0db0b9 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Image.php b/library/Rules/Image.php index 619d8c2a9..62dabab93 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Imei.php b/library/Rules/Imei.php index 130e5c768..a35b42251 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/In.php b/library/Rules/In.php index f7374489b..7549ba97e 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Infinite.php b/library/Rules/Infinite.php index 55c4706f5..816dba81d 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Instance.php b/library/Rules/Instance.php index d7a6744dc..97febee2e 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/IntType.php b/library/Rules/IntType.php index 561dc438e..68e8e0340 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/IntVal.php b/library/Rules/IntVal.php index d147a4411..67d299834 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Ip.php b/library/Rules/Ip.php index a72553339..79e1eec8e 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Isbn.php b/library/Rules/Isbn.php index 4c0dd14b3..d470ab536 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/IterableType.php b/library/Rules/IterableType.php index 92bd300d1..ab50a40dd 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Json.php b/library/Rules/Json.php index 64b263f5c..06f445c43 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/KeySet.php b/library/Rules/KeySet.php index accc5ed9e..c48b3675f 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/KeyValue.php b/library/Rules/KeyValue.php index dee38e32a..1c7f3817f 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/LeapDate.php b/library/Rules/LeapDate.php index fa432a839..61e5fe676 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/LeapYear.php b/library/Rules/LeapYear.php index 0a964bb51..2f136292c 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Length.php b/library/Rules/Length.php index b815db112..0bc7ba6c3 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Lowercase.php b/library/Rules/Lowercase.php index 9318fa49e..d51fa827e 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Luhn.php b/library/Rules/Luhn.php index e5c0cec00..b3bd7cfce 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/MacAddress.php b/library/Rules/MacAddress.php index f82a583d3..9000b1ceb 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Mimetype.php b/library/Rules/Mimetype.php index 05a537e57..039413fa1 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Multiple.php b/library/Rules/Multiple.php index 722922ff2..0fa564cce 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Negative.php b/library/Rules/Negative.php index 937a5dd84..ce0723861 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NfeAccessKey.php b/library/Rules/NfeAccessKey.php index fb74f2ac8..a2fdc19a7 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Nif.php b/library/Rules/Nif.php index f47bcf07d..8f2782308 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Nip.php b/library/Rules/Nip.php index 66bb76e28..c41117fd6 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NoWhitespace.php b/library/Rules/NoWhitespace.php index c8d848b76..bfec4a47e 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NoneOf.php b/library/Rules/NoneOf.php index 80adde73d..26fee78f8 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 \Respect\Validation\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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Not.php b/library/Rules/Not.php index 919a902c7..815f27698 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::assert()} instead. */ public function assert($input): void { diff --git a/library/Rules/NotBlank.php b/library/Rules/NotBlank.php index 26fc4ea3e..1b05f8084 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NotEmoji.php b/library/Rules/NotEmoji.php index 87b4ef944..bb174f5d1 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NotEmpty.php b/library/Rules/NotEmpty.php index 2faaadc7d..dea056fc5 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NotOptional.php b/library/Rules/NotOptional.php index 59fec580e..c6c5a2fff 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NullType.php b/library/Rules/NullType.php index cd64750d9..4e13abad1 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Nullable.php b/library/Rules/Nullable.php index 526044c20..411d3e7b2 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Number.php b/library/Rules/Number.php index 6d6ac9f53..e6d588692 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/NumericVal.php b/library/Rules/NumericVal.php index 05029991a..e4335bba8 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/ObjectType.php b/library/Rules/ObjectType.php index 747b1cb20..6f075e827 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Odd.php b/library/Rules/Odd.php index 658260a9b..2624c31b9 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/OneOf.php b/library/Rules/OneOf.php index e8434e656..54553a30e 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::check()} instead. */ public function check($input): void { diff --git a/library/Rules/Optional.php b/library/Rules/Optional.php index cb666f9e4..9c68a8771 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/PerfectSquare.php b/library/Rules/PerfectSquare.php index 204da99f7..2385d1a7d 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Pesel.php b/library/Rules/Pesel.php index 48c822707..5ed2636d4 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Phone.php b/library/Rules/Phone.php index 3d7ff533f..e610008fd 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 \Respect\Validation\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..7d041e636 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Pis.php b/library/Rules/Pis.php index 683bd546c..a8b40ecc6 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/PolishIdCard.php b/library/Rules/PolishIdCard.php index f8d103dba..291de4e9b 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/PortugueseNif.php b/library/Rules/PortugueseNif.php index bfbdb6a1f..e791830ea 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Positive.php b/library/Rules/Positive.php index d6857cffb..bdcc75fb6 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/PrimeNumber.php b/library/Rules/PrimeNumber.php index c5aa2f92a..66caea042 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/PublicDomainSuffix.php b/library/Rules/PublicDomainSuffix.php index d25980b48..8f56a77e4 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 \Respect\Validation\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..eaec42ac5 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Regex.php b/library/Rules/Regex.php index 2eba94e7d..ae5df671d 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/ResourceType.php b/library/Rules/ResourceType.php index d5cf062c4..076eb3784 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/ScalarVal.php b/library/Rules/ScalarVal.php index 955303b06..fbfa8666e 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Size.php b/library/Rules/Size.php index d7e1d472f..7d606f2b1 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Slug.php b/library/Rules/Slug.php index a8263eb78..cdf2a4ca8 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Sorted.php b/library/Rules/Sorted.php index 84037f366..4bf77b8fa 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/StartsWith.php b/library/Rules/StartsWith.php index dc5e0a326..b08c64699 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/StringType.php b/library/Rules/StringType.php index 0dce1d523..e71b54785 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/StringVal.php b/library/Rules/StringVal.php index 469cec986..a19c475cb 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Subset.php b/library/Rules/Subset.php index fddc5d13b..d7b3608d6 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/SymbolicLink.php b/library/Rules/SymbolicLink.php index 6fe9d0fd5..488183b29 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Time.php b/library/Rules/Time.php index dc9f646cf..482cab8ab 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Tld.php b/library/Rules/Tld.php index e297513d1..a0b57e001 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/TrueVal.php b/library/Rules/TrueVal.php index c9018e255..b23ddaf8f 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Type.php b/library/Rules/Type.php index f16d80a30..3dfa1c24a 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Unique.php b/library/Rules/Unique.php index 2ce865c6f..5d527984c 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Uploaded.php b/library/Rules/Uploaded.php index 9bc7edaa9..f89e71a90 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Uppercase.php b/library/Rules/Uppercase.php index 58ae4e06b..648fc5e0e 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Uuid.php b/library/Rules/Uuid.php index 1ea7659c3..5250842db 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Version.php b/library/Rules/Version.php index 6dfb0cf37..494eb46cf 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/VideoUrl.php b/library/Rules/VideoUrl.php index 7ba7d3ca6..04ce796bb 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/When.php b/library/Rules/When.php index 292b47bd3..fcaea66ba 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 \Respect\Validation\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 \Respect\Validation\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 \Respect\Validation\Validator::check()} instead. */ public function check($input): void { diff --git a/library/Rules/Writable.php b/library/Rules/Writable.php index 7b87a8cd3..d147e0373 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 \Respect\Validation\Validator::isValid()} instead. */ public function validate($input): bool { diff --git a/library/Rules/Yes.php b/library/Rules/Yes.php index fc8b27f1f..e41a0fdd0 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 \Respect\Validation\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..69fe91d1b 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -30,6 +30,29 @@ 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: '/Calling `.+\(\)` directly from rules is deprecated. Please use {@see \\Respect\\Validation\\Validator::.+\(\)} instead./' + path: tests/unit/Rules + - + message: '/Calling `.+\(\)` directly from rules is deprecated. Please use {@see \\Respect\\Validation\\Validator::.+\(\)} instead./' + path: tests/unit/FactoryTest.php + - + message: '/Calling `.+\(\)` directly from rules is deprecated. Please use {@see \\Respect\\Validation\\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 \\Respect\\Validation\\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/ From 3c04d1da9d3455d7a1fb13e9ab4cb0f9cc20bf09 Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Tue, 7 Jan 2025 00:43:29 +0100 Subject: [PATCH 2/4] Deprecate all exception classes It won't be possible to catch specific exceptions; users will need to catch `ValidationException`. The `NestedValidationException` will be removed in the next major version, but there's no alternative to it right now, so I didn't deprecate it. --- CONTRIBUTING.md | 38 ------------------- library/Exceptions/AllOfException.php | 1 + library/Exceptions/AlnumException.php | 1 + library/Exceptions/AlphaException.php | 1 + library/Exceptions/AlwaysInvalidException.php | 1 + library/Exceptions/AlwaysValidException.php | 1 + library/Exceptions/AnyOfException.php | 1 + library/Exceptions/ArrayTypeException.php | 1 + library/Exceptions/ArrayValException.php | 1 + library/Exceptions/AttributeException.php | 1 + library/Exceptions/Base64Exception.php | 1 + library/Exceptions/BaseException.php | 1 + library/Exceptions/BetweenException.php | 1 + library/Exceptions/BoolTypeException.php | 1 + library/Exceptions/BoolValException.php | 1 + library/Exceptions/BsnException.php | 1 + library/Exceptions/CallException.php | 1 + library/Exceptions/CallableTypeException.php | 1 + library/Exceptions/CallbackException.php | 1 + library/Exceptions/CharsetException.php | 1 + library/Exceptions/CnhException.php | 1 + library/Exceptions/CnpjException.php | 1 + library/Exceptions/ConsonantException.php | 1 + library/Exceptions/ContainsAnyException.php | 1 + library/Exceptions/ContainsException.php | 1 + library/Exceptions/ControlException.php | 1 + library/Exceptions/CountableException.php | 1 + library/Exceptions/CountryCodeException.php | 1 + library/Exceptions/CpfException.php | 1 + library/Exceptions/CreditCardException.php | 1 + library/Exceptions/CurrencyCodeException.php | 1 + library/Exceptions/DateException.php | 1 + library/Exceptions/DateTimeException.php | 1 + library/Exceptions/DecimalException.php | 1 + library/Exceptions/DigitException.php | 1 + library/Exceptions/DirectoryException.php | 1 + library/Exceptions/DomainException.php | 1 + library/Exceptions/EachException.php | 1 + library/Exceptions/EmailException.php | 1 + library/Exceptions/EndsWithException.php | 1 + library/Exceptions/EqualsException.php | 1 + library/Exceptions/EquivalentException.php | 1 + library/Exceptions/EvenException.php | 1 + library/Exceptions/ExecutableException.php | 1 + library/Exceptions/ExistsException.php | 1 + library/Exceptions/ExtensionException.php | 1 + library/Exceptions/FactorException.php | 1 + library/Exceptions/FalseValException.php | 1 + library/Exceptions/FibonacciException.php | 1 + library/Exceptions/FileException.php | 1 + library/Exceptions/FilterVarException.php | 1 + library/Exceptions/FiniteException.php | 1 + library/Exceptions/FloatTypeException.php | 1 + library/Exceptions/FloatValException.php | 1 + library/Exceptions/GraphException.php | 1 + library/Exceptions/GreaterThanException.php | 1 + library/Exceptions/HexRgbColorException.php | 1 + library/Exceptions/IbanException.php | 1 + library/Exceptions/IdenticalException.php | 1 + library/Exceptions/ImageException.php | 1 + library/Exceptions/ImeiException.php | 1 + library/Exceptions/InException.php | 1 + library/Exceptions/InfiniteException.php | 1 + library/Exceptions/InstanceException.php | 1 + library/Exceptions/IntTypeException.php | 1 + library/Exceptions/IntValException.php | 1 + library/Exceptions/InvalidClassException.php | 1 + library/Exceptions/IpException.php | 1 + library/Exceptions/IsbnException.php | 1 + library/Exceptions/IterableTypeException.php | 1 + library/Exceptions/JsonException.php | 1 + library/Exceptions/KeyException.php | 1 + library/Exceptions/KeyNestedException.php | 1 + library/Exceptions/KeySetException.php | 1 + library/Exceptions/KeyValueException.php | 1 + library/Exceptions/LanguageCodeException.php | 1 + library/Exceptions/LeapDateException.php | 1 + library/Exceptions/LeapYearException.php | 1 + library/Exceptions/LengthException.php | 1 + library/Exceptions/LessThanException.php | 1 + library/Exceptions/LowercaseException.php | 1 + library/Exceptions/LuhnException.php | 1 + library/Exceptions/MacAddressException.php | 1 + library/Exceptions/MaxAgeException.php | 1 + library/Exceptions/MaxException.php | 1 + library/Exceptions/MimetypeException.php | 1 + library/Exceptions/MinAgeException.php | 1 + library/Exceptions/MinException.php | 1 + library/Exceptions/MultipleException.php | 1 + library/Exceptions/NegativeException.php | 1 + library/Exceptions/NfeAccessKeyException.php | 1 + library/Exceptions/NifException.php | 1 + library/Exceptions/NipException.php | 1 + library/Exceptions/NoException.php | 1 + library/Exceptions/NoWhitespaceException.php | 1 + library/Exceptions/NoneOfException.php | 1 + library/Exceptions/NotBlankException.php | 1 + library/Exceptions/NotEmojiException.php | 1 + library/Exceptions/NotEmptyException.php | 1 + library/Exceptions/NotException.php | 1 + library/Exceptions/NotOptionalException.php | 1 + library/Exceptions/NullTypeException.php | 1 + library/Exceptions/NullableException.php | 1 + library/Exceptions/NumberException.php | 1 + library/Exceptions/NumericValException.php | 1 + library/Exceptions/ObjectTypeException.php | 1 + library/Exceptions/OddException.php | 1 + library/Exceptions/OneOfException.php | 1 + library/Exceptions/OptionalException.php | 1 + library/Exceptions/PerfectSquareException.php | 1 + library/Exceptions/PeselException.php | 1 + library/Exceptions/PhoneException.php | 1 + library/Exceptions/PhpLabelException.php | 1 + library/Exceptions/PisException.php | 1 + library/Exceptions/PolishIdCardException.php | 1 + library/Exceptions/PortugueseNifException.php | 1 + library/Exceptions/PositiveException.php | 1 + library/Exceptions/PostalCodeException.php | 1 + library/Exceptions/PrimeNumberException.php | 1 + library/Exceptions/PrintableException.php | 1 + library/Exceptions/PunctException.php | 1 + library/Exceptions/ReadableException.php | 1 + library/Exceptions/RegexException.php | 1 + library/Exceptions/ResourceTypeException.php | 1 + library/Exceptions/RomanException.php | 1 + library/Exceptions/ScalarValException.php | 1 + library/Exceptions/SizeException.php | 1 + library/Exceptions/SlugException.php | 1 + library/Exceptions/SortedException.php | 1 + library/Exceptions/SpaceException.php | 1 + library/Exceptions/StartsWithException.php | 1 + library/Exceptions/StringTypeException.php | 1 + library/Exceptions/StringValException.php | 1 + library/Exceptions/SubsetException.php | 1 + library/Exceptions/SymbolicLinkException.php | 1 + library/Exceptions/TimeException.php | 1 + library/Exceptions/TldException.php | 1 + library/Exceptions/TrueValException.php | 1 + library/Exceptions/TypeException.php | 1 + library/Exceptions/UniqueException.php | 1 + library/Exceptions/UploadedException.php | 1 + library/Exceptions/UppercaseException.php | 1 + library/Exceptions/UrlException.php | 1 + library/Exceptions/UuidException.php | 1 + library/Exceptions/ValidatorException.php | 1 + library/Exceptions/VersionException.php | 1 + library/Exceptions/VideoUrlException.php | 1 + library/Exceptions/VowelException.php | 1 + library/Exceptions/WhenException.php | 1 + library/Exceptions/WritableException.php | 1 + library/Exceptions/XdigitException.php | 1 + library/Exceptions/YesException.php | 1 + phpstan.neon.dist | 2 + 153 files changed, 153 insertions(+), 38 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a760063c4..9ec12d8c2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -79,44 +79,6 @@ final class HelloWorld extends AbstractRule } ``` -### 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/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/phpstan.neon.dist b/phpstan.neon.dist index 69fe91d1b..1ca800ece 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -32,6 +32,8 @@ parameters: 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 \\Respect\\Validation\\Validator::.+\(\)} instead./' path: tests/unit/Rules From 8d989a7bdbe0d4ae2d8ecd397761a7ede302379d Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Tue, 7 Jan 2025 00:34:55 +0100 Subject: [PATCH 3/4] Create a few classes the will be present in the next version This commit will deprecate some classes in favor of a couple of news ones. If there are no customisations to `assert()`, `check()`, and other methods, the migration should be pretty easy on users. --- CONTRIBUTING.md | 15 +++++++-------- docs/06-custom-rules.md | 6 +++--- library/Rules/AbstractComposite.php | 2 ++ library/Rules/AbstractEnvelope.php | 2 ++ library/Rules/AbstractRule.php | 2 ++ library/Rules/AbstractWrapper.php | 2 ++ library/Rules/Core/Composite.php | 21 +++++++++++++++++++++ library/Rules/Core/Envelope.php | 16 ++++++++++++++++ library/Rules/Core/Simple.php | 25 +++++++++++++++++++++++++ library/Rules/Core/Wrapper.php | 16 ++++++++++++++++ phpstan.neon.dist | 2 ++ 11 files changed, 98 insertions(+), 11 deletions(-) create mode 100644 library/Rules/Core/Composite.php create mode 100644 library/Rules/Core/Envelope.php create mode 100644 library/Rules/Core/Simple.php create mode 100644 library/Rules/Core/Wrapper.php diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9ec12d8c2..7538a4668 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,7 +44,7 @@ create a validator that validates if a string is equal to "Hello World". The rule itself needs to implement the `Validatable` interface but, it is convenient to just extend the `AbstractRule` class. -Doing that, you'll only need to declare one method: `validate($input)`. +Doing that, you'll only need to declare one method: `isValid(mixed $input): bool`. This method must return `true` or `false`. If your validator class is `HelloWorld`, it will be available as `v::helloWorld()` @@ -62,17 +62,16 @@ 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'; } @@ -90,8 +89,8 @@ are able to use any methods of it. By extending `RuleTestCase` you should implement two methods that should return a [data provider][] with the rule as first item of the arrays: -- `providerForValidInput`: Will test when `validate()` should return `true` -- `providerForInvalidInput`: Will test when `validate()` should return `false` +- `providerForValidInput`: Will test when `isValid()` should return `true` +- `providerForInvalidInput`: Will test when `isValid()` should return `false` ```php * @author Henrique Moody * @author Wojciech Frącz + * + * @deprecated This class is deprecated, and will be removed in the next major version. Use {@see \Respect\Validation\Rules\Core\Composite} instead. */ abstract class AbstractComposite extends AbstractRule { diff --git a/library/Rules/AbstractEnvelope.php b/library/Rules/AbstractEnvelope.php index e05644218..2c4613cc9 100644 --- a/library/Rules/AbstractEnvelope.php +++ b/library/Rules/AbstractEnvelope.php @@ -19,6 +19,8 @@ * having an custom message. * * @author Henrique Moody + * + * @deprecated This class is deprecated, and will be removed in the next major version. Use {@see \Respect\Validation\Rules\Core\Envelop} instead. */ abstract class AbstractEnvelope extends AbstractRule { diff --git a/library/Rules/AbstractRule.php b/library/Rules/AbstractRule.php index 861b02039..01c6f084f 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 \Respect\Validation\Rules\Core\Simple} instead. */ abstract class AbstractRule implements Validatable { diff --git a/library/Rules/AbstractWrapper.php b/library/Rules/AbstractWrapper.php index a26bed1bf..9b3d77194 100644 --- a/library/Rules/AbstractWrapper.php +++ b/library/Rules/AbstractWrapper.php @@ -16,6 +16,8 @@ * * @author Alasdair North * @author Henrique Moody + * + * @deprecated This class is deprecated, and will be removed in the next major version. Use {@see \Respect\Validation\Rules\Core\Wrapper} instead. */ abstract class AbstractWrapper extends AbstractRule { diff --git a/library/Rules/Core/Composite.php b/library/Rules/Core/Composite.php new file mode 100644 index 000000000..761cdb668 --- /dev/null +++ b/library/Rules/Core/Composite.php @@ -0,0 +1,21 @@ + + * SPDX-License-Identifier: MIT + */ + +declare(strict_types=1); + +namespace Respect\Validation\Rules\Core; + +use Respect\Validation\Rules\AbstractComposite; +use Respect\Validation\Validatable; + +abstract class Composite extends AbstractComposite +{ + public function __construct(Validatable $rule1, Validatable $rule2, Validatable ...$rules) + { + parent::__construct($rule1, $rule2, ...$rules); + } +} diff --git a/library/Rules/Core/Envelope.php b/library/Rules/Core/Envelope.php new file mode 100644 index 000000000..16585722c --- /dev/null +++ b/library/Rules/Core/Envelope.php @@ -0,0 +1,16 @@ + + * SPDX-License-Identifier: MIT + */ + +declare(strict_types=1); + +namespace Respect\Validation\Rules\Core; + +use Respect\Validation\Rules\AbstractEnvelope; + +abstract class Envelope extends AbstractEnvelope +{ +} diff --git a/library/Rules/Core/Simple.php b/library/Rules/Core/Simple.php new file mode 100644 index 000000000..7dbed49e0 --- /dev/null +++ b/library/Rules/Core/Simple.php @@ -0,0 +1,25 @@ + + * SPDX-License-Identifier: MIT + */ + +declare(strict_types=1); + +namespace Respect\Validation\Rules\Core; + +use Respect\Validation\Rules\AbstractRule; + +abstract class Simple extends AbstractRule +{ + abstract public function isValid(mixed $input): bool; + + /** + * @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/Core/Wrapper.php b/library/Rules/Core/Wrapper.php new file mode 100644 index 000000000..d5e9d63a1 --- /dev/null +++ b/library/Rules/Core/Wrapper.php @@ -0,0 +1,16 @@ + + * SPDX-License-Identifier: MIT + */ + +declare(strict_types=1); + +namespace Respect\Validation\Rules\Core; + +use Respect\Validation\Rules\AbstractWrapper; + +abstract class Wrapper extends AbstractWrapper +{ +} diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 1ca800ece..1456a1e10 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -34,6 +34,8 @@ parameters: # Why: Deprecations of version 3.0 - message: '/Using rule exceptions directly is deprecated, and will be removed in the next major version\./' + - message: '/This class is deprecated, and will be removed in the next major version\./' + - message: '/Calling `.+\(\)` directly from rules is deprecated. Please use {@see \\Respect\\Validation\\Validator::.+\(\)} instead./' path: tests/unit/Rules From 48b38bd91e0badbc2c4381dce726b09fd68850d9 Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Tue, 7 Jan 2025 01:34:58 +0100 Subject: [PATCH 4/4] Update Codecov settings --- codecov.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..0df0e49da --- /dev/null +++ b/codecov.yml @@ -0,0 +1,6 @@ +coverage: + status: + project: + default: + target: 94% # the required coverage value + threshold: 1% # the leniency in hitting the target