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.
Passed
Push — master ( 271964...601628 )
by Brent
02:01
created

GenericType::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spatie\Typed\Types;
6
7
use Spatie\Typed\Type;
8
use Spatie\Typed\WrongType;
9
10
final class GenericType implements Type
11
{
12
    use Nullable;
13
14
    /** @var string */
15
    private $type;
16
17
    public function __construct(string $type)
18
    {
19
        $this->type = $type;
20
    }
21
22
    public function validate($value)
23
    {
24
        if (
25
            ! $value instanceof $this->type
26
        ) {
27
            throw WrongType::withMessage("must be of type {$this->type}");
28
        }
29
30
        return $value;
31
    }
32
}
33