├── art ├── mighty-demo.png └── mighty-demo.php ├── .gitignore ├── .editorconfig ├── src ├── Throwable.php ├── Exception │ ├── ValidatorThrowable.php │ ├── InexecutableRuleException.php │ ├── InvalidRuleStatementException.php │ ├── InvalidRuleDefinitionException.php │ ├── InvalidBitwiseExpressionException.php │ ├── InvalidRuleAliasException.php │ ├── InvalidRuleMacroException.php │ ├── InvalidValidationExpressionException.php │ ├── ValidationFailedException.php │ ├── ValidationLogicException.php │ └── UnknownValidationRuleException.php └── Validation │ ├── Strategy.php │ ├── Behavior.php │ ├── Operator.php │ ├── Constraint │ ├── ValidatesOne.php │ ├── ValidatesMany.php │ └── Rule │ │ ├── Arr.php │ │ ├── Obj.php │ │ ├── Str.php │ │ ├── Ip.php │ │ ├── Long.php │ │ ├── Real.php │ │ ├── Url.php │ │ ├── Blank.php │ │ ├── Date.php │ │ ├── Is.php │ │ ├── Mac.php │ │ ├── Xml.php │ │ ├── Double.php │ │ ├── Filled.php │ │ ├── Json.php │ │ ├── Size.php │ │ ├── Slug.php │ │ ├── Stream.php │ │ ├── Domain.php │ │ ├── Email.php │ │ ├── Emoji.php │ │ ├── IpV4.php │ │ ├── IpV6.php │ │ ├── Present.php │ │ ├── Same.php │ │ ├── Scalar.php │ │ ├── BoolConstraint.php │ │ ├── Boolean.php │ │ ├── IntConstraint.php │ │ ├── Integer.php │ │ ├── Length.php │ │ ├── NullConstraint.php │ │ ├── Optional.php │ │ ├── Roman.php │ │ ├── Bic.php │ │ ├── Cakeday.php │ │ ├── Cvv.php │ │ ├── Regex.php │ │ ├── ArrayConstraint.php │ │ ├── Countable.php │ │ ├── Esn.php │ │ ├── FileIsFile.php │ │ ├── FileIsLink.php │ │ ├── FloatConstraint.php │ │ ├── Pattern.php │ │ ├── Ssn.php │ │ ├── Xdigit.php │ │ ├── Alpha.php │ │ ├── Base64.php │ │ ├── Cntrl.php │ │ ├── ColorHex.php │ │ ├── ColorHsl.php │ │ ├── ColorRgb.php │ │ ├── Lower.php │ │ ├── NumericConstraint.php │ │ ├── ObjectConstraint.php │ │ ├── Punct.php │ │ ├── Sin.php │ │ ├── Space.php │ │ ├── StringConstraint.php │ │ ├── Upper.php │ │ ├── Vin.php │ │ ├── Alnum.php │ │ ├── Bit.php │ │ ├── ColorHsla.php │ │ ├── ColorRgba.php │ │ ├── Meid.php │ │ ├── Minmax.php │ │ ├── Nino.php │ │ ├── NumberIsNan.php │ │ ├── NumberIsOdd.php │ │ ├── Range.php │ │ ├── Type.php │ │ ├── Version.php │ │ ├── CallableConstraint.php │ │ ├── DateAfter.php │ │ ├── Datetime.php │ │ ├── Digit.php │ │ ├── File.php │ │ ├── IterableConstraint.php │ │ ├── NumberIsEven.php │ │ ├── PhpKeyword.php │ │ ├── ResourceConstraint.php │ │ ├── BitIsOn.php │ │ ├── ColorHslNew.php │ │ ├── ColorKeyword.php │ │ ├── ColorRgbNew.php │ │ ├── DateBefore.php │ │ ├── DateEquals.php │ │ ├── DateFormat.php │ │ ├── Forbidden.php │ │ ├── Issn.php │ │ ├── Serialized.php │ │ ├── BitIsOff.php │ │ ├── FileIsDirectory.php │ │ ├── Image.php │ │ ├── NumberIsFinite.php │ │ ├── PhpReserved.php │ │ ├── PrintConstraint.php │ │ ├── UrlWithPath.php │ │ ├── ColorHexLong.php │ │ ├── FileIsReadable.php │ │ ├── FileIsWritable.php │ │ ├── Isin.php │ │ ├── Spaceless.php │ │ ├── Text.php │ │ ├── UrlWithQuery.php │ │ ├── ArrayHasKey.php │ │ ├── Ascii.php │ │ ├── AssertEquals.php │ │ ├── ColorHexShort.php │ │ ├── Imei.php │ │ ├── NumberIsInfinite.php │ │ ├── NumberIsNegative.php │ │ ├── NumberIsPositive.php │ │ ├── Regexp.php │ │ ├── ArrayIsSequential.php │ │ ├── Assert.php │ │ ├── Color.php │ │ ├── CurrencyName.php │ │ ├── FileIsExecutable.php │ │ ├── Required.php │ │ ├── Words.php │ │ ├── ArrayIsAssociative.php │ │ ├── AssertLessThan.php │ │ ├── ColorHexAlpha.php │ │ ├── FileIsUploaded.php │ │ ├── Graph.php │ │ ├── IpNotPrivate.php │ │ ├── Matches.php │ │ ├── ObjectHasMethod.php │ │ ├── TypeDebug.php │ │ ├── AssertNotEquals.php │ │ ├── DateAfterOrEquals.php │ │ ├── EmailWithUnicode.php │ │ ├── IpNotReserved.php │ │ ├── Meta.php │ │ ├── ObjectIsStringable.php │ │ ├── AssertGreaterThan.php │ │ ├── DateBeforeOrEquals.php │ │ ├── DomainIsActive.php │ │ ├── StringLength.php │ │ └── CalenderDay.php │ └── Logic │ └── macros.php └── LICENSE /art/mighty-demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarwanAlsoltany/mighty/HEAD/art/mighty-demo.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # https://git-scm.com/docs/gitignore 2 | 3 | .vscode 4 | .idea 5 | 6 | test.php 7 | vendor/* 8 | build/* 9 | !**/.gitkeep 10 | 11 | *.phar 12 | *.bak 13 | *.cache 14 | *.lock 15 | *.xml 16 | *.log 17 | *.sql 18 | *.sqlite 19 | *.db 20 | .Trashes 21 | .DS_Store 22 | .DS_Store? 23 | .Spotlight-V100 24 | ._* 25 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | ; This file is for unifying the coding style for different editors and IDEs. 2 | ; More information at https://editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | indent_size = 4 9 | indent_style = space 10 | end_of_line = lf 11 | insert_final_newline = true 12 | trim_trailing_whitespace = true 13 | 14 | [*.{js,css,scss}] 15 | indent_size = 2 16 | 17 | [*.md] 18 | trim_trailing_whitespace = false 19 | -------------------------------------------------------------------------------- /src/Throwable.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty; 13 | 14 | use Throwable as CoreThrowable; 15 | 16 | /** 17 | * Mighty throwable interface. 18 | * 19 | * @package Mighty 20 | */ 21 | interface Throwable extends CoreThrowable 22 | { 23 | // ... 24 | } 25 | -------------------------------------------------------------------------------- /src/Exception/ValidatorThrowable.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Exception; 13 | 14 | use MAKS\Mighty\Throwable; 15 | 16 | /** 17 | * Validator throwable interface. 18 | * 19 | * @package Mighty\Validator 20 | */ 21 | interface ValidatorThrowable extends Throwable 22 | { 23 | // ... 24 | } 25 | -------------------------------------------------------------------------------- /src/Validation/Strategy.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation; 13 | 14 | use MAKS\Mighty\Validation\SmartEnum; 15 | 16 | /** 17 | * Validation constraint strategy. 18 | * 19 | * @package Mighty\Validator 20 | */ 21 | enum Strategy 22 | { 23 | use SmartEnum; 24 | 25 | 26 | case FailFast; 27 | 28 | case FailLazy; 29 | } 30 | -------------------------------------------------------------------------------- /src/Exception/InexecutableRuleException.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Exception; 13 | 14 | use RuntimeException as Exception; 15 | use MAKS\Mighty\Throwable; 16 | 17 | /** 18 | * Exception thrown when validation rule execution fails. 19 | * 20 | * @package Mighty 21 | */ 22 | class InexecutableRuleException extends Exception implements Throwable 23 | { 24 | // ... 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/InvalidRuleStatementException.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Exception; 13 | 14 | use InvalidArgumentException as Exception; 15 | use MAKS\Mighty\Throwable; 16 | 17 | /** 18 | * Exception thrown when rule statement is invalid. 19 | * 20 | * @package Mighty 21 | */ 22 | class InvalidRuleStatementException extends Exception implements Throwable 23 | { 24 | // ... 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/InvalidRuleDefinitionException.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Exception; 13 | 14 | use InvalidArgumentException as Exception; 15 | use MAKS\Mighty\Throwable; 16 | 17 | /** 18 | * Exception thrown when rule definition is invalid. 19 | * 20 | * @package Mighty 21 | */ 22 | class InvalidRuleDefinitionException extends Exception implements Throwable 23 | { 24 | // ... 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/InvalidBitwiseExpressionException.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Exception; 13 | 14 | use RuntimeException as Exception; 15 | use MAKS\Mighty\Throwable; 16 | 17 | /** 18 | * Exception thrown when a bitwise expression is invalid. 19 | * 20 | * @package Mighty 21 | */ 22 | class InvalidBitwiseExpressionException extends Exception implements Throwable 23 | { 24 | // ... 25 | } 26 | -------------------------------------------------------------------------------- /src/Validation/Behavior.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation; 13 | 14 | use MAKS\Mighty\Validation\SmartEnum; 15 | 16 | /** 17 | * Validation expression behavior. 18 | * 19 | * @package Mighty\Validator 20 | */ 21 | enum Behavior: string 22 | { 23 | use SmartEnum; 24 | 25 | 26 | case Normal = ''; 27 | 28 | case Optimistic = '?'; 29 | 30 | case Pessimistic = '!'; 31 | } 32 | -------------------------------------------------------------------------------- /src/Exception/InvalidRuleAliasException.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Exception; 13 | 14 | use InvalidArgumentException as Exception; 15 | use MAKS\Mighty\Throwable; 16 | 17 | /** 18 | * Exception thrown when an attempt is made to create a rule alias that is invalid. 19 | * 20 | * @package Mighty 21 | */ 22 | class InvalidRuleAliasException extends Exception implements Throwable 23 | { 24 | // ... 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/InvalidRuleMacroException.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Exception; 13 | 14 | use InvalidArgumentException as Exception; 15 | use MAKS\Mighty\Throwable; 16 | 17 | /** 18 | * Exception thrown when an attempt is made to create a rule macro that is invalid. 19 | * 20 | * @package Mighty 21 | */ 22 | class InvalidRuleMacroException extends Exception implements Throwable 23 | { 24 | // ... 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/InvalidValidationExpressionException.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Exception; 13 | 14 | use RuntimeException as Exception; 15 | use MAKS\Mighty\Exception\ValidatorThrowable; 16 | 17 | /** 18 | * Exception thrown when a validation expression is invalid. 19 | * 20 | * @package Mighty 21 | */ 22 | class InvalidValidationExpressionException extends Exception implements ValidatorThrowable 23 | { 24 | // ... 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/ValidationFailedException.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Exception; 13 | 14 | use UnexpectedValueException as Exception; 15 | use MAKS\Mighty\Exception\ValidatorThrowable; 16 | 17 | /** 18 | * Exception thrown when validation is not successful or failed. 19 | * 20 | * @package Mighty\Validator 21 | */ 22 | class ValidationFailedException extends Exception implements ValidatorThrowable 23 | { 24 | // ... 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/ValidationLogicException.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Exception; 13 | 14 | use LogicException as Exception; 15 | use MAKS\Mighty\Exception\ValidatorThrowable; 16 | 17 | /** 18 | * Exception thrown when validation is impossible or validation expression is illogical. 19 | * 20 | * @package Mighty\Validator 21 | */ 22 | class ValidationLogicException extends Exception implements ValidatorThrowable 23 | { 24 | // ... 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/UnknownValidationRuleException.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Exception; 13 | 14 | use RangeException as Exception; 15 | use MAKS\Mighty\Exception\ValidatorThrowable; 16 | 17 | /** 18 | * Exception thrown when attempt is made to execute an unknown validation rule. 19 | * 20 | * @package Mighty\Validator 21 | */ 22 | class UnknownValidationRuleException extends Exception implements ValidatorThrowable 23 | { 24 | // ... 25 | } 26 | -------------------------------------------------------------------------------- /src/Validation/Operator.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation; 13 | 14 | use MAKS\Mighty\Validation\SmartEnum; 15 | 16 | /** 17 | * Validation expression operator. 18 | * 19 | * @package Mighty\Validator 20 | */ 21 | enum Operator: string 22 | { 23 | use SmartEnum; 24 | 25 | 26 | case Not = '~'; 27 | 28 | case And = '&'; 29 | 30 | case Or = '|'; 31 | 32 | case Xor = '^'; 33 | 34 | case Open = '('; 35 | 36 | case Close = ')'; 37 | } 38 | -------------------------------------------------------------------------------- /src/Validation/Constraint/ValidatesOne.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint; 13 | 14 | use MAKS\Mighty\Result; 15 | use MAKS\Mighty\Validation\Constraint\ValidatesAny; 16 | 17 | /** 18 | * Interface for constraints that validate a single item. 19 | * 20 | * @package Mighty\Validator 21 | */ 22 | interface ValidatesOne extends ValidatesAny 23 | { 24 | /** 25 | * {@inheritDoc} 26 | * 27 | * @return Result The validation result. 28 | */ 29 | public function validate(mixed $value = null): Result; 30 | } 31 | -------------------------------------------------------------------------------- /src/Validation/Constraint/ValidatesMany.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint; 13 | 14 | use MAKS\Mighty\Result; 15 | use MAKS\Mighty\Validation\Constraint\ValidatesAny; 16 | 17 | /** 18 | * Interface for constraints that validate multiple items. 19 | * 20 | * @package Mighty\Validator 21 | */ 22 | interface ValidatesMany extends ValidatesAny 23 | { 24 | /** 25 | * {@inheritDoc} 26 | * 27 | * @return array The validation results. 28 | */ 29 | public function validate(mixed $value = null): array; 30 | } 31 | -------------------------------------------------------------------------------- /art/mighty-demo.php: -------------------------------------------------------------------------------- 1 | arrayIsSequential())->getResult(); 9 | 10 | // validate structured data 11 | $results = ($validator = new Validator()) 12 | ->setData([ 13 | 'name' => 'John Doe', 14 | 'age' => 25, 15 | 'hobbies' => ['coding', 'reading'], 16 | 'consent' => 'yes', 17 | ]) 18 | ->setValidations([ 19 | 'name' => $validator->validation()->string()->stringCharset('UTF-8'), 20 | 'age' => $validator->validation()->integer()->between(16, 63), 21 | 'hobbies' => $validator->validation()->array()->not()->empty(), 22 | 'hobbies.*' => $validator->validation()->string()->between(3, 21), 23 | 'consent' => $validator->validation()->if('${age.value}', 18, '>')->or()->accepted()->optimistic(), 24 | ]) 25 | ->validate(); 26 | 27 | // validate data using constraints (can also be used as attributes) 28 | $result = (new Constraint\Rule\Currency())->validate('USD')->getResult(); 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Marwan Al-Soltany 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | --- 24 | 25 | Project based on [`php-package`](https://github.com/MarwanAlsoltany/php-package) template by [Marwan Al-Soltany](https://github.com/MarwanAlsoltany) 26 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Arr.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `arr` rule. An alias for the `array` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Arr extends Rule 30 | { 31 | public const NAME = 'arr'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Obj.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `obj` rule. An alias for the `object` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Obj extends Rule 30 | { 31 | public const NAME = 'obj'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Str.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `str` rule. An alias for the `string` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Str extends Rule 30 | { 31 | public const NAME = 'str'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Ip.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `ip` rule. Asserts that the input is an IP address. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Ip extends Rule 30 | { 31 | public const NAME = 'ip'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Long.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `long` rule. An alias for the `integer` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Long extends Rule 30 | { 31 | public const NAME = 'long'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Real.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `real` rule. An alias for the `float` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Real extends Rule 30 | { 31 | public const NAME = 'real'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Url.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `url` rule. Asserts that the input is a URL. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Url extends Rule 30 | { 31 | public const NAME = 'url'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Blank.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `blank` rule. An alias for the `empty` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Blank extends Rule 30 | { 31 | public const NAME = 'blank'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Date.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `date` rule. An alias for the `datetime` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Date extends Rule 30 | { 31 | public const NAME = 'date'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Is.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `is` rule. An alias for the `equals` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Is extends Rule 30 | { 31 | public const NAME = 'is'; 32 | 33 | public function __construct(mixed $value, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Mac.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `mac` rule. Asserts that the input is a MAC address. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Mac extends Rule 30 | { 31 | public const NAME = 'mac'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Xml.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `xml` rule. Asserts that the input is a valid XML. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Xml extends Rule 30 | { 31 | public const NAME = 'xml'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Double.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `double` rule. An alias for the `float` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Double extends Rule 30 | { 31 | public const NAME = 'double'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Filled.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `filled` rule. An alias for the `required` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Filled extends Rule 30 | { 31 | public const NAME = 'filled'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Json.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `json` rule. Asserts that the input is a valid JSON. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Json extends Rule 30 | { 31 | public const NAME = 'json'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Size.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `size` rule. An alias for the `count` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Size extends Rule 30 | { 31 | public const NAME = 'size'; 32 | 33 | public function __construct(int $size, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Slug.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `slug` rule. Asserts that the input is a valid slug. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Slug extends Rule 30 | { 31 | public const NAME = 'slug'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Stream.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `stream` rule. An alias for the `resource` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Stream extends Rule 30 | { 31 | public const NAME = 'stream'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Domain.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `domain` rule. Asserts that the input is a domain. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Domain extends Rule 30 | { 31 | public const NAME = 'domain'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Email.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `email` rule. Asserts that the input is an email address. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Email extends Rule 30 | { 31 | public const NAME = 'email'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Emoji.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `emoji` rule. Asserts that the input contains an emoji. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Emoji extends Rule 30 | { 31 | public const NAME = 'emoji'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/IpV4.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `ip.v4` rule. Asserts that the input is an IPv4 address. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class IpV4 extends Rule 30 | { 31 | public const NAME = 'ip.v4'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/IpV6.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `ip.v6` rule. Asserts that the input is an IPv6 address. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class IpV6 extends Rule 30 | { 31 | public const NAME = 'ip.v6'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Present.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `present` rule. An alias for the `required` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Present extends Rule 30 | { 31 | public const NAME = 'present'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Same.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `same` rule. An alias for the `equals` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Same extends Rule 30 | { 31 | public const NAME = 'same'; 32 | 33 | public function __construct(mixed $value, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Scalar.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `scalar` rule. Asserts that the input is a scalar. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Scalar extends Rule 30 | { 31 | public const NAME = 'scalar'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/BoolConstraint.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `bool` rule. An alias for the `boolean` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class BoolConstraint extends Rule 30 | { 31 | public const NAME = 'bool'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Boolean.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `boolean` rule. Asserts that the input is a boolean. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Boolean extends Rule 30 | { 31 | public const NAME = 'boolean'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/IntConstraint.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `int` rule. An alias for the `integer` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class IntConstraint extends Rule 30 | { 31 | public const NAME = 'int'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Integer.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `integer` rule. Asserts that the input is an integer. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Integer extends Rule 30 | { 31 | public const NAME = 'integer'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Length.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `length` rule. An alias for the `count` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Length extends Rule 30 | { 31 | public const NAME = 'length'; 32 | 33 | public function __construct(int $count, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/NullConstraint.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `null` rule. Asserts that the input is null. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class NullConstraint extends Rule 30 | { 31 | public const NAME = 'null'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Optional.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `optional` rule. An alias for the `allowed` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Optional extends Rule 30 | { 31 | public const NAME = 'optional'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Roman.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `roman` rule. Asserts that the input is a valid roman number. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Roman extends Rule 30 | { 31 | public const NAME = 'roman'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Bic.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `bic` rule. Asserts that the input is a valid BIC (Bank Identifier Code). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Bic extends Rule 30 | { 31 | public const NAME = 'bic'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Cakeday.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `cakeday` rule. An alias for the `datetime.birthday` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Cakeday extends Rule 30 | { 31 | public const NAME = 'cakeday'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Cvv.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `cvv` rule. Asserts that the input is a valid CVV (Card Security Code). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Cvv extends Rule 30 | { 31 | public const NAME = 'cvv'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Regex.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `regex` rule. Asserts that the input is a valid regular expression. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Regex extends Rule 30 | { 31 | public const NAME = 'regex'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ArrayConstraint.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `array` rule. Asserts that the input is an array. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ArrayConstraint extends Rule 30 | { 31 | public const NAME = 'array'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Countable.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `countable` rule. Asserts that the input is a countable. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Countable extends Rule 30 | { 31 | public const NAME = 'countable'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Esn.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `esn` rule. Asserts that the input is a valid ESN (Electronic Serial Number). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Esn extends Rule 30 | { 31 | public const NAME = 'esn'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/FileIsFile.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `file.isFile` rule. Asserts that the input is a file. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class FileIsFile extends Rule 30 | { 31 | public const NAME = 'file.isFile'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/FileIsLink.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `file.isLink` rule. Asserts that the input is a link. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class FileIsLink extends Rule 30 | { 31 | public const NAME = 'file.isLink'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/FloatConstraint.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `float` rule. Asserts that the input is a float. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class FloatConstraint extends Rule 30 | { 31 | public const NAME = 'float'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Pattern.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `pattern` rule. An alias for the `matches` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Pattern extends Rule 30 | { 31 | public const NAME = 'pattern'; 32 | 33 | public function __construct(string $pattern, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Ssn.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `ssn` rule. Asserts that the input is a valid SSN (Social Security Number). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Ssn extends Rule 30 | { 31 | public const NAME = 'ssn'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Xdigit.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `xdigit` rule. Asserts that the input represent hexadecimal digits. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Xdigit extends Rule 30 | { 31 | public const NAME = 'xdigit'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Alpha.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `alpha` rule. Asserts that the input consists of alphabetic characters only. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Alpha extends Rule 30 | { 31 | public const NAME = 'alpha'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Base64.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `base64` rule. Asserts that the input is a valid Base64 encoded string. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Base64 extends Rule 30 | { 31 | public const NAME = 'base64'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Cntrl.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `cntrl` rule. Asserts that the input consists of control characters only. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Cntrl extends Rule 30 | { 31 | public const NAME = 'cntrl'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ColorHex.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `color.hex` rule. Asserts that the input is a valid CSS HEX color. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ColorHex extends Rule 30 | { 31 | public const NAME = 'color.hex'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ColorHsl.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `color.hsl` rule. Asserts that the input is a valid CSS HSL color. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ColorHsl extends Rule 30 | { 31 | public const NAME = 'color.hsl'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ColorRgb.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `color.rgb` rule. Asserts that the input is a valid CSS RGB color. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ColorRgb extends Rule 30 | { 31 | public const NAME = 'color.rgb'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Lower.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `lower` rule. Asserts that the input consists of lowercase characters only. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Lower extends Rule 30 | { 31 | public const NAME = 'lower'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/NumericConstraint.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `numeric` rule. Asserts that the input is numeric. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class NumericConstraint extends Rule 30 | { 31 | public const NAME = 'numeric'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ObjectConstraint.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `object` rule. Asserts that the input is an object. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ObjectConstraint extends Rule 30 | { 31 | public const NAME = 'object'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Punct.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `punct` rule. Asserts that the input consists of punctuation characters only. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Punct extends Rule 30 | { 31 | public const NAME = 'punct'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Sin.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `sin` rule. Asserts that the input is a valid SIN (CA Social Insurance Number). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Sin extends Rule 30 | { 31 | public const NAME = 'sin'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Space.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `space` rule. Asserts that the input consists of whitespace characters only. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Space extends Rule 30 | { 31 | public const NAME = 'space'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/StringConstraint.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `string` rule. Asserts that the input is a string. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class StringConstraint extends Rule 30 | { 31 | public const NAME = 'string'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Upper.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `upper` rule. Asserts that the input consists of uppercase characters only. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Upper extends Rule 30 | { 31 | public const NAME = 'upper'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Vin.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `vin` rule. Asserts that the input is a valid VIN (Vehicle Identification Number). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Vin extends Rule 30 | { 31 | public const NAME = 'vin'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Alnum.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `alnum` rule. Asserts that the input consists of alphanumeric characters only. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Alnum extends Rule 30 | { 31 | public const NAME = 'alnum'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Bit.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `bit` rule. Asserts that the input is bit (equals: 1 or "1", true; 0 or "0", false). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Bit extends Rule 30 | { 31 | public const NAME = 'bit'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ColorHsla.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `color.hsla` rule. Asserts that the input is a valid CSS HSLA color. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ColorHsla extends Rule 30 | { 31 | public const NAME = 'color.hsla'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ColorRgba.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `color.rgba` rule. Asserts that the input is a valid CSS RGBA color. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ColorRgba extends Rule 30 | { 31 | public const NAME = 'color.rgba'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Meid.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `meid` rule. Asserts that the input is a valid MEID (Mobile Equipment Identifier). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Meid extends Rule 30 | { 31 | public const NAME = 'meid'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Minmax.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `minmax` rule. An alias for the `between` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Minmax extends Rule 30 | { 31 | public const NAME = 'minmax'; 32 | 33 | public function __construct(int|float $min, int|float $max, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 2); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Nino.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `nino` rule. Asserts that the input is a valid NINO (UK National Insurance Number). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Nino extends Rule 30 | { 31 | public const NAME = 'nino'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/NumberIsNan.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `number.isNan` rule. Asserts that the input is a not a number. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class NumberIsNan extends Rule 30 | { 31 | public const NAME = 'number.isNan'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/NumberIsOdd.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `number.isOdd` rule. Asserts that the input is an odd number. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class NumberIsOdd extends Rule 30 | { 31 | public const NAME = 'number.isOdd'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Range.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `range` rule. An alias for the `between` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Range extends Rule 30 | { 31 | public const NAME = 'range'; 32 | 33 | public function __construct(int|float $min, int|float $max, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 2); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Type.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `type` rule. Asserts that the input is one of the given types. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Type extends Rule 30 | { 31 | public const NAME = 'type'; 32 | 33 | public function __construct(string|array $type, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Version.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `version` rule. Asserts that the input is a valid semantic version number. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Version extends Rule 30 | { 31 | public const NAME = 'version'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/CallableConstraint.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `callable` rule. Asserts that the input is a callable. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class CallableConstraint extends Rule 30 | { 31 | public const NAME = 'callable'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/DateAfter.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `date.after` rule. An alias for the `datetime.gt` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class DateAfter extends Rule 30 | { 31 | public const NAME = 'date.after'; 32 | 33 | public function __construct(string $datetime, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Datetime.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `datetime` rule. Asserts that the input is a valid datetime string/object. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Datetime extends Rule 30 | { 31 | public const NAME = 'datetime'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Digit.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `digit` rule. Asserts that the input consists of a digits only (numeric characters). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Digit extends Rule 30 | { 31 | public const NAME = 'digit'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/File.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `file` rule. Asserts that the input is a file (can be a file, a link, or a directory). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class File extends Rule 30 | { 31 | public const NAME = 'file'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/IterableConstraint.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `iterable` rule. Asserts that the input is an iterable. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class IterableConstraint extends Rule 30 | { 31 | public const NAME = 'iterable'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/NumberIsEven.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `number.isEven` rule. Asserts that the input is an even number. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class NumberIsEven extends Rule 30 | { 31 | public const NAME = 'number.isEven'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/PhpKeyword.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `php.keyword` rule. Asserts that the input is a PHP language Keyword. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class PhpKeyword extends Rule 30 | { 31 | public const NAME = 'php.keyword'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ResourceConstraint.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `resource` rule. Asserts that the input is a resource. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ResourceConstraint extends Rule 30 | { 31 | public const NAME = 'resource'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/BitIsOn.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `bit.isOn` rule. Asserts that the input is a turned on bit (equals: true, 1 or "1"). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class BitIsOn extends Rule 30 | { 31 | public const NAME = 'bit.isOn'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ColorHslNew.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `color.hsl.new` rule. Asserts that the input is a valid CSS4 HSL color. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ColorHslNew extends Rule 30 | { 31 | public const NAME = 'color.hsl.new'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ColorKeyword.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `color.keyword` rule. Asserts that the input is a valid CSS YYY color. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ColorKeyword extends Rule 30 | { 31 | public const NAME = 'color.keyword'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ColorRgbNew.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `color.rgb.new` rule. Asserts that the input is a valid CSS4 RGB color. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ColorRgbNew extends Rule 30 | { 31 | public const NAME = 'color.rgb.new'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/DateBefore.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `date.before` rule. An alias for the `datetime.lt` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class DateBefore extends Rule 30 | { 31 | public const NAME = 'date.before'; 32 | 33 | public function __construct(string $datetime, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/DateEquals.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `date.equals` rule. An alias for the `datetime.eq` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class DateEquals extends Rule 30 | { 31 | public const NAME = 'date.equals'; 32 | 33 | public function __construct(string $datetime, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/DateFormat.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `date.format` rule. An alias for the `datetime.format` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class DateFormat extends Rule 30 | { 31 | public const NAME = 'date.format'; 32 | 33 | public function __construct(string $format, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Forbidden.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `forbidden` rule. Asserts that the input is forbidden (is null or not present). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Forbidden extends Rule 30 | { 31 | public const NAME = 'forbidden'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Issn.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `issn` rule. Asserts that the input is a valid ISSN (International Standard Serial Number). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Issn extends Rule 30 | { 31 | public const NAME = 'issn'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Serialized.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `serialized` rule. Asserts that the input is a valid PHP serialized data. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Serialized extends Rule 30 | { 31 | public const NAME = 'serialized'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/BitIsOff.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `bit.isOff` rule. Asserts that the input is a turned off bit (equals: false, 0 or "0"). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class BitIsOff extends Rule 30 | { 31 | public const NAME = 'bit.isOff'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/FileIsDirectory.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `file.isDirectory` rule. Asserts that the input is a directory. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class FileIsDirectory extends Rule 30 | { 31 | public const NAME = 'file.isDirectory'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Image.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `image` rule. Asserts that the input is an image file (jpg, jpeg, png, gif, bmp, svg, or webp). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Image extends Rule 30 | { 31 | public const NAME = 'image'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/NumberIsFinite.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `number.isFinite` rule. Asserts that the input is a finite number. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class NumberIsFinite extends Rule 30 | { 31 | public const NAME = 'number.isFinite'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/PhpReserved.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `php.reserved` rule. Asserts that the input is a PHP language reserved word. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class PhpReserved extends Rule 30 | { 31 | public const NAME = 'php.reserved'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/PrintConstraint.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `print` rule. Asserts that the input consists of printable characters only. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class PrintConstraint extends Rule 30 | { 31 | public const NAME = 'print'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/UrlWithPath.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `url.withPath` rule. Asserts that the input is a URL that contains a path. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class UrlWithPath extends Rule 30 | { 31 | public const NAME = 'url.withPath'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ColorHexLong.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `color.hexLong` rule. Asserts that the input is a valid CSS 6-Char-HEX color. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ColorHexLong extends Rule 30 | { 31 | public const NAME = 'color.hexLong'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/FileIsReadable.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `file.isReadable` rule. Asserts that the input is a file and is readable. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class FileIsReadable extends Rule 30 | { 31 | public const NAME = 'file.isReadable'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/FileIsWritable.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `file.isWritable` rule. Asserts that the input is a file and is writable. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class FileIsWritable extends Rule 30 | { 31 | public const NAME = 'file.isWritable'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Isin.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `isin` rule. Asserts that the input is a valid ISIN (International Securities Identification Number). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Isin extends Rule 30 | { 31 | public const NAME = 'isin'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Spaceless.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `spaceless` rule. Asserts that the input is a string containing no whitespace characters. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Spaceless extends Rule 30 | { 31 | public const NAME = 'spaceless'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Text.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `text` rule. Asserts that the input is a string containing letters and punctuation from any language. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Text extends Rule 30 | { 31 | public const NAME = 'text'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/UrlWithQuery.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `url.withQuery` rule. Asserts that the input is a URL that contains a query. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class UrlWithQuery extends Rule 30 | { 31 | public const NAME = 'url.withQuery'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ArrayHasKey.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `array.hasKey` rule. Asserts that the input array has the given key. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ArrayHasKey extends Rule 30 | { 31 | public const NAME = 'array.hasKey'; 32 | 33 | public function __construct(string|int $key, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Ascii.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `ascii` rule. Asserts that the input is a string containing only ASCII characters (ASCII compliant string). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Ascii extends Rule 30 | { 31 | public const NAME = 'ascii'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/AssertEquals.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `assert.equals` rule. An alias for the `if.eq` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class AssertEquals extends Rule 30 | { 31 | public const NAME = 'assert.equals'; 32 | 33 | public function __construct(mixed $actual, mixed $expected, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 2); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ColorHexShort.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `color.hexShort` rule. Asserts that the input is a valid CSS 3-Char-HEX color. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ColorHexShort extends Rule 30 | { 31 | public const NAME = 'color.hexShort'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Imei.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `imei` rule. Asserts that the input is a valid IMEI (International Mobile Station Equipment Identity Number). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Imei extends Rule 30 | { 31 | public const NAME = 'imei'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/NumberIsInfinite.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `number.isInfinite` rule. Asserts that the input is an infinite number. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class NumberIsInfinite extends Rule 30 | { 31 | public const NAME = 'number.isInfinite'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/NumberIsNegative.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `number.isNegative` rule. Asserts that the input is a negative number. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class NumberIsNegative extends Rule 30 | { 31 | public const NAME = 'number.isNegative'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/NumberIsPositive.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `number.isPositive` rule. Asserts that the input is a positive number. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class NumberIsPositive extends Rule 30 | { 31 | public const NAME = 'number.isPositive'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Regexp.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `regexp` rule. Asserts that the input matches a Perl-compatible regular expression. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Regexp extends Rule 30 | { 31 | public const NAME = 'regexp'; 32 | 33 | public function __construct(string $pattern, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ArrayIsSequential.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `array.isSequential` rule. Asserts that the input is a sequential array. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ArrayIsSequential extends Rule 30 | { 31 | public const NAME = 'array.isSequential'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Assert.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `assert` rule. An alias for the `if` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Assert extends Rule 30 | { 31 | public const NAME = 'assert'; 32 | 33 | public function __construct(mixed $actual, mixed $expected = true, string $operator = '==', ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 3); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Color.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `color` rule. Asserts that the input is a valid CSS color (Color Word, HEX, HEX-Alpha, RGB, RGBA, HSL, HSLA). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Color extends Rule 30 | { 31 | public const NAME = 'color'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/CurrencyName.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `currency.name` rule. Asserts that the input is a valid currency name (as in ISO 4217). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class CurrencyName extends Rule 30 | { 31 | public const NAME = 'currency.name'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/FileIsExecutable.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `file.isExecutable` rule. Asserts that the input is a file and is executable. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class FileIsExecutable extends Rule 30 | { 31 | public const NAME = 'file.isExecutable'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Required.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `required` rule. Asserts that the input is required (is not blank, i.e. not a empty string or null). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Required extends Rule 30 | { 31 | public const NAME = 'required'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Words.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `words` rule. Asserts that the input is a string containing only words and spaces without any other character. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Words extends Rule 30 | { 31 | public const NAME = 'words'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Logic/macros.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Logic; 13 | 14 | use MAKS\Mighty\Validation; 15 | 16 | return [ 17 | 18 | // null^~empty or ?(scalar|array|object|callable|resource)^null 19 | '[nullable]' => (new Validation())->group(static fn ($validation) => $validation->null()->xor()->not()->empty())->build(), 20 | 21 | // matches:"/[a-zA-Z0-9-_]+/" 22 | '[alnumDash]' => (new Validation())->group(static fn ($validation) => $validation->matches('/[a-zA-Z0-9-_]+/'))->build(), 23 | 24 | // matches:'"/^[a-zA-Z_]{1}[a-zA-Z0-9_]{0,14}$/"' 25 | '[twitterHandle]' => (new Validation())->group(static fn ($validation) => $validation->matches('/^[a-zA-Z_]{1}[a-zA-Z0-9_]{0,14}$/'))->build(), 26 | 27 | // email&string.contains:"@gmail." 28 | '[gmail]' => (new Validation())->group(static fn ($validation) => $validation->email()->and()->stringContains('@gmail.'))->build(), 29 | 30 | // email&string.endsWith:".edu" 31 | '[eduMail]' => (new Validation())->group(static fn ($validation) => $validation->email()->and()->stringEndsWith('.edu'))->build(), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ArrayIsAssociative.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `array.isAssociative` rule. Asserts that the input is an associative array. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ArrayIsAssociative extends Rule 30 | { 31 | public const NAME = 'array.isAssociative'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/AssertLessThan.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `assert.lessThan` rule. An alias for the `if.lt` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class AssertLessThan extends Rule 30 | { 31 | public const NAME = 'assert.lessThan'; 32 | 33 | public function __construct(mixed $actual, mixed $expected, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 2); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ColorHexAlpha.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `color.hexAlpha` rule. Asserts that the input is a valid CSS HEX-Alpha (4 or 8 Chars) color. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ColorHexAlpha extends Rule 30 | { 31 | public const NAME = 'color.hexAlpha'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/FileIsUploaded.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `file.isUploaded` rule. Asserts that the input is a file that is uploaded via HTTP POST. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class FileIsUploaded extends Rule 30 | { 31 | public const NAME = 'file.isUploaded'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Graph.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `graph` rule. Asserts that the input consists of graphic characters only (characters that create a visible output). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Graph extends Rule 30 | { 31 | public const NAME = 'graph'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/IpNotPrivate.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `ip.notPrivate` rule. Asserts that the input is an IP address not within private IPs range. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class IpNotPrivate extends Rule 30 | { 31 | public const NAME = 'ip.notPrivate'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Matches.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `matches` rule. Asserts that the input matches the given pattern. Works with strings only. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Matches extends Rule 30 | { 31 | public const NAME = 'matches'; 32 | 33 | public function __construct(string $pattern, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ObjectHasMethod.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `object.hasMethod` rule. Asserts that the input has the given method. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ObjectHasMethod extends Rule 30 | { 31 | public const NAME = 'object.hasMethod'; 32 | 33 | public function __construct(string $method, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/TypeDebug.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `type.debug` rule. Asserts that the input is of the given type using get_debug_type(). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class TypeDebug extends Rule 30 | { 31 | public const NAME = 'type.debug'; 32 | 33 | public function __construct(string $type, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/AssertNotEquals.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `assert.notEquals` rule. An alias for the `if.neq` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class AssertNotEquals extends Rule 30 | { 31 | public const NAME = 'assert.notEquals'; 32 | 33 | public function __construct(mixed $actual, mixed $expected, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 2); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/DateAfterOrEquals.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `date.afterOrEquals` rule. An alias for the `datetime.gte` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class DateAfterOrEquals extends Rule 30 | { 31 | public const NAME = 'date.afterOrEquals'; 32 | 33 | public function __construct(string $datetime, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/EmailWithUnicode.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `email.withUnicode` rule. Asserts that the input is an email address (unicode allowed). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class EmailWithUnicode extends Rule 30 | { 31 | public const NAME = 'email.withUnicode'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/IpNotReserved.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `ip.notReserved` rule. Asserts that the input is an IP address not within reserved IPs range. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class IpNotReserved extends Rule 30 | { 31 | public const NAME = 'ip.notReserved'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/Meta.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `meta` rule. Asserts that the input is a string containing only meta characters (special characters) (i.e. "@, #, $, ..."). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class Meta extends Rule 30 | { 31 | public const NAME = 'meta'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/ObjectIsStringable.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `object.isStringable` rule. Asserts that the input implements __toString() method. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class ObjectIsStringable extends Rule 30 | { 31 | public const NAME = 'object.isStringable'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/AssertGreaterThan.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `assert.greaterThan` rule. An alias for the `if.gt` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class AssertGreaterThan extends Rule 30 | { 31 | public const NAME = 'assert.greaterThan'; 32 | 33 | public function __construct(mixed $actual, mixed $expected, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 2); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/DateBeforeOrEquals.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `date.beforeOrEquals` rule. An alias for the `datetime.lte` rule. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class DateBeforeOrEquals extends Rule 30 | { 31 | public const NAME = 'date.beforeOrEquals'; 32 | 33 | public function __construct(string $datetime, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/DomainIsActive.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `domain.isActive` rule. Asserts that the input is an active domain. Works with domains and emails. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class DomainIsActive extends Rule 30 | { 31 | public const NAME = 'domain.isActive'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/StringLength.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `string.length` rule. Asserts that the input is a string that is exactly the given length. 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class StringLength extends Rule 30 | { 31 | public const NAME = 'string.length'; 32 | 33 | public function __construct(int $length, ?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 1); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Validation/Constraint/Rule/CalenderDay.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright Marwan Al-Soltany 2022 6 | * For the full copyright and license information, please view 7 | * the LICENSE file that was distributed with this source code. 8 | */ 9 | 10 | declare(strict_types=1); 11 | 12 | namespace MAKS\Mighty\Validation\Constraint\Rule; 13 | 14 | use Attribute; 15 | use MAKS\Mighty\Validation\Strategy; 16 | use MAKS\Mighty\Validation\Constraint\Rule; 17 | 18 | /** 19 | * Adds `calender.day` rule. Asserts that the input looks like a calendar dayin shot or long format ("Mon" or "Monday"). 20 | * 21 | * This is an auto-generated class that was generated programmatically by: 22 | * `MAKS\Mighty\Maker` 23 | * 24 | * @package Mighty\Validator 25 | * 26 | * @codeCoverageIgnore There is nothing to test here. The underlying code is fully tested. 27 | */ 28 | #[Attribute(Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)] 29 | final class CalenderDay extends Rule 30 | { 31 | public const NAME = 'calender.day'; 32 | 33 | public function __construct(?string $message = null, Strategy $strategy = Strategy::FailLazy) 34 | { 35 | $arguments = array_slice(func_get_args(), 0, 0); 36 | 37 | parent::__construct(name: self::NAME, arguments: $arguments, message: $message, strategy: $strategy); 38 | } 39 | } 40 | --------------------------------------------------------------------------------