respect-validation/docs/rules/BoolVal.md
Henrique Moody 48405271c5
Replace placeholder "name" with "subject"
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.
2025-12-26 21:30:01 +01:00

58 lines
1.3 KiB
Markdown

# BoolVal
- `BoolVal()`
Validates if the input results in a boolean value:
```php
v::boolVal()->isValid('on'); // true
v::boolVal()->isValid('off'); // true
v::boolVal()->isValid('yes'); // true
v::boolVal()->isValid('no'); // true
v::boolVal()->isValid(1); // true
v::boolVal()->isValid(0); // true
```
## Templates
### `BoolVal::TEMPLATE_STANDARD`
| Mode | Template |
| ---------- | --------------------------------------- |
| `default` | {{subject}} must be a boolean value |
| `inverted` | {{subject}} must not be a boolean value |
## Template placeholders
| Placeholder | Description |
| ----------- | ---------------------------------------------------------------- |
| `subject` | The validated input or the custom validator name (if specified). |
## Categorization
- Booleans
- Types
## Changelog
| Version | Description |
| ------: | ----------- |
| 1.0.0 | Created |
---
See also:
- [BoolType](BoolType.md)
- [CallableType](CallableType.md)
- [FloatType](FloatType.md)
- [FloatVal](FloatVal.md)
- [IntType](IntType.md)
- [No](No.md)
- [NullType](NullType.md)
- [ObjectType](ObjectType.md)
- [ResourceType](ResourceType.md)
- [StringType](StringType.md)
- [TrueVal](TrueVal.md)
- [Type](Type.md)
- [Yes](Yes.md)