Passed
Push — master ( 697711...2a2aa0 )
by Julien
13:09 queued 09:15
created

TypeCheck::andThat()   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
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
3
4
namespace Pitchart\Phlunit\Checks\Mixin;
5
6
use PHPUnit\Framework\Assert;
7
use Pitchart\Phlunit\Check;
8
use Pitchart\Phlunit\Checks\ArrayCheck;
9
use Pitchart\Phlunit\Checks\BooleanCheck;
10
use Pitchart\Phlunit\Checks\CallableCheck;
11
use Pitchart\Phlunit\Checks\CollectionCheck;
12
use Pitchart\Phlunit\Checks\DateTimeCheck;
13
use Pitchart\Phlunit\Checks\ExceptionCheck;
14
use Pitchart\Phlunit\Checks\FloatCheck;
15
use Pitchart\Phlunit\Checks\FluentCheck;
16
use Pitchart\Phlunit\Checks\GenericCheck;
17
use Pitchart\Phlunit\Checks\IntegerCheck;
18
use Pitchart\Phlunit\Checks\ResponseCheck;
19
use Pitchart\Phlunit\Checks\StringCheck;
20
21
trait TypeCheck
22
{
23 1
    public function isString(): self
24
    {
25 1
        Assert::assertIsString($this->value, $this->message);
26 1
        return $this;
27
    }
28
29 1
    public function isArray(): self
30
    {
31 1
        Assert::assertIsArray($this->value, $this->message);
32 1
        return $this;
33
    }
34
35 1
    public function isBool(): self
36
    {
37 1
        Assert::assertIsBool($this->value, $this->message);
38 1
        return $this;
39
    }
40
41 1
    public function isFloat(): self
42
    {
43 1
        Assert::assertIsFloat($this->value, $this->message);
44 1
        return $this;
45
    }
46
47 1
    public function isInt(): self
48
    {
49 1
        Assert::assertIsInt($this->value, $this->message);
50 1
        return $this;
51
    }
52
53 1
    public function isNumeric(): self
54
    {
55 1
        Assert::assertIsNumeric($this->value, $this->message);
56 1
        return $this;
57
    }
58
59 1
    public function isObject(): self
60
    {
61 1
        Assert::assertIsObject($this->value, $this->message);
62 1
        return $this;
63
    }
64
65 1
    public function isResource(): self
66
    {
67 1
        Assert::assertIsResource($this->value, $this->message);
68 1
        return $this;
69
    }
70
71 1
    public function isScalar(): self
72
    {
73 1
        Assert::assertIsScalar($this->value, $this->message);
74 1
        return $this;
75
    }
76
77 1
    public function isCallable(): self
78
    {
79 1
        Assert::assertIsCallable($this->value, $this->message);
80 1
        return $this;
81
    }
82
83 1
    public function isIterable(): self
84
    {
85 1
        Assert::assertIsIterable($this->value, $this->message);
86 1
        return $this;
87
    }
88
89
    /**
90
     * @param string $expected
91
     * @psalm-param class-string $expected
92
     *
93
     * @return self
94
     */
95 122
    public function isAnInstanceOf(string $expected): self
96
    {
97 122
        Assert::assertInstanceOf($expected, $this->value, $this->message);
98 122
        return $this;
99
    }
100
}
101