Trait Yiisoft\Validator\Rule\Trait\SkipOnEmptyTrait
An implementation for {@see SkipOnEmptyInterface} intended to be included in rules. Requires an additional private
class property $skipOnEmpty. In package rules it's null by default:
public function __construct(
// ...
bool|callable|null $skipOnEmpty = null,
// ...
) {
$this->skipOnEmpty = $skipOnEmpty;
}
Public Methods
| Method | Description | Defined By |
|---|---|---|
| getSkipOnEmpty() | A getter for $skipOnEmpty property. |
Yiisoft\Validator\Rule\Trait\SkipOnEmptyTrait |
| skipOnEmpty() | An immutable setter to change $skipOnEmpty property. |
Yiisoft\Validator\Rule\Trait\SkipOnEmptyTrait |
Method Details
A getter for $skipOnEmpty property.
| public boolean|callable|null getSkipOnEmpty ( ) | ||
| return | boolean|callable|null |
A current raw (non-normalized) value. |
|---|---|---|
public function getSkipOnEmpty(): bool|callable|null
{
return $this->skipOnEmpty;
}
An immutable setter to change $skipOnEmpty property.
| public $this skipOnEmpty ( boolean|callable|null $value ) | ||
| $value | boolean|callable|null |
A new value. |
| return | $this |
The new instance with a changed value. |
|---|---|---|
public function skipOnEmpty(bool|callable|null $value): static
{
$new = clone $this;
$new->skipOnEmpty = $value;
return $new;
}
Signup or Login in order to comment.