mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Fix typing in IJobList
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
cc89da26c6
commit
2e921f8b3d
2 changed files with 20 additions and 26 deletions
|
|
@ -51,7 +51,7 @@ class JobList implements IJobList {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param IJob|string $job
|
||||
* @param IJob|class-string<IJob> $job
|
||||
* @param mixed $argument
|
||||
*/
|
||||
public function add($job, $argument = null): void {
|
||||
|
|
@ -132,7 +132,7 @@ class JobList implements IJobList {
|
|||
/**
|
||||
* check if a job is in the list
|
||||
*
|
||||
* @param IJob|string $job
|
||||
* @param IJob|class-string<IJob> $job
|
||||
* @param mixed $argument
|
||||
*/
|
||||
public function has($job, $argument): bool {
|
||||
|
|
@ -164,7 +164,7 @@ class JobList implements IJobList {
|
|||
* @deprecated 9.0.0 - This method is dangerous since it can cause load and
|
||||
* memory problems when creating too many instances. Use getJobs instead.
|
||||
*/
|
||||
public function getAll() {
|
||||
public function getAll(): array {
|
||||
return $this->getJobs(null, null, 0);
|
||||
}
|
||||
|
||||
|
|
@ -261,10 +261,7 @@ class JobList implements IJobList {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*/
|
||||
public function getById($id): ?IJob {
|
||||
public function getById(int $id): ?IJob {
|
||||
$row = $this->getDetailsById($id);
|
||||
|
||||
if ($row) {
|
||||
|
|
@ -375,7 +372,6 @@ class JobList implements IJobList {
|
|||
/**
|
||||
* Reset the $job so it executes on the next trigger
|
||||
*
|
||||
* @param IJob $job
|
||||
* @since 23.0.0
|
||||
*/
|
||||
public function resetBackgroundJob(IJob $job): void {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* @author Noveen Sachdeva <noveen.sachdeva@research.iiit.ac.in>
|
||||
* @author Robin Appelman <robin@icewind.nl>
|
||||
* @author Robin McCorkell <robin@mccorkell.me.uk>
|
||||
* @author Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
|
|
@ -41,36 +42,38 @@ namespace OCP\BackgroundJob;
|
|||
* be specified in the constructor of the job by calling
|
||||
* $this->setInterval($interval) with $interval in seconds.
|
||||
*
|
||||
* This interface should be used directly and not implemented by an application.
|
||||
* The implementation is provided by the server.
|
||||
*
|
||||
* @since 7.0.0
|
||||
*/
|
||||
interface IJobList {
|
||||
/**
|
||||
* Add a job to the list
|
||||
*
|
||||
* @param IJob|string $job
|
||||
* @param IJob|class-string<IJob> $job
|
||||
* @param mixed $argument The argument to be passed to $job->run() when the job is exectured
|
||||
* @since 7.0.0
|
||||
*/
|
||||
public function add($job, $argument = null);
|
||||
public function add($job, $argument = null): void;
|
||||
|
||||
/**
|
||||
* Remove a job from the list
|
||||
*
|
||||
* @param IJob|string $job
|
||||
* @param IJob|class-string<IJob> $job
|
||||
* @param mixed $argument
|
||||
* @since 7.0.0
|
||||
*/
|
||||
public function remove($job, $argument = null);
|
||||
public function remove($job, $argument = null): void;
|
||||
|
||||
/**
|
||||
* check if a job is in the list
|
||||
*
|
||||
* @param IJob|string $job
|
||||
* @param IJob|class-string<IJob> $job
|
||||
* @param mixed $argument
|
||||
* @return bool
|
||||
* @since 7.0.0
|
||||
*/
|
||||
public function has($job, $argument);
|
||||
public function has($job, $argument): bool;
|
||||
|
||||
/**
|
||||
* get all jobs in the list
|
||||
|
|
@ -80,7 +83,7 @@ interface IJobList {
|
|||
* @deprecated 9.0.0 - This method is dangerous since it can cause load and
|
||||
* memory problems when creating too many instances. Use getJobs instead.
|
||||
*/
|
||||
public function getAll();
|
||||
public function getAll(): array;
|
||||
|
||||
/**
|
||||
* Get jobs matching the search
|
||||
|
|
@ -94,18 +97,14 @@ interface IJobList {
|
|||
/**
|
||||
* get the next job in the list
|
||||
*
|
||||
* @param bool $onlyTimeSensitive
|
||||
* @return IJob|null
|
||||
* @since 7.0.0 - In 24.0.0 parameter $onlyTimeSensitive got added
|
||||
*/
|
||||
public function getNext(bool $onlyTimeSensitive = false): ?IJob;
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return IJob|null
|
||||
* @since 7.0.0
|
||||
*/
|
||||
public function getById($id);
|
||||
public function getById(int $id): ?IJob;
|
||||
|
||||
/**
|
||||
* @since 23.0.0
|
||||
|
|
@ -117,29 +116,28 @@ interface IJobList {
|
|||
*
|
||||
* @since 7.0.0
|
||||
*/
|
||||
public function setLastJob(IJob $job);
|
||||
public function setLastJob(IJob $job): void;
|
||||
|
||||
/**
|
||||
* Remove the reservation for a job
|
||||
*
|
||||
* @since 9.1.0
|
||||
*/
|
||||
public function unlockJob(IJob $job);
|
||||
public function unlockJob(IJob $job): void;
|
||||
|
||||
/**
|
||||
* set the lastRun of $job to now
|
||||
*
|
||||
* @since 7.0.0
|
||||
*/
|
||||
public function setLastRun(IJob $job);
|
||||
public function setLastRun(IJob $job): void;
|
||||
|
||||
/**
|
||||
* set the run duration of $job
|
||||
*
|
||||
* @param int $timeTaken
|
||||
* @since 12.0.0
|
||||
*/
|
||||
public function setExecutionTime(IJob $job, $timeTaken);
|
||||
public function setExecutionTime(IJob $job, int $timeTaken): void;
|
||||
|
||||
/**
|
||||
* Reset the $job so it executes on the next trigger
|
||||
|
|
|
|||
Loading…
Reference in a new issue