mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 15:25:45 +01:00
The "NotBlank", "NotEmpty", and "NotUndef" rules do not display the input in all cases and instead displays the string "The value". The problem with that is that one doesn't see which value was passed, which is not so useful. This commit will changes those rules to always display the input. If someone doesn't want the input to show, they can always set a name for the rule.
1.6 KiB
1.6 KiB
NotBlank
NotBlank()
Validates if the given input is not a blank value (null, zeros, empty strings
or empty arrays, recursively).
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 but it's way more strict.
Templates
NotBlank::TEMPLATE_STANDARD
| Mode | Template |
|---|---|
default |
{{name}} must not be blank |
inverted |
{{name}} must be blank |
Template placeholders
| Placeholder | Description |
|---|---|
name |
The validated input or the custom validator name (if specified). |
Categorization
- Miscellaneous
Changelog
| Version | Description |
|---|---|
| 1.0.0 | Created |
See also: