diff --git a/src/Validator.php b/src/Validator.php index 0dfd433..7d49892 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -71,7 +71,7 @@ private static function customFormat(ValidationError $error): array $formattedMessage = $formatter->formatErrorMessage($error); if (isset($error->data()->fullPath()[0])) $formattedMessage = "Validation error on `" . $error->data()->fullPath()[0] . "`. " . $formattedMessage; - if (isset($error->data()->fullPath()[0])) $formattedMessage = $formattedMessage . ". But `" . $error->data()->value() . "` given." . "`. "; + if (isset($error->data()->fullPath()[0]) && !is_object($error->data()->value())) $formattedMessage = $formattedMessage . ". But `" . $error->data()->value() . "` given." . "`. "; return [ 'properties' => $error->schema()->info()->data(),