diff --git a/bin/create-mixin b/bin/create-mixin index 591e3c1c5..81b2fd94d 100755 --- a/bin/create-mixin +++ b/bin/create-mixin @@ -107,10 +107,12 @@ function addMethodToInterface( $defaultValue = $reflectionParameter->getDefaultValue(); if (is_object($defaultValue)) { + $parameter->setDefaultValue(null); + $parameter->setNullable(true); continue; } - $parameter->setDefaultValue($reflectionParameter->getDefaultValue()); + $parameter->setDefaultValue($defaultValue); $parameter->setNullable(false); } } @@ -170,10 +172,10 @@ function overwriteFile(string $content, string $basename): void ['Length', 'length', $numberRelatedRules, []], ['Max', 'max', $numberRelatedRules, []], ['Min', 'min', $numberRelatedRules, []], - ['Not', 'not', [], ['Not', 'NotEmpty', 'NotBlank', 'NotEmoji', 'NotUndef', 'NullOr', 'UndefOr', 'Attributes', 'Templated', 'Named']], - ['NullOr', 'nullOr', [], ['NullOr', 'NotUndef', 'UndefOr', 'Templated', 'Named']], + ['Not', 'not', [], ['Not', 'NotEmpty', 'NotEmoji', 'NotUndef', 'NullOr', 'UndefOr', 'Attributes', 'Templated', 'Named']], + ['NullOr', 'nullOr', [], ['NullOr', 'Blank', 'NotUndef', 'UndefOr', 'Templated', 'Named']], ['Property', 'property', [], $structureRelatedRules], - ['UndefOr', 'undefOr', [], ['NullOr', 'NotUndef', 'UndefOr', 'Attributes', 'Templated', 'Named']], + ['UndefOr', 'undefOr', [], ['NullOr', 'Blank', 'NotUndef', 'UndefOr', 'Attributes', 'Templated', 'Named']], ['', null, [], []], ]; diff --git a/bin/update-doc-links b/bin/update-doc-links index 7bba68fae..643e65225 100755 --- a/bin/update-doc-links +++ b/bin/update-doc-links @@ -49,10 +49,10 @@ create_rule_documentation() sed -nE '/^# /,/^## Changelog/p' "${filename}" | ggrep -E -v '^## Changelog' # "Changelog" section - sed -nE '/^## Changelog/,/^\*\*\*/p' "${filename}" | ggrep -Fv '***' + sed -nE '/^## Changelog/,/^---/p' "${filename}" # "See also" section - echo "***" + echo echo "See also:" echo echo "${related_links}" diff --git a/docs/02-feature-guide.md b/docs/02-feature-guide.md index 375f7489f..7d22dd1ef 100644 --- a/docs/02-feature-guide.md +++ b/docs/02-feature-guide.md @@ -4,7 +4,6 @@ The `Validator` class is the core of Respect\Validation, offering a fluent inter For convenience, the `Validator` class is aliased as `v`. This means you can write `v::intType()` instead of `\Respect\Validation\Validator::intType()`. - ## Validating using booleans With the `isValid()` method, determine if your input meets a specific validation rule. diff --git a/docs/04-message-translation.md b/docs/04-message-translation.md index f64a8ab63..6a44e487b 100644 --- a/docs/04-message-translation.md +++ b/docs/04-message-translation.md @@ -4,7 +4,7 @@ We use dependency injection container to create Validators with all their depend You can use different translators to translate validation messages into different languages, by overwriting the default container in `ContainerRegistry`, passing the translator you desire. -Luckily, the `ContainerRegistry` has method that creates a pre-configured container using [php-di/php-di](https://php-di.org/). That means you just need to overwrite that service. +Luckily, the `ContainerRegistry` has method that creates a pre-configured container using [php-di/php-di](https://php-di.org/). That means you just need to overwrite that service. ```php use Respect\Validation\ContainerRegistry; diff --git a/docs/08-comparable-values.md b/docs/08-comparable-values.md index cb304d6be..6f83d3070 100644 --- a/docs/08-comparable-values.md +++ b/docs/08-comparable-values.md @@ -10,8 +10,8 @@ You can make comparison with the following data types: - Numeric types - Single character string - Primitive types in general: normal operation comparison made by PHP -- Time string: [date and time format](http://php.net/datetime.formats) -that can be parsed by PHP +- Time string: [date and time format](http://php.net/datetime.formats) + that can be parsed by PHP Below you can see some examples: diff --git a/docs/09-list-of-rules-by-category.md b/docs/09-list-of-rules-by-category.md index e50673f38..1bc36253a 100644 --- a/docs/09-list-of-rules-by-category.md +++ b/docs/09-list-of-rules-by-category.md @@ -101,13 +101,6 @@ - [Uploaded](rules/Uploaded.md) - [Writable](rules/Writable.md) -## ISO codes - -- [CountryCode](rules/CountryCode.md) -- [CurrencyCode](rules/CurrencyCode.md) -- [LanguageCode](rules/LanguageCode.md) -- [SubdivisionCode](rules/SubdivisionCode.md) - ## Identifications - [Bsn](rules/Bsn.md) @@ -137,6 +130,13 @@ - [Url](rules/Url.md) - [VideoUrl](rules/VideoUrl.md) +## ISO codes + +- [CountryCode](rules/CountryCode.md) +- [CurrencyCode](rules/CurrencyCode.md) +- [LanguageCode](rules/LanguageCode.md) +- [SubdivisionCode](rules/SubdivisionCode.md) + ## Localization - [CountryCode](rules/CountryCode.md) @@ -159,9 +159,9 @@ ## Miscellaneous +- [Blank](rules/Blank.md) - [FilterVar](rules/FilterVar.md) - [Named](rules/Named.md) -- [NotBlank](rules/NotBlank.md) - [NotEmpty](rules/NotEmpty.md) - [NotUndef](rules/NotUndef.md) - [Templated](rules/Templated.md) @@ -235,8 +235,8 @@ - [In](rules/In.md) - [Json](rules/Json.md) - [Lowercase](rules/Lowercase.md) -- [NoWhitespace](rules/NoWhitespace.md) - [NotEmoji](rules/NotEmoji.md) +- [NoWhitespace](rules/NoWhitespace.md) - [Phone](rules/Phone.md) - [PhpLabel](rules/PhpLabel.md) - [PostalCode](rules/PostalCode.md) @@ -315,6 +315,7 @@ - [Base64](rules/Base64.md) - [Between](rules/Between.md) - [BetweenExclusive](rules/BetweenExclusive.md) +- [Blank](rules/Blank.md) - [BoolType](rules/BoolType.md) - [BoolVal](rules/BoolVal.md) - [Bsn](rules/Bsn.md) @@ -401,13 +402,12 @@ - [Nif](rules/Nif.md) - [Nip](rules/Nip.md) - [No](rules/No.md) -- [NoWhitespace](rules/NoWhitespace.md) - [NoneOf](rules/NoneOf.md) - [Not](rules/Not.md) -- [NotBlank](rules/NotBlank.md) - [NotEmoji](rules/NotEmoji.md) - [NotEmpty](rules/NotEmpty.md) - [NotUndef](rules/NotUndef.md) +- [NoWhitespace](rules/NoWhitespace.md) - [NullOr](rules/NullOr.md) - [NullType](rules/NullType.md) - [Number](rules/Number.md) diff --git a/docs/rules/Alnum.md b/docs/rules/Alnum.md index 5be5befa4..b988db4d4 100644 --- a/docs/rules/Alnum.md +++ b/docs/rules/Alnum.md @@ -71,8 +71,8 @@ See also: - [Decimal](Decimal.md) - [Digit](Digit.md) - [Lowercase](Lowercase.md) -- [NoWhitespace](NoWhitespace.md) - [NotEmoji](NotEmoji.md) +- [NoWhitespace](NoWhitespace.md) - [Regex](Regex.md) - [StringType](StringType.md) - [StringVal](StringVal.md) diff --git a/docs/rules/Alpha.md b/docs/rules/Alpha.md index 524af4a12..7ff2fd664 100644 --- a/docs/rules/Alpha.md +++ b/docs/rules/Alpha.md @@ -65,8 +65,8 @@ See also: - [Decimal](Decimal.md) - [Digit](Digit.md) - [Lowercase](Lowercase.md) -- [NoWhitespace](NoWhitespace.md) - [NotEmoji](NotEmoji.md) +- [NoWhitespace](NoWhitespace.md) - [Regex](Regex.md) - [Uppercase](Uppercase.md) - [Vowel](Vowel.md) diff --git a/docs/rules/AlwaysValid.md b/docs/rules/AlwaysValid.md index 5eac5385d..2cde9f208 100644 --- a/docs/rules/AlwaysValid.md +++ b/docs/rules/AlwaysValid.md @@ -38,3 +38,5 @@ v::alwaysValid()->isValid('whatever'); // true See also: - [AlwaysInvalid](AlwaysInvalid.md) +- [KeyExists](KeyExists.md) +- [PropertyExists](PropertyExists.md) diff --git a/docs/rules/Attributes.md b/docs/rules/Attributes.md index cdc6d53ca..54325236d 100644 --- a/docs/rules/Attributes.md +++ b/docs/rules/Attributes.md @@ -70,9 +70,9 @@ v::attributes()->assert(new Person('', 'not a date', 'not an email', 'not a phon ## Caveats -* If the object has no attributes, the validation will always pass. -* When the property is nullable, this rule will wrap the rule on the property into [NullOr](NullOr.md) rule. -* This rule has no templates because it uses the templates of the rules that are applied to the properties. +- If the object has no attributes, the validation will always pass. +- When the property is nullable, this rule will wrap the rule on the property into [NullOr](NullOr.md) rule. +- This rule has no templates because it uses the templates of the rules that are applied to the properties. ## Categorization @@ -82,10 +82,11 @@ v::attributes()->assert(new Person('', 'not a date', 'not an email', 'not a phon ## Changelog | Version | Description | -|--------:|-------------| +| ------: | ----------- | | 3.0.0 | Created | -*** +--- + See also: - [Named](Named.md) diff --git a/docs/rules/Blank.md b/docs/rules/Blank.md new file mode 100644 index 000000000..343ec7406 --- /dev/null +++ b/docs/rules/Blank.md @@ -0,0 +1,63 @@ +# Blank + +- `Blank()` + +Validates if the given input is a blank value (`null`, zeros, empty strings or empty arrays, recursively). + +```php +v::blank()->isValid(null); // true +v::blank()->isValid(''); // true +v::blank()->isValid([]); // true +v::blank()->isValid(' '); // true +v::blank()->isValid(0); // true +v::blank()->isValid('0'); // true +v::blank()->isValid(0); // true +v::blank()->isValid('0.0'); // true +v::blank()->isValid(false); // true +v::blank()->isValid(['']); // true +v::blank()->isValid([' ']); // true +v::blank()->isValid([0]); // true +v::blank()->isValid(['0']); // true +v::blank()->isValid([false]); // true +v::blank()->isValid([[''], [0]]); // true +v::blank()->isValid(new stdClass()); // true +``` + +It's similar to [NotEmpty](NotEmpty.md), but way stricter. + +## Templates + +### `Blank::TEMPLATE_STANDARD` + +| Mode | Template | +| ---------- | ----------------------------- | +| `default` | {{subject}} must be blank | +| `inverted` | {{subject}} must not be blank | + +## Template placeholders + +| Placeholder | Description | +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | + +## Categorization + +- Miscellaneous + +## Changelog + +| Version | Description | +| ------: | ------------------------------------------- | +| 3.0.0 | Renamed to `Blank` and changed the behavior | +| 1.0.0 | Created as `NotBlank` | + +--- + +See also: + +- [NotEmpty](NotEmpty.md) +- [NotUndef](NotUndef.md) +- [NoWhitespace](NoWhitespace.md) +- [NullType](NullType.md) +- [Number](Number.md) +- [UndefOr](UndefOr.md) diff --git a/docs/rules/Call.md b/docs/rules/Call.md index 28687a554..327a5b656 100644 --- a/docs/rules/Call.md +++ b/docs/rules/Call.md @@ -46,17 +46,17 @@ v::call( ### `Call::TEMPLATE_STANDARD` | Mode | Template | -|------------|------------------------------------------------------------| +| ---------- | ---------------------------------------------------------- | | `default` | {{input}} must be a suitable argument for {{callable}} | | `inverted` | {{input}} must not be a suitable argument for {{callable}} | ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| +| ----------- | ---------------------------------------------------------------- | | `callable` | | | `input` | | -| `subject` | The validated input or the custom validator name (if specified). | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -67,10 +67,11 @@ v::call( ## Changelog | Version | Description | -|--------:|-------------| +| ------: | ----------- | | 0.3.9 | Created | -*** +--- + See also: - [Callback](Callback.md) diff --git a/docs/rules/Circuit.md b/docs/rules/Circuit.md index 9ee99d7ad..7e203eabc 100644 --- a/docs/rules/Circuit.md +++ b/docs/rules/Circuit.md @@ -33,10 +33,11 @@ This rule does not have any templates, because it will always return the result ## Changelog | Version | Description | -|--------:|-------------| +| ------: | ----------- | | 3.0.0 | Created | -*** +--- + See also: - [AllOf](AllOf.md) diff --git a/docs/rules/Key.md b/docs/rules/Key.md index 5b90b8fff..9f3cdb459 100644 --- a/docs/rules/Key.md +++ b/docs/rules/Key.md @@ -37,16 +37,16 @@ v::key('email', v::email())->assert(['email' => 'not email']); ## Note -* To validate if a key exists, use [KeyExists](KeyExists.md) instead. -* To validate an array against a given rule if the key exists, use [KeyOptional](KeyOptional.md) instead. +- To validate if a key exists, use [KeyExists](KeyExists.md) instead. +- To validate an array against a given rule if the key exists, use [KeyOptional](KeyOptional.md) instead. ## Templates ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| -| `subject` | The validated input or the custom validator name (if specified). | +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -57,11 +57,12 @@ v::key('email', v::email())->assert(['email' => 'not email']); ## Changelog | Version | Description | -|--------:|----------------------------------------------------------------------| +| ------: | -------------------------------------------------------------------- | | 3.0.0 | Split by [KeyExists](KeyExists.md) and [KeyOptional](KeyOptional.md) | | 0.3.9 | Created | -*** +--- + See also: - [ArrayVal](ArrayVal.md) diff --git a/docs/rules/KeyExists.md b/docs/rules/KeyExists.md index adf5f06ff..5a1558702 100644 --- a/docs/rules/KeyExists.md +++ b/docs/rules/KeyExists.md @@ -71,6 +71,7 @@ v::key('foo', v::alwaysValid()->setName('Custom name'))->assert([]); See also: +- [AlwaysValid](AlwaysValid.md) - [ArrayType](ArrayType.md) - [ArrayVal](ArrayVal.md) - [Each](Each.md) diff --git a/docs/rules/KeyOptional.md b/docs/rules/KeyOptional.md index 416eba260..0d82a27d6 100644 --- a/docs/rules/KeyOptional.md +++ b/docs/rules/KeyOptional.md @@ -33,16 +33,16 @@ v::arrayType()->keyOptional('phone', v::phone())->assert('This is not an array') Below are some other rules that are tightly related to `KeyOptional`: -* To validate if a key exists, use [KeyExists](KeyExists.md) instead. -* To validate an array against a given rule requiring the key to exist, use [Key](Key.md) instead. +- To validate if a key exists, use [KeyExists](KeyExists.md) instead. +- To validate an array against a given rule requiring the key to exist, use [Key](Key.md) instead. ## Templates ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| -| `subject` | The validated input or the custom validator name (if specified). | +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -52,10 +52,11 @@ Below are some other rules that are tightly related to `KeyOptional`: ## Changelog | Version | Description | -|--------:|----------------------------| +| ------: | -------------------------- | | 3.0.0 | Created from [Key](Key.md) | -*** +--- + See also: - [ArrayType](ArrayType.md) diff --git a/docs/rules/Lazy.md b/docs/rules/Lazy.md index b8648cea9..3bd88020b 100644 --- a/docs/rules/Lazy.md +++ b/docs/rules/Lazy.md @@ -28,8 +28,8 @@ on the input itself (`$_POST`), but it will use any input that’s given to the ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| -| `subject` | The validated input or the custom validator name (if specified). | +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -39,10 +39,11 @@ on the input itself (`$_POST`), but it will use any input that’s given to the ## Changelog | Version | Description | -|--------:|-------------------------| +| ------: | ----------------------- | | 3.0.0 | Created from `KeyValue` | -*** +--- + See also: - [Call](Call.md) diff --git a/docs/rules/Max.md b/docs/rules/Max.md index 020ca3a59..9457eb639 100644 --- a/docs/rules/Max.md +++ b/docs/rules/Max.md @@ -24,17 +24,16 @@ empty, the validation will fail. ### `Max::TEMPLATE_STANDARD` - | Mode | Template | -|------------|----------------| +| ---------- | -------------- | | `default` | The maximum of | | `inverted` | The maximum of | ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| -| `subject` | The validated input or the custom validator name (if specified). | +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -44,13 +43,14 @@ empty, the validation will fail. ## Changelog | Version | Description | -|--------:|-----------------------------| +| ------: | --------------------------- | | 3.0.0 | Became a transformation | | 2.0.0 | Became always inclusive | | 1.0.0 | Became inclusive by default | | 0.3.9 | Created | -*** +--- + See also: - [Between](Between.md) diff --git a/docs/rules/Min.md b/docs/rules/Min.md index 3b4bf28e9..c4185e338 100644 --- a/docs/rules/Min.md +++ b/docs/rules/Min.md @@ -24,16 +24,16 @@ empty, the validation will fail. ### `Min::TEMPLATE_STANDARD` -| Mode | Template | -|------------|------------------| +| Mode | Template | +| ---------- | -------------- | | `default` | The minimum of | | `inverted` | The minimum of | ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| -| `subject` | The validated input or the custom validator name (if specified). | +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -43,13 +43,14 @@ empty, the validation will fail. ## Changelog | Version | Description | -|--------:|-----------------------------| +| ------: | --------------------------- | | 3.0.0 | Became a transformation | | 2.0.0 | Became always inclusive | | 1.0.0 | Became inclusive by default | | 0.3.9 | Created | -*** +--- + See also: - [Between](Between.md) diff --git a/docs/rules/Named.md b/docs/rules/Named.md index 17cafb337..f4595fa7f 100644 --- a/docs/rules/Named.md +++ b/docs/rules/Named.md @@ -25,8 +25,8 @@ This rule does not have any templates, as it will use the template of the given ## Template placeholders | Placeholder | Description | -|-------------|---------------------------------------| -| `subject` | The value that you define as `$name`. | +| ----------- | ------------------------------------- | +| `subject` | The value that you define as `$name`. | ## Categorization @@ -37,10 +37,11 @@ This rule does not have any templates, as it will use the template of the given ## Changelog | Version | Description | -|--------:|-------------| +| ------: | ----------- | | 3.0.0 | Created | -*** +--- + See also: - [Attributes](Attributes.md) diff --git a/docs/rules/NoWhitespace.md b/docs/rules/NoWhitespace.md index e7de602fa..82db7d118 100644 --- a/docs/rules/NoWhitespace.md +++ b/docs/rules/NoWhitespace.md @@ -42,8 +42,8 @@ See also: - [Alnum](Alnum.md) - [Alpha](Alpha.md) +- [Blank](Blank.md) - [CreditCard](CreditCard.md) -- [NotBlank](NotBlank.md) - [NotEmpty](NotEmpty.md) - [NotUndef](NotUndef.md) - [UndefOr](UndefOr.md) diff --git a/docs/rules/Not.md b/docs/rules/Not.md index 21630eed4..f3eb85577 100644 --- a/docs/rules/Not.md +++ b/docs/rules/Not.md @@ -23,8 +23,8 @@ Each other validation has custom messages for negated rules. ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| -| `subject` | The validated input or the custom validator name (if specified). | +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -35,10 +35,11 @@ Each other validation has custom messages for negated rules. ## Changelog | Version | Description | -|--------:|-------------| +| ------: | ----------- | | 0.3.9 | Created | -*** +--- + See also: - [Named](Named.md) diff --git a/docs/rules/NotBlank.md b/docs/rules/NotBlank.md deleted file mode 100644 index bacd6b334..000000000 --- a/docs/rules/NotBlank.md +++ /dev/null @@ -1,63 +0,0 @@ -# NotBlank - -- `NotBlank()` - -Validates if the given input is not a blank value (`null`, zeros, empty strings -or empty arrays, recursively). - -```php -v::notBlank()->isValid(null); // false -v::notBlank()->isValid(''); // false -v::notBlank()->isValid([]); // false -v::notBlank()->isValid(' '); // false -v::notBlank()->isValid(0); // false -v::notBlank()->isValid('0'); // false -v::notBlank()->isValid(0); // false -v::notBlank()->isValid('0.0'); // false -v::notBlank()->isValid(false); // false -v::notBlank()->isValid(['']); // false -v::notBlank()->isValid([' ']); // false -v::notBlank()->isValid([0]); // false -v::notBlank()->isValid(['0']); // false -v::notBlank()->isValid([false]); // false -v::notBlank()->isValid([[''], [0]]); // false -v::notBlank()->isValid(new stdClass()); // false -``` - -It's similar to [NotEmpty](NotEmpty.md) but it's way more strict. - -## Templates - -### `NotBlank::TEMPLATE_STANDARD` - -| Mode | Template | -| ---------- | ----------------------------- | -| `default` | {{subject}} must not be blank | -| `inverted` | {{subject}} must be blank | - -## Template placeholders - -| Placeholder | Description | -| ----------- | ---------------------------------------------------------------- | -| `subject` | The validated input or the custom validator name (if specified). | - -## Categorization - -- Miscellaneous - -## Changelog - -| Version | Description | -| ------: | ----------- | -| 1.0.0 | Created | - ---- - -See also: - -- [NoWhitespace](NoWhitespace.md) -- [NotEmpty](NotEmpty.md) -- [NotUndef](NotUndef.md) -- [NullType](NullType.md) -- [Number](Number.md) -- [UndefOr](UndefOr.md) diff --git a/docs/rules/NotEmpty.md b/docs/rules/NotEmpty.md index 1cc8770fa..e70ab6500 100644 --- a/docs/rules/NotEmpty.md +++ b/docs/rules/NotEmpty.md @@ -64,12 +64,12 @@ v::stringType()->notEmpty()->isValid("\t \n \r"); //false See also: +- [Blank](Blank.md) - [Each](Each.md) - [Max](Max.md) - [Min](Min.md) -- [NoWhitespace](NoWhitespace.md) -- [NotBlank](NotBlank.md) - [NotUndef](NotUndef.md) +- [NoWhitespace](NoWhitespace.md) - [NullType](NullType.md) - [Number](Number.md) - [UndefOr](UndefOr.md) diff --git a/docs/rules/NotUndef.md b/docs/rules/NotUndef.md index fafe2d9ec..7fd0c4d17 100644 --- a/docs/rules/NotUndef.md +++ b/docs/rules/NotUndef.md @@ -59,9 +59,9 @@ v::notUndef()->isValid(new stdClass()); // true See also: -- [NoWhitespace](NoWhitespace.md) -- [NotBlank](NotBlank.md) +- [Blank](Blank.md) - [NotEmpty](NotEmpty.md) +- [NoWhitespace](NoWhitespace.md) - [NullType](NullType.md) - [Number](Number.md) - [UndefOr](UndefOr.md) diff --git a/docs/rules/NullOr.md b/docs/rules/NullOr.md index f31ad734f..e509f0e91 100644 --- a/docs/rules/NullOr.md +++ b/docs/rules/NullOr.md @@ -21,12 +21,13 @@ v::nullOrEmail()->isValid('not an email'); // false v::nullOrBetween(1, 3)->isValid(2); // true v::nullOrBetween(1, 3)->isValid(null); // true ``` + ## Templates ### `NullOr::TEMPLATE_STANDARD` | Mode | Template | -|------------|----------------------| +| ---------- | -------------------- | | `default` | or must be null | | `inverted` | and must not be null | @@ -43,8 +44,8 @@ v::not(v::nullOr(v::alpha()))->assert("alpha"); ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| -| `subject` | The validated input or the custom validator name (if specified). | +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -53,11 +54,12 @@ v::not(v::nullOr(v::alpha()))->assert("alpha"); ## Changelog | Version | Description | -|--------:|-----------------------| +| ------: | --------------------- | | 3.0.0 | Renamed to `NullOr` | | 2.0.0 | Created as `Nullable` | -*** +--- + See also: - [Attributes](Attributes.md) diff --git a/docs/rules/NullType.md b/docs/rules/NullType.md index 91921bab0..d41bdac7b 100644 --- a/docs/rules/NullType.md +++ b/docs/rules/NullType.md @@ -39,12 +39,12 @@ v::nullType()->isValid(null); // true See also: - [ArrayType](ArrayType.md) +- [Blank](Blank.md) - [BoolType](BoolType.md) - [BoolVal](BoolVal.md) - [CallableType](CallableType.md) - [FloatType](FloatType.md) - [IntType](IntType.md) -- [NotBlank](NotBlank.md) - [NotEmpty](NotEmpty.md) - [NotUndef](NotUndef.md) - [NullOr](NullOr.md) diff --git a/docs/rules/Number.md b/docs/rules/Number.md index 692c0d472..079335942 100644 --- a/docs/rules/Number.md +++ b/docs/rules/Number.md @@ -42,11 +42,11 @@ v::number()->isValid(acos(8)); // false See also: +- [Blank](Blank.md) - [BoolType](BoolType.md) - [CallableType](CallableType.md) - [FloatType](FloatType.md) - [IntType](IntType.md) -- [NotBlank](NotBlank.md) - [NotEmpty](NotEmpty.md) - [NotUndef](NotUndef.md) - [NullType](NullType.md) diff --git a/docs/rules/Property.md b/docs/rules/Property.md index 7b9b4a6f5..c7b9b13ea 100644 --- a/docs/rules/Property.md +++ b/docs/rules/Property.md @@ -42,16 +42,16 @@ v::property('name', v::uppercase())->assert($object); This rule will validate public, private, protected, uninitialised, and static properties. -* To only validate if a property exists, use [PropertyExists](PropertyExists.md) instead. -* To validate a property against a given rule only if the property exists, use [PropertyOptional](PropertyOptional.md) instead. +- To only validate if a property exists, use [PropertyExists](PropertyExists.md) instead. +- To validate a property against a given rule only if the property exists, use [PropertyOptional](PropertyOptional.md) instead. ## Templates ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| -| `subject` | The validated input or the custom validator name (if specified). | +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -62,11 +62,12 @@ This rule will validate public, private, protected, uninitialised, and static pr ## Changelog | Version | Description | -|--------:|--------------------------------------------------------------------------------------------------------------------------------------| +| ------: | ------------------------------------------------------------------------------------------------------------------------------------ | | 3.0.0 | Renamed from `Attribute` to `Property`, and split by [PropertyExists](PropertyExists.md) and [PropertyOptional](PropertyOptional.md) | | 0.3.9 | Created | -*** +--- + See also: - [Attributes](Attributes.md) diff --git a/docs/rules/PropertyExists.md b/docs/rules/PropertyExists.md index a513793bb..928d97f99 100644 --- a/docs/rules/PropertyExists.md +++ b/docs/rules/PropertyExists.md @@ -72,6 +72,7 @@ v::property('foo', v::alwaysValid()->setName('Custom name'))->assert([]); See also: +- [AlwaysValid](AlwaysValid.md) - [Attributes](Attributes.md) - [Key](Key.md) - [KeyExists](KeyExists.md) diff --git a/docs/rules/PropertyOptional.md b/docs/rules/PropertyOptional.md index f684c2d6e..84900ac54 100644 --- a/docs/rules/PropertyOptional.md +++ b/docs/rules/PropertyOptional.md @@ -36,16 +36,16 @@ v::propertyOptional('name', v::notEmpty())->isValid('Not an object'); // true v::objectType()->propertyOptional('name', v::notEmpty())->isValid('Not an object'); // false ``` -* To only validate if a property exists, use [PropertyExists](PropertyExists.md) instead. -* To validate a property against a given rule requiring the property to exist, use [Property](Property.md) instead. +- To only validate if a property exists, use [PropertyExists](PropertyExists.md) instead. +- To validate a property against a given rule requiring the property to exist, use [Property](Property.md) instead. ## Templates ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| -| `subject` | The validated input or the custom validator name (if specified). | +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -56,10 +56,11 @@ v::objectType()->propertyOptional('name', v::notEmpty())->isValid('Not an object ## Changelog | Version | Description | -|--------:|--------------------------------------| +| ------: | ------------------------------------ | | 3.0.0 | Created from [Property](Property.md) | -*** +--- + See also: - [Attributes](Attributes.md) diff --git a/docs/rules/Templated.md b/docs/rules/Templated.md index ffb13f33c..826cddca1 100644 --- a/docs/rules/Templated.md +++ b/docs/rules/Templated.md @@ -26,9 +26,8 @@ This rule does not have any templates, as you must define the templates yourself ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| -| `subject` | The validated input or the custom validator name (if specified). | - +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -39,10 +38,11 @@ This rule does not have any templates, as you must define the templates yourself ## Changelog | Version | Description | -|--------:|-------------| +| ------: | ----------- | | 3.0.0 | Created | -*** +--- + See also: - [Attributes](Attributes.md) diff --git a/docs/rules/Type.md b/docs/rules/Type.md index e204883b9..03ec51498 100644 --- a/docs/rules/Type.md +++ b/docs/rules/Type.md @@ -16,12 +16,13 @@ v::type('object')->isValid(new stdClass()); // true ## Changelog -Version | Description ---------|------------- - 2.0.0 | Became case-sensitive - 0.8.0 | Created +| Version | Description | +| ------- | --------------------- | +| 2.0.0 | Became case-sensitive | +| 0.8.0 | Created | + +--- -*** See also: - [ArrayType](ArrayType.md) diff --git a/docs/rules/UndefOr.md b/docs/rules/UndefOr.md index 8ae3d0995..3e5fd578c 100644 --- a/docs/rules/UndefOr.md +++ b/docs/rules/UndefOr.md @@ -30,7 +30,7 @@ v::undefOrBetween(1, 3)->isValid(2); // true ### `UndefOr::TEMPLATE_STANDARD` | Mode | Template | -|------------|---------------------------| +| ---------- | ------------------------- | | `default` | or must be undefined | | `inverted` | and must not be undefined | @@ -47,8 +47,8 @@ v::not(v::undefOr(v::alpha()))->assert("alpha"); ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| -| `subject` | The validated input or the custom validator name (if specified). | +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -57,16 +57,17 @@ v::not(v::undefOr(v::alpha()))->assert("alpha"); ## Changelog | Version | Description | -|--------:|-----------------------| +| ------: | --------------------- | | 3.0.0 | Renamed to `UndefOr` | | 1.0.0 | Created as `Optional` | -*** +--- + See also: -- [NoWhitespace](NoWhitespace.md) -- [NotBlank](NotBlank.md) +- [Blank](Blank.md) - [NotEmpty](NotEmpty.md) - [NotUndef](NotUndef.md) +- [NoWhitespace](NoWhitespace.md) - [NullOr](NullOr.md) - [NullType](NullType.md) diff --git a/docs/rules/When.md b/docs/rules/When.md index 77699c25f..643255138 100644 --- a/docs/rules/When.md +++ b/docs/rules/When.md @@ -25,8 +25,8 @@ When `$else` is not defined use [AlwaysInvalid](AlwaysInvalid.md) ## Template placeholders | Placeholder | Description | -|-------------|------------------------------------------------------------------| -| `subject` | The validated input or the custom validator name (if specified). | +| ----------- | ---------------------------------------------------------------- | +| `subject` | The validated input or the custom validator name (if specified). | ## Categorization @@ -36,11 +36,12 @@ When `$else` is not defined use [AlwaysInvalid](AlwaysInvalid.md) ## Changelog | Version | Description | -|--------:|--------------------------------| +| ------: | ------------------------------ | | 0.8.0 | Allow to use rule without else | | 0.3.9 | Created | -*** +--- + See also: - [AllOf](AllOf.md) diff --git a/library/Mixins/Builder.php b/library/Mixins/Builder.php index e47da52f6..9ad3ca36c 100644 --- a/library/Mixins/Builder.php +++ b/library/Mixins/Builder.php @@ -10,6 +10,7 @@ namespace Respect\Validation\Mixins; use DateTimeImmutable; +use Respect\Validation\Name; use Respect\Validation\Rule; interface Builder extends @@ -51,6 +52,8 @@ public static function between(mixed $minValue, mixed $maxValue): Chain; public static function betweenExclusive(mixed $minimum, mixed $maximum): Chain; + public static function blank(): Chain; + public static function boolType(): Chain; public static function boolVal(): Chain; @@ -223,7 +226,7 @@ public static function min(Rule $rule): Chain; public static function multiple(int $multipleOf): Chain; - public static function named(Rule $rule, string $name): Chain; + public static function named(Rule $rule, Name|string $name): Chain; public static function negative(): Chain; @@ -241,8 +244,6 @@ public static function noneOf(Rule $rule1, Rule $rule2, Rule ...$rules): Chain; public static function not(Rule $rule): Chain; - public static function notBlank(): Chain; - public static function notEmoji(): Chain; public static function notEmpty(): Chain; diff --git a/library/Mixins/Chain.php b/library/Mixins/Chain.php index d80888088..1e5996f1d 100644 --- a/library/Mixins/Chain.php +++ b/library/Mixins/Chain.php @@ -10,6 +10,7 @@ namespace Respect\Validation\Mixins; use DateTimeImmutable; +use Respect\Validation\Name; use Respect\Validation\Rule; use Respect\Validation\Validator; @@ -54,6 +55,8 @@ public function between(mixed $minValue, mixed $maxValue): Chain; public function betweenExclusive(mixed $minimum, mixed $maximum): Chain; + public function blank(): Chain; + public function boolType(): Chain; public function boolVal(): Chain; @@ -226,7 +229,7 @@ public function min(Rule $rule): Chain; public function multiple(int $multipleOf): Chain; - public function named(Rule $rule, string $name): Chain; + public function named(Rule $rule, Name|string $name): Chain; public function negative(): Chain; @@ -244,8 +247,6 @@ public function noneOf(Rule $rule1, Rule $rule2, Rule ...$rules): Chain; public function not(Rule $rule): Chain; - public function notBlank(): Chain; - public function notEmoji(): Chain; public function notEmpty(): Chain; diff --git a/library/Mixins/KeyBuilder.php b/library/Mixins/KeyBuilder.php index 9e45e5bd6..590271ccf 100644 --- a/library/Mixins/KeyBuilder.php +++ b/library/Mixins/KeyBuilder.php @@ -42,6 +42,8 @@ public static function keyBetween(int|string $key, mixed $minValue, mixed $maxVa public static function keyBetweenExclusive(int|string $key, mixed $minimum, mixed $maximum): Chain; + public static function keyBlank(int|string $key): Chain; + public static function keyBoolType(int|string $key): Chain; public static function keyBoolVal(int|string $key): Chain; @@ -221,8 +223,6 @@ public static function keyNoneOf(int|string $key, Rule $rule1, Rule $rule2, Rule public static function keyNot(int|string $key, Rule $rule): Chain; - public static function keyNotBlank(int|string $key): Chain; - public static function keyNotEmoji(int|string $key): Chain; public static function keyNotEmpty(int|string $key): Chain; diff --git a/library/Mixins/KeyChain.php b/library/Mixins/KeyChain.php index 2549ffca3..c19b5fb48 100644 --- a/library/Mixins/KeyChain.php +++ b/library/Mixins/KeyChain.php @@ -42,6 +42,8 @@ public function keyBetween(int|string $key, mixed $minValue, mixed $maxValue): C public function keyBetweenExclusive(int|string $key, mixed $minimum, mixed $maximum): Chain; + public function keyBlank(int|string $key): Chain; + public function keyBoolType(int|string $key): Chain; public function keyBoolVal(int|string $key): Chain; @@ -221,8 +223,6 @@ public function keyNoneOf(int|string $key, Rule $rule1, Rule $rule2, Rule ...$ru public function keyNot(int|string $key, Rule $rule): Chain; - public function keyNotBlank(int|string $key): Chain; - public function keyNotEmoji(int|string $key): Chain; public function keyNotEmpty(int|string $key): Chain; diff --git a/library/Mixins/NotBuilder.php b/library/Mixins/NotBuilder.php index 56276d13d..799ac4c05 100644 --- a/library/Mixins/NotBuilder.php +++ b/library/Mixins/NotBuilder.php @@ -41,6 +41,8 @@ public static function notBetween(mixed $minValue, mixed $maxValue): Chain; public static function notBetweenExclusive(mixed $minimum, mixed $maximum): Chain; + public static function notBlank(): Chain; + public static function notBoolType(): Chain; public static function notBoolVal(): Chain; diff --git a/library/Mixins/NotChain.php b/library/Mixins/NotChain.php index 5839a5678..206cb096b 100644 --- a/library/Mixins/NotChain.php +++ b/library/Mixins/NotChain.php @@ -41,6 +41,8 @@ public function notBetween(mixed $minValue, mixed $maxValue): Chain; public function notBetweenExclusive(mixed $minimum, mixed $maximum): Chain; + public function notBlank(): Chain; + public function notBoolType(): Chain; public function notBoolVal(): Chain; diff --git a/library/Mixins/NullOrBuilder.php b/library/Mixins/NullOrBuilder.php index e98a1fac1..6f46f8aac 100644 --- a/library/Mixins/NullOrBuilder.php +++ b/library/Mixins/NullOrBuilder.php @@ -231,8 +231,6 @@ public static function nullOrNoneOf(Rule $rule1, Rule $rule2, Rule ...$rules): C public static function nullOrNot(Rule $rule): Chain; - public static function nullOrNotBlank(): Chain; - public static function nullOrNotEmoji(): Chain; public static function nullOrNotEmpty(): Chain; diff --git a/library/Mixins/NullOrChain.php b/library/Mixins/NullOrChain.php index c794ffa16..b201169d1 100644 --- a/library/Mixins/NullOrChain.php +++ b/library/Mixins/NullOrChain.php @@ -231,8 +231,6 @@ public function nullOrNoneOf(Rule $rule1, Rule $rule2, Rule ...$rules): Chain; public function nullOrNot(Rule $rule): Chain; - public function nullOrNotBlank(): Chain; - public function nullOrNotEmoji(): Chain; public function nullOrNotEmpty(): Chain; diff --git a/library/Mixins/PropertyBuilder.php b/library/Mixins/PropertyBuilder.php index d3c94da22..7ea492a99 100644 --- a/library/Mixins/PropertyBuilder.php +++ b/library/Mixins/PropertyBuilder.php @@ -42,6 +42,8 @@ public static function propertyBetween(string $propertyName, mixed $minValue, mi public static function propertyBetweenExclusive(string $propertyName, mixed $minimum, mixed $maximum): Chain; + public static function propertyBlank(string $propertyName): Chain; + public static function propertyBoolType(string $propertyName): Chain; public static function propertyBoolVal(string $propertyName): Chain; @@ -225,8 +227,6 @@ public static function propertyNoneOf(string $propertyName, Rule $rule1, Rule $r public static function propertyNot(string $propertyName, Rule $rule): Chain; - public static function propertyNotBlank(string $propertyName): Chain; - public static function propertyNotEmoji(string $propertyName): Chain; public static function propertyNotEmpty(string $propertyName): Chain; diff --git a/library/Mixins/PropertyChain.php b/library/Mixins/PropertyChain.php index 555c576ae..5148f81a4 100644 --- a/library/Mixins/PropertyChain.php +++ b/library/Mixins/PropertyChain.php @@ -42,6 +42,8 @@ public function propertyBetween(string $propertyName, mixed $minValue, mixed $ma public function propertyBetweenExclusive(string $propertyName, mixed $minimum, mixed $maximum): Chain; + public function propertyBlank(string $propertyName): Chain; + public function propertyBoolType(string $propertyName): Chain; public function propertyBoolVal(string $propertyName): Chain; @@ -221,8 +223,6 @@ public function propertyNoneOf(string $propertyName, Rule $rule1, Rule $rule2, R public function propertyNot(string $propertyName, Rule $rule): Chain; - public function propertyNotBlank(string $propertyName): Chain; - public function propertyNotEmoji(string $propertyName): Chain; public function propertyNotEmpty(string $propertyName): Chain; diff --git a/library/Mixins/UndefOrBuilder.php b/library/Mixins/UndefOrBuilder.php index ba3e1ca44..b5a4fb5e8 100644 --- a/library/Mixins/UndefOrBuilder.php +++ b/library/Mixins/UndefOrBuilder.php @@ -229,8 +229,6 @@ public static function undefOrNoneOf(Rule $rule1, Rule $rule2, Rule ...$rules): public static function undefOrNot(Rule $rule): Chain; - public static function undefOrNotBlank(): Chain; - public static function undefOrNotEmoji(): Chain; public static function undefOrNotEmpty(): Chain; diff --git a/library/Mixins/UndefOrChain.php b/library/Mixins/UndefOrChain.php index 56c4a1330..34b406c2a 100644 --- a/library/Mixins/UndefOrChain.php +++ b/library/Mixins/UndefOrChain.php @@ -229,8 +229,6 @@ public function undefOrNoneOf(Rule $rule1, Rule $rule2, Rule ...$rules): Chain; public function undefOrNot(Rule $rule): Chain; - public function undefOrNotBlank(): Chain; - public function undefOrNotEmoji(): Chain; public function undefOrNotEmpty(): Chain; diff --git a/library/Rules/NotBlank.php b/library/Rules/Blank.php similarity index 85% rename from library/Rules/NotBlank.php rename to library/Rules/Blank.php index f251dd3c3..84dcdc261 100644 --- a/library/Rules/NotBlank.php +++ b/library/Rules/Blank.php @@ -23,10 +23,10 @@ #[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)] #[Template( - '{{subject}} must not be blank', '{{subject}} must be blank', + '{{subject}} must not be blank', )] -final class NotBlank implements Rule +final class Blank implements Rule { public function evaluate(mixed $input): Result { @@ -36,7 +36,7 @@ public function evaluate(mixed $input): Result private function isBlank(mixed $input): bool { if (is_numeric($input)) { - return $input != 0; + return $input == 0; } if (is_string($input)) { @@ -48,9 +48,9 @@ private function isBlank(mixed $input): bool } if (is_array($input)) { - $input = array_filter($input, fn($value) => $this->isBlank($value)); + $input = array_filter($input, fn($value) => !$this->isBlank($value)); } - return !empty($input); + return empty($input); } } diff --git a/library/Transformers/Prefix.php b/library/Transformers/Prefix.php index 482a85566..5e1b70b07 100644 --- a/library/Transformers/Prefix.php +++ b/library/Transformers/Prefix.php @@ -27,7 +27,6 @@ final class Prefix implements Transformer 'min', 'minAge', 'not', - 'notBlank', 'notEmoji', 'notEmpty', 'notUndef', diff --git a/tests/feature/Rules/BlankTest.php b/tests/feature/Rules/BlankTest.php new file mode 100644 index 000000000..cfdde87ef --- /dev/null +++ b/tests/feature/Rules/BlankTest.php @@ -0,0 +1,24 @@ + + * SPDX-License-Identifier: MIT + */ + +declare(strict_types=1); + +test('default template', catchAll( + fn() => v::blank()->assert(1), + fn(string $message, string $fullMessage, array $messages) => expect() + ->and($message)->toBe('1 must be blank') + ->and($fullMessage)->toBe('- 1 must be blank') + ->and($messages)->toBe(['blank' => '1 must be blank']), +)); + +test('inverted template', catchAll( + fn() => v::not(v::blank())->assert(null), + fn(string $message, string $fullMessage, array $messages) => expect() + ->and($message)->toBe('`null` must not be blank') + ->and($fullMessage)->toBe('- `null` must not be blank') + ->and($messages)->toBe(['notBlank' => '`null` must not be blank']), +)); diff --git a/tests/feature/Rules/NotBlankTest.php b/tests/feature/Rules/NotBlankTest.php deleted file mode 100644 index 7fd733c69..000000000 --- a/tests/feature/Rules/NotBlankTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * SPDX-License-Identifier: MIT - */ - -declare(strict_types=1); - -test('Scenario #1', catchMessage( - fn() => v::notBlank()->assert(null), - fn(string $message) => expect($message)->toBe('`null` must not be blank'), -)); - -test('Scenario #2', catchMessage( - fn() => v::notBlank()->setName('Field')->assert(null), - fn(string $message) => expect($message)->toBe('Field must not be blank'), -)); - -test('Scenario #3', catchMessage( - fn() => v::not(v::notBlank())->assert(1), - fn(string $message) => expect($message)->toBe('1 must be blank'), -)); - -test('Scenario #4', catchFullMessage( - fn() => v::notBlank()->assert(''), - fn(string $fullMessage) => expect($fullMessage)->toBe('- "" must not be blank'), -)); - -test('Scenario #5', catchFullMessage( - fn() => v::notBlank()->setName('Field')->assert(''), - fn(string $fullMessage) => expect($fullMessage)->toBe('- Field must not be blank'), -)); - -test('Scenario #6', catchFullMessage( - fn() => v::not(v::notBlank())->assert([1]), - fn(string $fullMessage) => expect($fullMessage)->toBe('- `[1]` must be blank'), -)); diff --git a/tests/unit/Rules/NotBlankTest.php b/tests/unit/Rules/BlankTest.php similarity index 82% rename from tests/unit/Rules/NotBlankTest.php rename to tests/unit/Rules/BlankTest.php index ae256b475..828d69e71 100644 --- a/tests/unit/Rules/NotBlankTest.php +++ b/tests/unit/Rules/BlankTest.php @@ -15,16 +15,16 @@ use stdClass; #[Group('rule')] -#[CoversClass(NotBlank::class)] -final class NotBlankTest extends RuleTestCase +#[CoversClass(Blank::class)] +final class BlankTest extends RuleTestCase { - /** @return iterable */ - public static function providerForValidInput(): iterable + /** @return iterable */ + public static function providerForInvalidInput(): iterable { $object = new stdClass(); $object->foo = true; - $rule = new NotBlank(); + $rule = new Blank(); return [ [$rule, 1], @@ -35,10 +35,10 @@ public static function providerForValidInput(): iterable ]; } - /** @return iterable */ - public static function providerForInvalidInput(): iterable + /** @return iterable */ + public static function providerForValidInput(): iterable { - $rule = new NotBlank(); + $rule = new Blank(); return [ [$rule, null], diff --git a/tests/unit/Transformers/PrefixTest.php b/tests/unit/Transformers/PrefixTest.php index f80c5452c..9ec6fb27d 100644 --- a/tests/unit/Transformers/PrefixTest.php +++ b/tests/unit/Transformers/PrefixTest.php @@ -93,7 +93,6 @@ public static function providerForUntransformedRuleNames(): array 'min' => ['min'], 'minAge' => ['minAge'], 'not' => ['not'], - 'notBlank' => ['notBlank'], 'notEmoji' => ['notEmoji'], 'notEmpty' => ['notEmpty'], 'notUndef' => ['notUndef'],