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 — develop ( 870d79...a1e45f )
by Baptiste
05:29
created

ClassType::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Immutable\ValidateArgument;
5
6
use Innmind\Immutable\{
7
    ValidateArgument,
8
    Type,
9
};
10
11
final class ClassType implements ValidateArgument
12
{
13
    private $class;
14
15 90
    public function __construct(string $class)
16
    {
17 90
        $this->class = $class;
18 90
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23 75
    public function __invoke($value, int $position): void
24
    {
25 75
        if (!$value instanceof $this->class) {
26 4
            $given = Type::determine($value);
27
28 4
            throw new \TypeError("Argument $position must be of type {$this->class}, $given given");
29
        }
30 73
    }
31
}
32