Interface Yiisoft\Validator\SkipOnEmptyInterface
An optional interface for rules to implement. It allows skipping validation for a rule when the validated value is "empty".
The package ships with {@see \
Public Methods
| Method | Description | Defined By |
|---|---|---|
| getSkipOnEmpty() | Returns current "skip on empty" value. | Yiisoft\ |
| skipOnEmpty() | Changes current "skip on empty" value. Must be immutable. | Yiisoft\ |
Method Details
Returns current "skip on empty" value.
During pre-validation phase it will be normalized to an "empty condition" - a callable identifying when and which values exactly must be considered as empty for corresponding rules to be skipped or not skipped at all.
| public abstract boolean|callable|null getSkipOnEmpty ( ) | ||
| return | boolean|callable|null |
A raw non-normalized value:
Examples of custom callables with built-in condition:
A custom callable for skipping only when a value is zero:
An equivalent class implementing
|
|---|---|---|
public function getSkipOnEmpty(): bool|callable|null;
User Contributed Notes
Leave a comment
Join the conversation to share a note.