8000 Do not raise an UnexpectedTypeException for All or Collection validators · Issue #13560 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Do not raise an UnexpectedTypeException for All or Collection validators #13560

@stuartcarnie

Description

@stuartcarnie

When checking the value type, AllValidator should build a regular validation error rather than throw an exception.

For example with this set of rules:

$rules = new Assert\Collection([
    'emails'        => new Assert\All([
        new Assert\Email()
    ])
]);

The following data should not raise an UnexpectedTypeException, but rather behave like the Type validator and build a validation error that the expected type is an array.

[
   'emails' => ''
]

The same should be applied to CollectionValidator; if the type is not an array, create a validation error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0