From 7dc304db02e2c7f7954f150bc7953db11e6bbc99 Mon Sep 17 00:00:00 2001 From: Hamid Dehnavi Date: Thu, 6 Jul 2023 11:37:03 +0330 Subject: Refactor core/Command/Background Signed-off-by: Hamid Dehnavi --- core/Command/Background/Ajax.php | 2 +- core/Command/Background/Base.php | 3 ++- core/Command/Background/Cron.php | 2 +- core/Command/Background/Job.php | 8 +++++++- core/Command/Background/WebCron.php | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) (limited to 'core/Command') diff --git a/core/Command/Background/Ajax.php b/core/Command/Background/Ajax.php index 5dc94d939d7..41b80eb531f 100644 --- a/core/Command/Background/Ajax.php +++ b/core/Command/Background/Ajax.php @@ -26,7 +26,7 @@ namespace OC\Core\Command\Background; class Ajax extends Base { - protected function getMode() { + protected function getMode(): string { return 'ajax'; } } diff --git a/core/Command/Background/Base.php b/core/Command/Background/Base.php index 5b2da21af75..715596f9979 100644 --- a/core/Command/Background/Base.php +++ b/core/Command/Background/Base.php @@ -45,7 +45,7 @@ abstract class Base extends Command { parent::__construct(); } - protected function configure() { + protected function configure(): void { $mode = $this->getMode(); $this ->setName("background:$mode") @@ -59,6 +59,7 @@ abstract class Base extends Command { * * @param InputInterface $input * @param OutputInterface $output + * @return int */ protected function execute(InputInterface $input, OutputInterface $output): int { $mode = $this->getMode(); diff --git a/core/Command/Background/Cron.php b/core/Command/Background/Cron.php index 9dbb4f855e5..665919b5ae9 100644 --- a/core/Command/Background/Cron.php +++ b/core/Command/Background/Cron.php @@ -26,7 +26,7 @@ namespace OC\Core\Command\Background; class Cron extends Base { - protected function getMode() { + protected function getMode(): string { return 'cron'; } } diff --git a/core/Command/Background/Job.php b/core/Command/Background/Job.php index fdfb7484b51..dfa413b958b 100644 --- a/core/Command/Background/Job.php +++ b/core/Command/Background/Job.php @@ -58,6 +58,9 @@ class Job extends Command { ; } + /** + * @throws \ReflectionException + */ protected function execute(InputInterface $input, OutputInterface $output): int { $jobId = (int) $input->getArgument('job-id'); @@ -102,7 +105,10 @@ class Job extends Command { return 0; } - protected function printJobInfo(int $jobId, IJob $job, OutputInterface$output): void { + /** + * @throws \ReflectionException + */ + protected function printJobInfo(int $jobId, IJob $job, OutputInterface $output): void { $row = $this->jobList->getDetailsById($jobId); $lastRun = new \DateTime(); diff --git a/core/Command/Background/WebCron.php b/core/Command/Background/WebCron.php index 7da379b6a53..59bf4746c40 100644 --- a/core/Command/Background/WebCron.php +++ b/core/Command/Background/WebCron.php @@ -26,7 +26,7 @@ namespace OC\Core\Command\Background; class WebCron extends Base { - protected function getMode() { + protected function getMode(): string { return 'webcron'; } } -- cgit v1.2.3 From 5c64528336d2744b1a969f448a60147f55390492 Mon Sep 17 00:00:00 2001 From: Hamid Dehnavi Date: Fri, 7 Jul 2023 02:25:55 +0330 Subject: Make adjustments based on the review Signed-off-by: Hamid Dehnavi Co-authored-by: Christoph Wurst --- core/Command/Background/Job.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'core/Command') diff --git a/core/Command/Background/Job.php b/core/Command/Background/Job.php index dfa413b958b..aa54d4ce482 100644 --- a/core/Command/Background/Job.php +++ b/core/Command/Background/Job.php @@ -105,9 +105,6 @@ class Job extends Command { return 0; } - /** - * @throws \ReflectionException - */ protected function printJobInfo(int $jobId, IJob $job, OutputInterface $output): void { $row = $this->jobList->getDetailsById($jobId); -- cgit v1.2.3 From 706231438eed9e8261133df4b772a86d480dcfa0 Mon Sep 17 00:00:00 2001 From: Hamid Dehnavi Date: Fri, 7 Jul 2023 13:24:04 +0330 Subject: Make adjustments based on the review Signed-off-by: Hamid Dehnavi Co-authored-by: Christoph Wurst --- core/Command/Background/Job.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'core/Command') diff --git a/core/Command/Background/Job.php b/core/Command/Background/Job.php index aa54d4ce482..0c64a05e2a7 100644 --- a/core/Command/Background/Job.php +++ b/core/Command/Background/Job.php @@ -58,9 +58,6 @@ class Job extends Command { ; } - /** - * @throws \ReflectionException - */ protected function execute(InputInterface $input, OutputInterface $output): int { $jobId = (int) $input->getArgument('job-id'); -- cgit v1.2.3