// If the rule wasn't found anywhere, we
// should throw an exception so the developer can find it.
if (!
$found) { throw ValidationException::
forRuleNotFound($rule);
} } // Set the error message if we didn't survive.
if ($passed === false
) { // if the $value is an array, convert it to as string representation
if (is_array($value)) { $value =
$this->
isStringList($value) ? '[' .
implode(', ',
$value) . ']'
:
json_encode($value);
} elseif (is_object($value)) { $value =
json_encode($value);
} $param =
($param === false
) ? '' :
$param;
// @phpstan-ignore-next-line $error may be set by rule methods.
$this->errors
[$field] =
$error ??
$this->
getErrorMessage( $this->
isClosure($rule) ?
$i :
$rule,