system/Validation/Validation.php
public function setError(string $field, string $error): ValidationInterface
	{
		$this->errors[$field] = $error;

		return $this;
	}
public function setError(string $field, string $error): ValidationInterface
	{
		$this->errors[$field] = $error;

		return $this;
	}
Sets the error for a specific field. Used by custom validation methods.

@param string $field
@param string $error

@return \CodeIgniter\Validation\ValidationInterface