aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Command/CronBus.php
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-02-08 15:23:28 +0100
committerLouis Chemineau <louis@chmn.me>2024-02-08 15:23:28 +0100
commitd9d60238c7aaab9c61bf2d50c15aa59bc88c8975 (patch)
tree4f0277b12a3608c09a88a67f3934b6174e47ba1d /lib/private/Command/CronBus.php
parentba3fdb0cdcfbb84f0080a2146a4ba2f01569915d (diff)
parentca5f7adebc671b9e18ecdba0afda62fc23a381e4 (diff)
downloadnextcloud-server-d9d60238c7aaab9c61bf2d50c15aa59bc88c8975.tar.gz
nextcloud-server-d9d60238c7aaab9c61bf2d50c15aa59bc88c8975.zip
Merge branch 'master' of github.com:nextcloud/server
Diffstat (limited to 'lib/private/Command/CronBus.php')
-rw-r--r--lib/private/Command/CronBus.php28
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) {