Skip to content

Composite + Nested combination shows incorrect message for Required #565

@arogachev

Description

@arogachev

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.',
    ],
],

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions