use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Type;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
#[Package('core')]
class ArrayOfUuidValidator extends ConstraintValidator
{ public function validate(mixed
$value, Constraint
$constraint): void
{ if (!
$constraint instanceof ArrayOfUuidConstraint
) { throw new UnexpectedTypeException($constraint, Uuid::
class);
} // custom constraints should ignore null and empty values to allow
// other constraints (NotBlank, NotNull, etc.) take care of that
if ($value === null ||
empty($value)) { return;
} if (!\
is_array($value)) { $this->context->
buildViolation(ArrayOfUuidConstraint::INVALID_TYPE_MESSAGE
) ->
setCode(Type::INVALID_TYPE_ERROR
)