1 year ago

#349028

test-img

Toma Tomov

Assert ALL and TYPE in it for array

What I am trying to achieve is:

#[Assert\All(
        new Assert\NotBlank(),
        new Assert\Type(type: 'string')
    )]
    private ?array $roles;

But the Type assertion doesn't work. Shows this underlining: Expected parameter of type 'array|string[]|void', '\Symfony\Component\Validator\Constraints\Type' provided

symfony

symfony5

0 Answers

Your Answer

Accepted video resources