mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 07:15:45 +01:00
They only know what message a rule produces when they try running it. Including the messages in the documentation will make it easier for people to know what to expect. There are a couple of undocumented placeholders, but I can live with that for now.
1.7 KiB
1.7 KiB
NotEmpty
NotEmpty()
Validates wether the given input is not empty. This function also takes whitespace
into account, use noWhitespace() if no spaces or linebreaks and other
whitespace anywhere in the input is desired.
v::stringType()->notEmpty()->isValid(''); // false
Null values are empty:
v::notEmpty()->isValid(null); // false
Numbers:
v::intVal()->notEmpty()->isValid(0); // false
Empty arrays:
v::arrayVal()->notEmpty()->isValid([]); // false
Whitespace:
v::stringType()->notEmpty()->isValid(' '); //false
v::stringType()->notEmpty()->isValid("\t \n \r"); //false
Templates
NotEmpty::TEMPLATE_STANDARD
| Mode | Template |
|---|---|
default |
The value must not be empty |
inverted |
The value must be empty |
NotEmpty::TEMPLATE_NAMED
| Mode | Template |
|---|---|
default |
{{name}} must not be empty |
inverted |
{{name}} must be empty |
Template placeholders
| Placeholder | Description |
|---|---|
name |
The validated input or the custom validator name (if specified). |
Categorization
- Miscellaneous
Changelog
| Version | Description |
|---|---|
| 0.3.9 | Created |
See also: