mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 15:25: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.9 KiB
1.9 KiB
NotUndef
NotUndef()
Validates if the given input is not optional. By optional we consider null
or an empty string ('').
v::notUndef()->isValid(''); // false
v::notUndef()->isValid(null); // false
Other values:
v::notUndef()->isValid([]); // true
v::notUndef()->isValid(' '); // true
v::notUndef()->isValid(0); // true
v::notUndef()->isValid('0'); // true
v::notUndef()->isValid(0); // true
v::notUndef()->isValid('0.0'); // true
v::notUndef()->isValid(false); // true
v::notUndef()->isValid(['']); // true
v::notUndef()->isValid([' ']); // true
v::notUndef()->isValid([0]); // true
v::notUndef()->isValid(['0']); // true
v::notUndef()->isValid([false]); // true
v::notUndef()->isValid([[''), [0]]); // true
v::notUndef()->isValid(new stdClass()); // true
Templates
NotUndef::TEMPLATE_STANDARD
| Mode | Template |
|---|---|
default |
The value must be defined |
inverted |
The value must be undefined |
NotUndef::TEMPLATE_NAMED
| Mode | Template |
|---|---|
default |
{{name}} must be defined |
inverted |
{{name}} must be undefined |
Template placeholders
| Placeholder | Description |
|---|---|
name |
The validated input or the custom validator name (if specified). |
Categorization
- Miscellaneous
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Renamed from "NotOptional" to "NotUndef" |
| 1.0.0 | Created |
See also: