Assert ALL and TYPE in it for array

Viewed 192

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

0 Answers
Related