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 ( 0e9d4f...7250ad )
by Cees-Jan
12s
created

SubscribeCommand::isIgnored()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Github\CommandBus\Command\Repository;
4
5
use WyriHaximus\Tactician\CommandHandler\Annotations\Handler;
6
7
/**
8
 * @Handler("ApiClients\Client\Github\CommandBus\Handler\Repository\SubscribeHandler")
9
 */
10
final class SubscribeCommand
11
{
12
    /**
13
     * @var string
14
     */
15
    private $repository;
16
17
    /**
18
     * @var bool
19
     */
20
    private $subscribed;
21
22
    /**
23
     * @var bool
24
     */
25
    private $ignored;
26
27
    /**
28
     * @param string $repository
29
     * @param bool   $subscribed
30
     * @param string $ignored
31
     */
32
    public function __construct(string $repository, bool $subscribed, bool $ignored)
33
    {
34
        $this->repository = $repository;
35
        $this->subscribed = $subscribed;
36
        $this->ignored = $ignored;
0 ignored issues
show
Documentation Bug introduced by
It seems like $ignored can also be of type string. However, the property $ignored is declared as type boolean. 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...
37
    }
38
39
    /**
40
     * @return string
41
     */
42 4
    public function getRepository(): string
43
    {
44 4
        return $this->repository;
45
    }
46
47
    /**
48
     * @return bool
49
     */
50 4
    public function isSubscribed(): bool
51
    {
52 4
        return $this->subscribed;
53
    }
54
55
    /**
56
     * @return bool
57
     */
58 4
    public function isIgnored(): bool
59
    {
60 4
        return $this->ignored;
61
    }
62
}
63