validator
validator copied to clipboard
Yii validator library
A suggestion from @xepozz. ``` prop1 prop2 prop3 Expression(this.prop1 > this.prop2 || this.prop1 in Constants::VALUES) prop1 ```
It's very popular along with emails nowadays.
Callable rule class may look like this: ```php final class MyRule { public function __invoke(mixed $value, object $rule, ValidationContext $context): Result { // ... } } ``` For simple custom...
Regardless of the passed rules' type it will always converted to array after this internal check: https://github.com/yiisoft/validator/blob/d0765827ad0afa0304379ccbb32e7bb5d976b5d1/src/Rule/Nested.php#L175 https://github.com/yiisoft/validator/blob/d0765827ad0afa0304379ccbb32e7bb5d976b5d1/src/Rule/Nested.php#L192 Need to adjust `ensureArrayHasRules()` behavior. Or maybe go even further and validate...
Related - #372. Extracted from https://github.com/yiisoft/validator/pull/394#issuecomment-1328868137.
Similar to `Required` - #336. https://github.com/yiisoft/validator/blob/470c380c3b1422b0e8cdd85b10c3d30aefc90352/src/Rule/AtLeastHandler.php#L39
Extracted from https://github.com/yiisoft/validator/pull/379#discussion_r1030204263.