validator icon indicating copy to clipboard operation
validator copied to clipboard

`Composite` + `Nested` combination shows incorrect message for `Required`

Open arogachev opened this issue 3 years ago • 0 comments

Similar to #556.

$rule = new class () extends Composite {
    public function getRules(): array
    {
        return [
            new Nested([
                'name' => [new Required(), new Length(min: 1)],
            ]),
        ];
    }
};
$result = (new Validator())->validate([], $rule);
$errors = $result->getErrorMessagesIndexedByPath();

Expected:

[
    'name' => [
        'Value not passed.',
        'The value must be a string.',
    ],
],

Actual:

[
    'name' => [
        'Value cannot be blank.',
        'The value must be a string.',
    ],
],

arogachev avatar Feb 14 '23 15:02 arogachev