These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Symbiote\QueuedJobs\Tests\QueuedJobsTest; |
||
4 | |||
5 | use Symbiote\QueuedJobs\Services\AbstractQueuedJob; |
||
6 | use Symbiote\QueuedJobs\Services\QueuedJob; |
||
7 | |||
8 | class TestQueuedJob extends AbstractQueuedJob implements QueuedJob |
||
9 | { |
||
10 | private $type = QueuedJob::QUEUED; |
||
11 | |||
12 | public function __construct($type = null) |
||
13 | { |
||
14 | if ($type) { |
||
15 | $this->type = $type; |
||
16 | } |
||
17 | $this->times = array(); |
||
18 | } |
||
19 | |||
20 | public function getJobType() |
||
21 | { |
||
22 | return $this->type; |
||
23 | } |
||
24 | |||
25 | public function getTitle() |
||
26 | { |
||
27 | return "A Test job"; |
||
28 | } |
||
29 | |||
30 | public function setup() |
||
31 | { |
||
32 | $this->totalSteps = 5; |
||
33 | } |
||
34 | |||
35 | View Code Duplication | public function process() |
|
36 | { |
||
37 | $times = $this->times; |
||
38 | // needed due to quirks with __set |
||
39 | $times[] = date('Y-m-d H:i:s'); |
||
40 | $this->times = $times; |
||
0 ignored issues
–
show
|
|||
41 | |||
42 | $this->addMessage("Updated time to " . date('Y-m-d H:i:s')); |
||
43 | sleep(1); |
||
44 | |||
45 | // make sure we're incrementing |
||
46 | $this->currentStep++; |
||
47 | |||
48 | // and checking whether we're complete |
||
49 | if ($this->currentStep == 5) { |
||
50 | $this->isComplete = true; |
||
51 | } |
||
52 | } |
||
53 | } |
||
54 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.