src/Base/Model.php
public function createValidators()
    {
        $validators = new ArrayObject();
        foreach ($this->rules() as $rule) {
            if ($rule instanceof Validator) {
                $validators->append($rule);
            } elseif (is_array($rule) && isset($rule[0], $rule[1])) { // attributes, validator type
                try {
                    $validator = Validator::createValidator($rule[1], $this, (array)$rule[0], array_slice($rule, 2));
                } catch (\Exception $e) {
                    Reaction::error($e);
                }
                if (isset($validator)) {
                    $validators->append($validator);
                }
            } else {
                throw new InvalidConfigException('Invalid validation rule: a rule must specify both attribute names and validator type.');
            }
        }

        return $validators;
    }
public function createValidators()
    {
        $validators = new ArrayObject();
        foreach ($this->rules() as $rule) {
            if ($rule instanceof Validator) {
                $validators->append($rule);
            } elseif (is_array($rule) && isset($rule[0], $rule[1])) { // attributes, validator type
                try {
                    $validator = Validator::createValidator($rule[1], $this, (array)$rule[0], array_slice($rule, 2));
                } catch (\Exception $e) {
                    Reaction::error($e);
                }
                if (isset($validator)) {
                    $validators->append($validator);
                }
            } else {
                throw new InvalidConfigException('Invalid validation rule: a rule must specify both attribute names and validator type.');
            }
        }

        return $validators;
    }
Creates validator objects based on the validation rules specified in [[rules()]].
Unlike [[getValidators()]], each time this method is called, a new list of validators will be returned.
@return ArrayObject validators
@throws InvalidConfigException if any validation rule configuration is invalid