Add validator error from validator classes and methods. This error
reset on every re-validation

@param string $fieldName dot-notated field name
@param string $ruleName name of validation rule
@param string $message error message

@return Structure
12197
public function addError($fieldName, $ruleName, $message)
    {
        $this->errors[$fieldName][$ruleName] = $message;

        return $this;
    }
1008541
protected function replaceRequiredIf($message, $attribute, $rule, $parameters)
	{
		$parameters[0] = $this->getAttribute($parameters[0]);

		return str_replace(array(':other', ':value'), $parameters, $message);
	}
906252
public function validate(array $params, array $rules, array $messages = [])
    {
        $validator = app(Validator::class)->make($params, $rules, $messages);

        if ($validator->fails()) {
            throw new ValidationException(
                $validator, new JsonResponse($validator->errors()->getMessages(), 422)
            );
        }
    }
770775
protected function addError($message, $code, array $arguments = [])
    {
        $this->result->addError(new ValidationError($message, $code, $arguments));
    }
102862
protected function getValidationConfiguration(Field $field, $validationName, Validation $validatorConfiguration)
    {
        $acceptsEmptyValues = ValidatorService::get()->validatorAcceptsEmptyValues($validatorConfiguration->getClassName());

        /** @var FormzLocalizationJavaScriptAssetHandler $formzLocalizationJavaScriptAssetHandler */
        $formzLocalizationJavaScriptAssetHandler = $this->assetHandlerFactory->getAssetHandler(FormzLocalizationJavaScriptAssetHandler::class);

        $messages = $formzLocalizationJavaScriptAssetHandler->getTranslationKeysForFieldValidation($field, $validationName);

        return ArrayService::get()->arrayToJavaScriptJson([
            'options'            => $validatorConfiguration->getOptions(),
            'messages'           => $messages,
            'settings'           => $validatorConfiguration->toArray(),
            'acceptsEmptyValues' => $acceptsEmptyValues
        ]);
    }
187240
private function validateAgainstExpression( $field, $value, $rule, $message = null )
    {
        if (preg_match($this->expressions[ $rule ], $value)) {
            return true;
        }

        if (!$message) {
            $message = $this->error_messages[ $rule ];
        }

        static::$errors[ $field ] = $message;

        return false;
    }
557017
private function validateField($field, $data, $rules) {
		foreach ($rules as $rule) {
			list($m, $ops, $msg) = $rule;
			$valid_m = 'v_' . $m;
			if (method_exists($this, $valid_m)) {
				if ($msg) {
					$msg = preg_replace('#\{\d+?\}#', '%s', $msg);
				}
				$valid = $this->$valid_m ($field, $ops, $data, $msg);
			} else {
				return _t('notsupportmethod@validator', $field, $m);
			}
			if ($valid !== true) {
				return $valid;
			}
		}

		return true;
	}
308350
public function add_rule($field, $rule) {

		if(!$rule instanceof \HybridLogic\Validation\Rule) return $this;

		if(!isset($this->labels[$field])) {
			$this->set_label($field, $this->humanize_field_name($field));
		}

		if(!isset($this->rules[$field])) $this->rules[$field] = array();
		$this->rules[$field][] = $rule;

		return $this;

	}
143828
def validate(self, message):
        
        for key, field in self.fields.items():
            if key not in message:
                raise ValidationError(message, "Field %r is missing" % (key, ))
            field.validate(message[key])

        if self.allow_additional_fields:
            return
        # Otherwise, additional fields are not allowed:
        fieldSet = set(self.fields) | set(RESERVED_FIELDS)
        for key in message:
            if key not in fieldSet:
                raise ValidationError(message, "Unexpected field %r" % (key, ))
805928
public function addValidator($rule, $callback)
    {
        $method = 'validate_'.$rule;

        if (method_exists(__CLASS__, $method) || isset($this->validation_methods[$rule])) {
            throw new Exception("Validator rule '$rule' already exists.");
        }

        $this->validation_methods[$rule] = $callback;

        return $this;
    }
674198
private function add_validator_to_stack( $validator, $key, $error_message = NULL ) {

		$options = [ ];

		if ( is_array( $validator ) && isset( $validator[ 'validator' ] ) ) {
			isset( $validator[ 'options' ] ) and $options = (array) $validator[ 'options' ];
			$validator = $validator[ 'validator' ];
		}

		$validator = $this->validator_factory->create( $validator, $options );

		isset( $this->validators[ $key ] ) or $this->validators[ $key ] = new \SplObjectStorage();
		$this->validators[ $key ]->attach( $validator, $error_message );

		return $this;

	}
334273
public function addValidationMessage($rule, $message)
    {
        if (($pos = strpos($rule, ':')) !== false) {
            $rule = substr($rule, 0, $pos);
        }

        $this->validationMessages[$rule] = $message;

        return $this;
    }
109770
public function set_message($rule, $message)
	{
		if ($message !== null)
		{
			$this->error_messages[$rule] = $message;
		}
		else
		{
			unset($this->error_messages[$rule]);
		}

		return $this;
	}
485843
public function one($value,$rule,$message=[])
    {
        $this->clear();
        $this->from['one']=$value;
        $value=strtolower($rule);
        if(strpos($value, '|')===false){
            $rule=[$value];
        }else{
            $tmp=explode('|',$value);
            $rule=$tmp;
        }
        foreach ($message as $key=>$value){
            $keys=strtolower($key);
            $this->msge['one'][$keys]=$value;
        }
        return $this->checks('one',$rule);
    }
767465
private function validateAndThrowOnError(string $paramName, $value, int $ruleIndex): void
    {
        BlockInterpreter::executeBlock(
            $value,
            $ruleIndex,
            $this->getValidationBlocks(),
            $this->getContext(),
            $this->getCaptures(),
            $this->getValidationErrors()
        );
        $this->checkValidationQueueErrors($paramName);
    }
1110808
public function setValidator(string $name, callable $callback, string $message = ''): self
    {
        if ($name = \trim($name)) {
            $this->_validators[$name] = $callback;

            if ($message) {
                $this->setMessage($name, $message);
            }
        }

        return $this;
    }
616191
public static function add_validator($rule, $callback, $error_message = null)
    {
        $method = 'validate_'.$rule;

        if (method_exists(__CLASS__, $method) || isset(self::$validation_methods[$rule])) {
            throw new Exception("Validator rule '$rule' already exists.");
        }

        self::$validation_methods[$rule] = $callback;
        if ($error_message) {
            self::$validation_methods_errors[$rule] = $error_message;
        }

        return true;
    }