Interface Yiisoft\Validator\ValidatorInterface
| Implemented by | Yiisoft\Validator\Debug\ValidatorInterfaceProxy, Yiisoft\Validator\Validator |
|---|
An interface allowing to validate the data according to the set of rules ({@see RuleInterface}) and validation context ({@see ValidationContext}). A class implementing it is called "validator".
Psalm Types
| Name | Value |
|---|---|
| RawRulesList | iterable<integer, callable|Yiisoft\Validator\RuleInterface> |
| RawRulesMap | iterable<integer|string, Yiisoft\Validator\RuleInterface|callable|\Yiisoft\Validator\RawRulesList> |
| RawRules | class-string|object|callable|\Yiisoft\Validator\RawRulesMap |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| validate() | Validates the data according to the set of rules ({@see RuleInterface}) and validation context ({@see ValidationContext}). | Yiisoft\Validator\ValidatorInterface |
Method Details
Validates the data according to the set of rules ({@see RuleInterface}) and validation context ({@see ValidationContext}).
| public abstract Yiisoft\Validator\Result validate ( Yiisoft\Validator\DataSetInterface|mixed|Yiisoft\Validator\RulesProviderInterface $data, callable|iterable|object|string|null $rules = null, Yiisoft\Validator\ValidationContext|null $context = null ) | ||
| $data | Yiisoft\Validator\DataSetInterface|mixed|Yiisoft\Validator\RulesProviderInterface |
Data to validate:
|
| $rules | callable|iterable|object|string|null |
Rules to apply for validating data. If specified, this
argument has higher priority over {@see \Yiisoft\Validator\RulesProviderInterface::getRules()} provided in |
| $context | Yiisoft\Validator\ValidationContext|null |
Validation context that may be taken into account when performing validation. |
| return | Yiisoft\Validator\Result |
The result of validation. |
|---|---|---|
| throws | ReflectionException |
If an object / {@see \Yiisoft\Validator\ObjectDataSet} providing rules or (and) data used in |
public function validate(
mixed $data,
callable|iterable|object|string|null $rules = null,
?ValidationContext $context = null,
): Result;
Signup or Login in order to comment.