system/Validation/Validation.php
public function setRules(array $rules, array $errors = []): ValidationInterface
	{
		$this->customErrors = $errors;

		foreach ($rules as $field => &$rule)
		{
			if (is_array($rule))
			{
				if (array_key_exists('errors', $rule))
				{
					$this->customErrors[$field] = $rule['errors'];
					unset($rule['errors']);
				}
			}
		}

		$this->rules = $rules;

		return $this;
	}
public function setRules(array $rules, array $errors = []): ValidationInterface
	{
		$this->customErrors = $errors;

		foreach ($rules as $field => &$rule)
		{
			if (is_array($rule))
			{
				if (array_key_exists('errors', $rule))
				{
					$this->customErrors[$field] = $rule['errors'];
					unset($rule['errors']);
				}
			}
		}

		$this->rules = $rules;

		return $this;
	}
Stores the rules that should be used to validate the items.
Rules should be an array formatted like:

[
'field' => 'rule1|rule2'
]

The $errors array should be formatted like:
[
'field' => [
'rule' => 'message',
'rule' => 'message
],
]

@param array $rules
@param array $errors // An array of custom error messages

@return \CodeIgniter\Validation\ValidationInterface