Final Class Yiisoft\Validator\EmptyCondition\WhenMissing
| Inheritance | Yiisoft\Validator\EmptyCondition\WhenMissing |
|---|
Empty condition is a callable returning true if a value must be considered empty.
With WhenMissing a rule is considered empty only when the value is missing. With regard to validation process, a
corresponding rule is skipped only if this condition is met and WhenMissing is set:
- At a rule level via
$skipOnEmptyproperty, but only for rules implementing {@see \Yiisoft\Validator\EmptyCondition\SkipOnEmptyTrait} / including {@see \Yiisoft\Validator\EmptyCondition\SkipOnEmptyTrait}. - At validator level ({@see \Yiisoft\Validator\EmptyCondition\Validator::$defaultSkipOnEmptyCondition}).
There is no shortcut for this condition, because it's considered less used. Use new instance directly:
new WhenMissing().
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __invoke() | Yiisoft\Validator\EmptyCondition\WhenMissing |
Method Details
| public boolean __invoke ( mixed $value, boolean $isPropertyMissing = false ) | ||
| $value | mixed |
The validated value. |
| $isPropertyMissing | boolean |
A flag defining whether the property is missing (not used / not passed at all). |
| return | boolean |
Whether the validated value is considered empty. |
|---|---|---|
public function __invoke(mixed $value, bool $isPropertyMissing = false): bool
{
return $isPropertyMissing;
}
Signup or Login in order to comment.