0 follower

Interface Yiisoft\Validator\RuleInterface

Implemented byYiisoft\Validator\DumpedRuleInterface, Yiisoft\Validator\Rule\Date\BaseDate, Yiisoft\Validator\Rule\Date\Date, Yiisoft\Validator\Rule\Date\DateTime, Yiisoft\Validator\Rule\Date\Time

A main interface for rules to implement. A rule contains a set of constraint configuration options to apply when validating data. If you want to include a rule options and customize its name during conversion to array, use extended version of it - {@see DumpedRuleInterface}.

Public Methods

Hide inherited methods

Method Description Defined By
getHandler() A matching handler name or an instance used for processing this rule. Yiisoft\Validator\RuleInterface

Method Details

Hide inherited methods

getHandler() public abstract method

A matching handler name or an instance used for processing this rule.

While not required, for naming of handlers' classes it's recommended to use a rule class name with "Handler" suffix, so for FilledAtLeast rule class name the handler class name will be FilledAtLeastHandler and so on.

All packages handlers are stored within the same namespace as rules, but this is not a strict requirement.

public abstract Yiisoft\Validator\RuleHandlerInterface|string getHandler ( )
return Yiisoft\Validator\RuleHandlerInterface|string

A rule handler name (for example my-handler) or an instance (for example new MyRuleHandler()).

                public function getHandler(): string|RuleHandlerInterface;