body('role_ids', [])` * before handing them to a service or repository. * * @return list */ function toIntIds(mixed $value): array { if ($value === null || $value === '') { return []; } if (!is_array($value)) { $value = [$value]; } $ids = array_map('intval', $value); $ids = array_filter($ids, static fn (int $id): bool => $id > 0); return array_values(array_unique($ids)); }