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 ( 364292...35bcd4 )
by Jhao
02:39
created

SmscRuMessage::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace NotificationChannels\SmscRu;
4
5
class SmscRuMessage
6
{
7
    /**
8
     * The phone number the message should be sent from.
9
     *
10
     * @var string
11
     */
12
    public $from = '';
13
14
    /**
15
     * The message content.
16
     *
17
     * @var string
18
     */
19
    public $content = '';
20
21
    /**
22
     * Time of sending a message.
23
     *
24
     * @var \DateTime
25
     */
26
    public $sendAt;
27
28
    /**
29
     * Create a new message instance.
30
     *
31
     * @param  string $content
32
     *
33
     * @return static
34
     */
35 3
    public static function create($content = '')
36
    {
37 3
        return new static($content);
38
    }
39
40
    /**
41
     * @param  string  $content
42
     */
43 7
    public function __construct($content = '')
44
    {
45 7
        $this->content = $content;
46 7
    }
47
48
    /**
49
     * Set the message content.
50
     *
51
     * @param  string  $content
52
     *
53
     * @return $this
54
     */
55 1
    public function content($content)
56
    {
57 1
        $this->content = $content;
58
59 1
        return $this;
60
    }
61
62
    /**
63
     * Set the phone number or sender name the message should be sent from.
64
     *
65
     * @param  string  $from
66
     *
67
     * @return $this
68
     */
69 3
    public function from($from)
70
    {
71 3
        $this->from = $from;
72
73 3
        return $this;
74
    }
75
76
    /**
77
     * Set the time the message should be sent.
78
     *
79
     * @param  \DateTimeInterface|null  $sendAt
80
     *
81
     * @return $this
82
     */
83 2
    public function sendAt(\DateTimeInterface $sendAt = null)
84
    {
85 2
        $this->sendAt = $sendAt;
0 ignored issues
show
Documentation Bug introduced by
It seems like $sendAt can also be of type object<DateTimeInterface>. However, the property $sendAt is declared as type object<DateTime>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
86
87 2
        return $this;
88
    }
89
}
90