0 follower

Interface Yiisoft\Validator\SkipOnErrorInterface

Implemented byYiisoft\Validator\Rule\AbstractCompare, Yiisoft\Validator\Rule\AbstractNumber, Yiisoft\Validator\Rule\AnyRule, Yiisoft\Validator\Rule\BooleanValue, Yiisoft\Validator\Rule\Callback, Yiisoft\Validator\Rule\Compare, Yiisoft\Validator\Rule\Composite, Yiisoft\Validator\Rule\Count, Yiisoft\Validator\Rule\Date\BaseDate, Yiisoft\Validator\Rule\Date\Date, Yiisoft\Validator\Rule\Date\DateTime, Yiisoft\Validator\Rule\Date\Time, Yiisoft\Validator\Rule\Each, Yiisoft\Validator\Rule\Email, Yiisoft\Validator\Rule\Equal, Yiisoft\Validator\Rule\FilledAtLeast, Yiisoft\Validator\Rule\FilledOnlyOneOf, Yiisoft\Validator\Rule\GreaterThan, Yiisoft\Validator\Rule\GreaterThanOrEqual, Yiisoft\Validator\Rule\Image\Image, Yiisoft\Validator\Rule\In, Yiisoft\Validator\Rule\InEnum, Yiisoft\Validator\Rule\Integer, Yiisoft\Validator\Rule\Ip, Yiisoft\Validator\Rule\Json, Yiisoft\Validator\Rule\Length, Yiisoft\Validator\Rule\LessThan, Yiisoft\Validator\Rule\LessThanOrEqual, Yiisoft\Validator\Rule\Nested, Yiisoft\Validator\Rule\NotEqual, Yiisoft\Validator\Rule\Number, Yiisoft\Validator\Rule\Regex, Yiisoft\Validator\Rule\Required, Yiisoft\Validator\Rule\StopOnError, Yiisoft\Validator\Rule\StringValue, Yiisoft\Validator\Rule\Subset, Yiisoft\Validator\Rule\TrueValue, Yiisoft\Validator\Rule\Type\BooleanType, Yiisoft\Validator\Rule\Type\FloatType, Yiisoft\Validator\Rule\Type\IntegerType, Yiisoft\Validator\Rule\Type\StringType, Yiisoft\Validator\Rule\UniqueIterable, Yiisoft\Validator\Rule\Url, Yiisoft\Validator\Rule\Uuid

An optional interface for rules to implement. It allows skipping validation for a rule within a group of other rules if a previous rule (not the current one!) did not pass the validation.

The package ships with {@see \Yiisoft\Validator\Rule\Trait\SkipOnErrorTrait} which already implements that interface. All you have to do is include it in the rule class along with the interface.

Public Methods

Hide inherited methods

Method Description Defined By
shouldSkipOnError() Returns current "skip on error" value. Yiisoft\Validator\SkipOnErrorInterface
skipOnError() Changes current "skip on error" value. Must be immutable. Yiisoft\Validator\SkipOnErrorInterface

Method Details

Hide inherited methods

shouldSkipOnError() public abstract method

Returns current "skip on error" value.

public abstract boolean shouldSkipOnError ( )
return boolean

Current value. true means to skip the current rule when the previous one errored and false - do not skip.

                public function shouldSkipOnError(): bool;

            
skipOnError() public abstract method

Changes current "skip on error" value. Must be immutable.

public abstract $this skipOnError ( boolean $value )
$value boolean

A new value. true means to skip the current rule when the previous one errored and false - do not skip.

return $this

The new instance of a rule with a changed value.

                public function skipOnError(bool $value): static;