fix: Address psalm issues and review comments

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2025-10-14 15:51:31 +02:00
parent 16da8bbc8a
commit be8e168f38
2 changed files with 9 additions and 9 deletions

View file

@ -621,7 +621,7 @@ class TaskProcessingApiController extends OCSController {
$hasMore = count($tasks) > 0;
return new DataResponse([
'tasks' => $tasks,
'tasks' => $tasksJson,
'has_more' => $hasMore,
]);
} catch (Exception) {
@ -650,7 +650,7 @@ class TaskProcessingApiController extends OCSController {
* @param array $providerIds
* @return array
*/
public function intersectTaskTypesAndProviders(array $taskTypeIds, array $providerIds): array {
private function intersectTaskTypesAndProviders(array $taskTypeIds, array $providerIds): array {
$providerIdsBasedOnTaskTypesWithNull = array_unique(array_map(function ($taskTypeId) {
try {
return $this->taskProcessingManager->getPreferredProvider($taskTypeId)->getId();

View file

@ -1184,23 +1184,23 @@ class Manager implements IManager {
$taskEntity = $this->taskMapper->findOldestScheduledByType($taskTypeIds, $taskIdsToIgnore);
return $taskEntity->toPublicTask();
} catch (DoesNotExistException $e) {
throw new \OCP\TaskProcessing\Exception\NotFoundException('Could not find the task', 0, $e);
throw new \OCP\TaskProcessing\Exception\NotFoundException('Could not find the task', previous: $e);
} catch (\OCP\DB\Exception $e) {
throw new \OCP\TaskProcessing\Exception\Exception('There was a problem finding the task', 0, $e);
throw new \OCP\TaskProcessing\Exception\Exception('There was a problem finding the task', previous: $e);
} catch (\JsonException $e) {
throw new \OCP\TaskProcessing\Exception\Exception('There was a problem parsing JSON after finding the task', 0, $e);
throw new \OCP\TaskProcessing\Exception\Exception('There was a problem parsing JSON after finding the task', previous: $e);
}
}
public function getNextScheduledTasks(array $taskTypeIds = [], array $taskIdsToIgnore = [], int $numberOfTasks = 1): array {
try {
return array_map(fn ($taskEntity) => $taskEntity->toPublicTask(), $this->taskMapper->findNOldestScheduledByType($taskTypeIds, $taskIdsToIgnore, $numberOfTasks);
return array_map(fn ($taskEntity) => $taskEntity->toPublicTask(), $this->taskMapper->findNOldestScheduledByType($taskTypeIds, $taskIdsToIgnore, $numberOfTasks));
} catch (DoesNotExistException $e) {
throw new \OCP\TaskProcessing\Exception\NotFoundException('Could not find the task', 0, $e);
throw new \OCP\TaskProcessing\Exception\NotFoundException('Could not find the task', previous: $e);
} catch (\OCP\DB\Exception $e) {
throw new \OCP\TaskProcessing\Exception\Exception('There was a problem finding the task', 0, $e);
throw new \OCP\TaskProcessing\Exception\Exception('There was a problem finding the task', previous: $e);
} catch (\JsonException $e) {
throw new \OCP\TaskProcessing\Exception\Exception('There was a problem parsing JSON after finding the task', 0, $e);
throw new \OCP\TaskProcessing\Exception\Exception('There was a problem parsing JSON after finding the task', previous: $e);
}
}