Skip to content
This repository was archived by the owner on Jul 6, 2024. It is now read-only.

Latest commit

 

History

History
28 lines (23 loc) · 490 Bytes

File metadata and controls

28 lines (23 loc) · 490 Bytes

ErrorMessages

<?php

use Chubbyphp\Validation\Error\Error;
use Chubbyphp\Validation\Error\ErrorMessages;

$error = new Error(
    'path.to.property',
    'constraint.constraint.invalidtype',
    ['type' => 'array']
);

$errorMessages = new ErrorMessages(
    [$error],
    function (string $key, array $arguments) {
        return $key;
    }
);

$errorMessages->getMessages();
// [
//     'path.to.property' => [
//         'constraint.constraint.invalidtype'
//      ]
// ]