| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | namespace Yiisoft\Validator; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Closure; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use InvalidArgumentException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use JetBrains\PhpStorm\Pure; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Psr\Container\ContainerExceptionInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Psr\Container\NotFoundExceptionInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use ReflectionProperty; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Traversable; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Yiisoft\Translator\TranslatorInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use Yiisoft\Validator\DataSet\ArrayDataSet; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use Yiisoft\Validator\DataSet\ObjectDataSet; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Yiisoft\Validator\DataSet\SingleValueDataSet; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use Yiisoft\Validator\Rule\Callback; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use Yiisoft\Validator\Rule\Trait\PreValidateTrait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | use Yiisoft\Validator\RulesProvider\AttributesRulesProvider; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | use function is_array; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | use function is_callable; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | use function is_int; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | use function is_object; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | use function is_string; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  * Validator validates {@link LimitInterface} against rules set for data set attributes. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | final class Validator implements ValidatorInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     use PreValidateTrait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |      * @var callable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     private $defaultSkipOnEmptyCallback; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 | 680 |  |     public function __construct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         private RuleHandlerResolverInterface $ruleHandlerResolver, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         private TranslatorInterface $translator, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |          * @var int What visibility levels to use when reading rules from the class specified in `$rules` argument in | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |          * {@see validate()} method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |          */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         private int $rulesPropertyVisibility = ReflectionProperty::IS_PRIVATE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         | ReflectionProperty::IS_PROTECTED | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         | ReflectionProperty::IS_PUBLIC, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         bool|callable|null $defaultSkipOnEmpty = null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 | 680 |  |         $this->defaultSkipOnEmptyCallback = SkipOnEmptyNormalizer::normalize($defaultSkipOnEmpty); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |      * @param LimitInterface|mixed|RulesProviderInterface $data | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |      * @param class-string|iterable<Closure|Closure[]|RuleInterface|RuleInterface[]>|RuleInterface|RulesProviderInterface|null $rules | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |      * @throws ContainerExceptionInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |      * @throws NotFoundExceptionInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 | 700 |  |     public function validate(mixed $data, iterable|object|string|null $rules = null): Result | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 | 700 |  |         $data = $this->normalizeDataSet($data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 | 700 |  |         if ($rules === null && $data instanceof RulesProviderInterface) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 | 27 |  |             $rules = $data->getRules(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 | 677 |  |         } elseif ($rules instanceof RulesProviderInterface) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 | 2 |  |             $rules = $rules->getRules(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 675 |  |         } elseif ($rules instanceof RuleInterface) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 | 1 |  |             $rules = [$rules]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 | 674 |  |         } elseif (!$rules instanceof Traversable && !is_array($rules) && $rules !== null) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |             $rules = (new AttributesRulesProvider($rules, $this->rulesPropertyVisibility))->getRules(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 | 700 |  |         $compoundResult = new Result(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 | 700 |  |         $context = new ValidationContext($this, $data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 | 700 |  |         $results = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |         /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |          * @var mixed $attribute | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |          * @var iterable<Closure|RuleInterface>|RuleInterface $attributeRules | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |          */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 | 700 |  |         foreach ($rules ?? [] as $attribute => $attributeRules) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 | 689 |  |             $result = new Result(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 | 689 |  |             if (!is_iterable($attributeRules)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 | 614 |  |                 $attributeRules = [$attributeRules]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 | 689 |  |             $attributeRules = $this->normalizeRules($attributeRules); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 | 689 |  |             if (is_int($attribute)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |                 /** @psalm-suppress MixedAssignment */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 | 599 |  |                 $validatedData = $data->getData(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 | 94 |  |             } elseif (is_string($attribute)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |                 /** @psalm-suppress MixedAssignment */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 | 94 |  |                 $validatedData = $data->getAttributeValue($attribute); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 | 94 |  |                 $context = $context->withAttribute($attribute); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |                 $message = sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |                     'An attribute can only have an integer or a string type. %s given.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |                     get_debug_type($attribute), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |                 throw new InvalidArgumentException($message); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 | 689 |  |             $tempResult = $this->validateInternal($validatedData, $attributeRules, $context); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 | 661 |  |             foreach ($tempResult->getErrors() as $error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 | 384 |  |                 $result->addError($error->getMessage(), $error->getParameters(), $error->getValuePath()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 | 661 |  |             $results[] = $result; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 | 672 |  |         foreach ($results as $result) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 | 661 |  |             foreach ($result->getErrors() as $error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 | 384 |  |                 $compoundResult->addError( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 | 384 |  |                     $this->translator->translate($error->getMessage(), $error->getParameters()), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 | 384 |  |                     $error->getParameters(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 | 384 |  |                     $error->getValuePath() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 | 672 |  |         if ($data instanceof PostValidationHookInterface) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |             $data->processValidationResult($compoundResult); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 | 672 |  |         return $compoundResult; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 | 700 |  |     #[Pure] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |     private function normalizeDataSet(mixed $data): DataSetInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 | 700 |  |         if ($data instanceof DataSetInterface) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 | 69 |  |             return $data; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 | 636 |  |         if (is_object($data)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 | 37 |  |             return new ObjectDataSet($data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 | 603 |  |         if (is_array($data)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 | 105 |  |             return new ArrayDataSet($data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 | 521 |  |         return new SingleValueDataSet($data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |      * @param iterable<RuleInterface> $rules | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 | 689 |  |     private function validateInternal(mixed $value, iterable $rules, ValidationContext $context): Result | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 | 689 |  |         $compoundResult = new Result(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 | 689 |  |         foreach ($rules as $rule) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 | 689 |  |             if ($this->preValidate($value, $context, $rule)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 | 27 |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 | 683 |  |             $ruleHandler = $this->ruleHandlerResolver->resolve($rule->getHandlerClassName()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 | 681 |  |             $ruleResult = $ruleHandler->validate($value, $rule, $context); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 | 655 |  |             if ($ruleResult->isValid()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 | 294 |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 | 384 |  |             $context->setParameter($this->parameterPreviousRulesErrored, true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 | 384 |  |             foreach ($ruleResult->getErrors() as $error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 | 384 |  |                 $valuePath = $error->getValuePath(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 | 384 |  |                 if ($context->getAttribute() !== null) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 | 67 |  |                     $valuePath = [$context->getAttribute(), ...$valuePath]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 | 384 |  |                 $compoundResult->addError($error->getMessage(), $error->getParameters(), $valuePath); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 | 661 |  |         return $compoundResult; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |      * @param iterable<Closure|RuleInterface> $rules | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |      * @return iterable<RuleInterface> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 | 689 |  |     private function normalizeRules(iterable $rules): iterable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 | 689 |  |         foreach ($rules as $rule) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 | 689 |  |             yield $this->normalizeRule($rule); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 194 | 689 |  |     private function normalizeRule(RuleInterface|Closure $rule): RuleInterface | 
            
                                                                        
                            
            
                                    
            
            
                | 195 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 196 | 689 |  |         if (is_callable($rule)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 197 | 3 |  |             return new Callback($rule); | 
            
                                                                        
                            
            
                                    
            
            
                | 198 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 199 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 200 | 689 |  |         if (!$rule instanceof RuleInterface) { | 
            
                                                                        
                            
            
                                    
            
            
                | 201 |  |  |             throw new InvalidArgumentException( | 
            
                                                                        
                            
            
                                    
            
            
                | 202 |  |  |                 sprintf( | 
            
                                                                        
                            
            
                                    
            
            
                | 203 |  |  |                     'Rule should be either an instance of %s or a callable, %s given.', | 
            
                                                                        
                            
            
                                    
            
            
                | 204 |  |  |                     RuleInterface::class, | 
            
                                                                        
                            
            
                                    
            
            
                | 205 |  |  |                     get_debug_type($rule) | 
            
                                                                        
                            
            
                                    
            
            
                | 206 |  |  |                 ) | 
            
                                                                        
                            
            
                                    
            
            
                | 207 |  |  |             ); | 
            
                                                                        
                            
            
                                    
            
            
                | 208 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 209 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 210 | 689 |  |         if ($rule instanceof SkipOnEmptyInterface && $rule->getSkipOnEmpty() === null) { | 
            
                                                                        
                            
            
                                    
            
            
                | 211 | 602 |  |             $rule = $rule->skipOnEmpty($this->defaultSkipOnEmptyCallback); | 
            
                                                                        
                            
            
                                    
            
            
                | 212 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 213 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 214 | 689 |  |         return $rule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 216 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 217 |  |  |  |