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
Pull Request — master (#240)
by
unknown
01:30
created

QueuedJobHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Symbiote\QueuedJobs\Services;
4
5
use Monolog\Handler\AbstractProcessingHandler;
6
use SilverStripe\Core\Injector\Injectable;
7
use Symbiote\QueuedJobs\DataObjects\QueuedJobDescriptor;
8
9
/**
10
 * Writes log output to a job descriptor
11
 */
12
class QueuedJobHandler extends AbstractProcessingHandler
13
{
14
    use Injectable;
15
16
    /** @var QueuedJob */
17
    protected $job;
18
19
    /** @var QueuedJobDescriptor */
20
    protected $jobDescriptor;
21
22
    public function __construct(QueuedJob $job, QueuedJobDescriptor $jobDescriptor)
23
    {
24
        parent::__construct($job, $jobDescriptor);
0 ignored issues
show
Documentation introduced by
$job is of type object<Symbiote\QueuedJobs\Services\QueuedJob>, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
$jobDescriptor is of type object<Symbiote\QueuedJo...ts\QueuedJobDescriptor>, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
25
26
        $this->job = $job;
27
        $this->jobDescriptor = $jobDescriptor;
28
    }
29
30
    /**
31
     * @return QueuedJob
32
     */
33
    public function getJob()
34
    {
35
        return $this->job;
36
    }
37
38
    /**
39
     * @return QueuedJobDescriptor
40
     */
41
    public function getJobDescriptor()
42
    {
43
        return $this->jobDescriptor;
44
    }
45
46
    /**
47
     * Writes the record down to the log of the implementing handler
48
     *
49
     * @param  array $record
50
     * @return void
51
     * @throws \SilverStripe\ORM\ValidationException
52
     */
53
    protected function write(array $record)
54
    {
55
        $this->job->addMessage($record['message']);
56
        $this->jobDescriptor->SavedJobMessages = serialize($this->job->getJobData()->messages);
57
        $this->jobDescriptor->write();
58
    }
59
}
60