diff options
author | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2024-02-08 11:52:40 +0100 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2024-02-08 18:27:44 +0100 |
commit | 303e2febc717065581a3e3bdc92e1672bb8253dc (patch) | |
tree | c8f88c01fa1e7f93958a6b48bee3aa4bf5525dfb /lib/private/Command/CronBus.php | |
parent | f6ed1effbf4bb040ab35c625159ad80caff5e687 (diff) | |
download | nextcloud-server-303e2febc717065581a3e3bdc92e1672bb8253dc.tar.gz nextcloud-server-303e2febc717065581a3e3bdc92e1672bb8253dc.zip |
Merge pull request #43387 from nextcloud/fix/migrate-away-from-ilogger-in-jobs
Diffstat (limited to 'lib/private/Command/CronBus.php')
-rw-r--r-- | lib/private/Command/CronBus.php | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/lib/private/Command/CronBus.php b/lib/private/Command/CronBus.php index 42ff458a95c..495cd011db1 100644 --- a/lib/private/Command/CronBus.php +++ b/lib/private/Command/CronBus.php @@ -26,31 +26,25 @@ namespace OC\Command; use Laravel\SerializableClosure\SerializableClosure; +use OCP\BackgroundJob\IJob; +use OCP\BackgroundJob\IJobList; use OCP\Command\ICommand; class CronBus extends AsyncBus { - /** - * @var \OCP\BackgroundJob\IJobList - */ - private $jobList; - - - /** - * @param \OCP\BackgroundJob\IJobList $jobList - */ - public function __construct($jobList) { - $this->jobList = $jobList; + public function __construct( + private IJobList $jobList, + ) { } - protected function queueCommand($command) { + protected function queueCommand($command): void { $this->jobList->add($this->getJobClass($command), $this->serializeCommand($command)); } /** - * @param \OCP\Command\ICommand | callable $command - * @return string + * @param ICommand|callable $command + * @return class-string<IJob> */ - private function getJobClass($command) { + private function getJobClass($command): string { if ($command instanceof \Closure) { return ClosureJob::class; } elseif (is_callable($command)) { @@ -63,10 +57,10 @@ class CronBus extends AsyncBus { } /** - * @param \OCP\Command\ICommand | callable $command + * @param ICommand|callable $command * @return string */ - private function serializeCommand($command) { + private function serializeCommand($command): string { if ($command instanceof \Closure) { return serialize(new SerializableClosure($command)); } elseif (is_callable($command) or $command instanceof ICommand) { |