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 ( f06180...d17a44 )
by SignpostMarv
06:19
created

TypeParanoia::IsThingStrings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject;
8
9
use InvalidArgumentException;
10
11
class TypeParanoia extends TypeCertainty
12
{
13
    const INDEX_SECOND_ARG = 2;
14
15
    const INT_ARG_OFFSET = 5;
16
17
    /**
18
    * @param string|object $object
19
    *
20
    * @psalm-param class-string|object $object
21
    */
22 20
    public static function ThrowIfNotType(
23
        $object,
24
        int $argument,
25
        string $class,
26
        string $function,
27
        string ...$types
28
    ) : void {
29 20
        foreach ($types as $i => $type) {
30 20
            if ( ! interface_exists($type) && ! class_exists($type)) {
31 2
                throw new InvalidArgumentException(
32
                    'Argument ' .
33 2
                    (self::INT_ARG_OFFSET + $i) .
34 2
                    ' passed to ' .
35 2
                    __METHOD__ .
36 2
                    ' must be a class or interface!'
37
                );
38 18
            } elseif ( ! is_a($object, $type, is_string($object))) {
39 12
                throw new DaftObjectRepositoryTypeByClassMethodAndTypeException(
40 12
                    $argument,
41 12
                    $class,
42 12
                    $function,
43 12
                    $type,
44 18
                    is_string($object) ? $object : get_class($object)
45
                );
46
            }
47
        }
48 12
    }
49
50
    /**
51
    * @param string|object $object
52
    *
53
    * @psalm-param class-string<DefinesOwnIdPropertiesInterface>|DefinesOwnIdPropertiesInterface $object
54
    */
55 10
    public static function ThrowIfNotDaftObjectIdPropertiesType(
56
        $object,
57
        int $argument,
58
        string $class,
59
        string $function,
60
        string ...$types
61
    ) : void {
62 10
        static::ThrowIfNotType(
63 10
            $object,
64 10
            $argument,
65 10
            $class,
66 10
            $function,
67 10
            DefinesOwnIdPropertiesInterface::class,
68 5
            ...$types
69
        );
70 4
    }
71
}
72