Skip to content

Commit e6f8ce2

Browse files
authored
Refactor JobHandler class and docblocks
1 parent ded3233 commit e6f8ce2

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

lib/JobHandler.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class JobHandler
5151
public $endTime;
5252

5353
/**
54-
* @var Job|null Instance of the class performing work for this job.
54+
* @var Job Instance of the class performing work for this job.
5555
*/
5656
private $instance;
5757

@@ -68,7 +68,6 @@ class JobHandler
6868
*/
6969
public function __construct($queue, $payload)
7070
{
71-
$this->instance = null;
7271
$this->queue = $queue;
7372
$this->payload = $payload;
7473
$this->popTime = microtime(true);
@@ -81,12 +80,12 @@ public function __construct($queue, $payload)
8180
/**
8281
* Create a new job and save it to the specified queue.
8382
*
84-
* @param string $queue The name of the queue to place the job in.
85-
* @param class-string<Resque\Job\Job> $class The name of the class that contains the code to execute the job.
86-
* @param array $args Any optional arguments that should be passed when the job is executed.
87-
* @param boolean $monitor Set to true to be able to monitor the status of a job.
88-
* @param string $id Unique identifier for tracking the job. Generated if not supplied.
89-
* @param string $prefix The prefix needs to be set for the status key
83+
* @param string $queue The name of the queue to place the job in.
84+
* @param class-string<Job> $class The name of the class that contains the code to execute the job.
85+
* @param array $args Any optional arguments that should be passed when the job is executed.
86+
* @param boolean $monitor Set to true to be able to monitor the status of a job.
87+
* @param string $id Unique identifier for tracking the job. Generated if not supplied.
88+
* @param string $prefix The prefix needs to be set for the status key
9089
*
9190
* @return string
9291
*/
@@ -194,12 +193,12 @@ public function getArguments(): array
194193

195194
/**
196195
* Get the instantiated object for this job that will be performing work.
197-
* @return \Resque\Job\Job Instance of the object that this job belongs to.
198-
* @throws \Resque\Exceptions\ResqueException
196+
* @return Job Instance of the object that this job belongs to.
197+
* @throws ResqueException
199198
*/
200199
public function getInstance(): Job
201200
{
202-
if (!is_null($this->instance)) {
201+
if (!isset($this->instance)) {
203202
return $this->instance;
204203
}
205204

0 commit comments

Comments
 (0)