GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 95a104...d03d4c )
by Guy
27s
created

tests/QueuedJobsTest/TestQueuedJob.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

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
The property times does not exist on object<Symbiote\QueuedJo...JobsTest\TestQueuedJob>. Since you implemented __set, maybe consider adding a @property annotation.

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.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

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.

Loading history...
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