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 ( b0f2f1...6d15b0 )
by Ruben
01:17
created

Alert::payload()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Spatie\IcalendarGenerator\Components;
4
5
use DateInterval;
6
use DateTimeInterface;
7
use Spatie\IcalendarGenerator\ComponentPayload;
8
use Spatie\IcalendarGenerator\PropertyTypes\DateTimePropertyType;
9
use Spatie\IcalendarGenerator\PropertyTypes\Parameter;
10
11
final class Alert extends Component
12
{
13
    /** @var \DateTimeInterface */
14
    private $triggerAt;
15
16
    /** @var null|string */
17
    private $message;
18
19
    public static function create(DateTimeInterface $triggerAt, string $description = null): Alert
20
    {
21
        return new self($triggerAt, $description);
22
    }
23
24
    public function __construct(DateTimeInterface $triggerAt, string $description = null)
25
    {
26
        $this->triggerAt = $triggerAt;
27
        $this->message = $description;
28
    }
29
30
    public function getComponentType(): string
31
    {
32
        return 'ALARM';
33
    }
34
35
    public function getRequiredProperties(): array
36
    {
37
        return [
38
            'ACTION',
39
            'TRIGGER',
40
            'DESCRIPTION',
41
        ];
42
    }
43
44
    public function message(string $message): Alert
45
    {
46
        $this->message = $message;
47
48
        return $this;
49
    }
50
51
    public function trigger(DateInterval $triggerAt): Alert
52
    {
53
        $this->triggerAt = $triggerAt;
0 ignored issues
show
Documentation Bug introduced by
It seems like $triggerAt of type object<DateInterval> is incompatible with the declared type object<DateTimeInterface> of property $triggerAt.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
54
55
        return $this;
56
    }
57
58
    protected function payload(): ComponentPayload
59
    {
60
        return ComponentPayload::create($this->getComponentType())
61
            ->textProperty('ACTION', 'DISPLAY')
62
            ->textProperty('DESCRIPTION', $this->message)
63
            ->property(
64
                new DateTimePropertyType('TRIGGER', $this->triggerAt),
65
                [new Parameter('VALUE', 'DATE-TIME')]
66
            );
67
    }
68
}
69