From be8e168f381124d44dc5abefb35e38a6b8a3d850 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Tue, 14 Oct 2025 15:51:31 +0200 Subject: [PATCH] fix: Address psalm issues and review comments Signed-off-by: Marcel Klehr --- core/Controller/TaskProcessingApiController.php | 4 ++-- lib/private/TaskProcessing/Manager.php | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index ed0351f80d4..057ee447fb2 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -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(); diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index e3f466755d6..c2e272c76c3 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -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); } }