mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 07:45:45 +01:00
The `{{name}}` placeholder could represent different things depending on
the state of the Result, and referring to it as `{{name}}` seems
arbitrary. This commit changes it to `{{subject}}`, which is much more
generic and it describes well what that placeholder can mean.
1.6 KiB
1.6 KiB
No
No()No(bool $locale)
Validates if value is considered as "No".
v::no()->isValid('N'); // true
v::no()->isValid('Nay'); // true
v::no()->isValid('Nix'); // true
v::no()->isValid('No'); // true
v::no()->isValid('Nope'); // true
v::no()->isValid('Not'); // true
This rule is case insensitive.
If $locale is TRUE, it will use the value of [nl_langinfo][] with NOEXPR
constant, meaning that it will validate the input using your current location:
setlocale(LC_ALL, 'ru_RU');
v::no(true)->isValid('нет'); // true
Be careful when using $locale as TRUE because the it's very permissive:
v::no(true)->isValid('Never gonna give you up 🎵'); // true
Besides that, with $locale as TRUE it will consider any character starting
with "N" as valid:
setlocale(LC_ALL, 'es_ES');
v::no(true)->isValid('Yes'); // true
Templates
No::TEMPLATE_STANDARD
| Mode | Template |
|---|---|
default |
{{subject}} must be similar to "No" |
inverted |
{{subject}} must not be similar to "No" |
Template placeholders
| Placeholder | Description |
|---|---|
subject |
The validated input or the custom validator name (if specified). |
Categorization
- Booleans
Changelog
| Version | Description |
|---|---|
| 0.7.0 | Created |
See also: