1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
namespace Pitchart\Phlunit\Checks\Mixin; |
5
|
|
|
|
6
|
|
|
use Pitchart\Phlunit\Check; |
7
|
|
|
use Pitchart\Phlunit\Checks\ArrayCheck; |
8
|
|
|
use Pitchart\Phlunit\Checks\BooleanCheck; |
9
|
|
|
use Pitchart\Phlunit\Checks\CallableCheck; |
10
|
|
|
use Pitchart\Phlunit\Checks\CollectionCheck; |
11
|
|
|
use Pitchart\Phlunit\Checks\DateTimeCheck; |
12
|
|
|
use Pitchart\Phlunit\Checks\ExceptionCheck; |
13
|
|
|
use Pitchart\Phlunit\Checks\FloatCheck; |
14
|
|
|
use Pitchart\Phlunit\Checks\FluentCheck; |
15
|
|
|
use Pitchart\Phlunit\Checks\GenericCheck; |
16
|
|
|
use Pitchart\Phlunit\Checks\IntegerCheck; |
17
|
|
|
use Pitchart\Phlunit\Checks\ResponseCheck; |
18
|
|
|
use Pitchart\Phlunit\Checks\StringCheck; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class FluentChecks |
22
|
|
|
* |
23
|
|
|
* @package Pitchart\Phlunit\Checks\Mixin |
24
|
|
|
* |
25
|
|
|
* @author Julien VITTE <[email protected]> |
26
|
|
|
* |
27
|
|
|
*/ |
28
|
|
|
trait FluentChecks |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* @template T |
32
|
|
|
* @psalm-return FluentCheck<T> |
33
|
|
|
* @return BooleanCheck|GenericCheck|CallableCheck|CollectionCheck|ResponseCheck|ArrayCheck|DateTimeCheck|StringCheck|ExceptionCheck|FloatCheck|IntegerCheck |
34
|
|
|
*/ |
35
|
27 |
|
public function that(): self |
36
|
|
|
{ |
37
|
27 |
|
return $this; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @template T |
42
|
|
|
* @param mixed $sut |
43
|
|
|
* @psalm-param T of mixed |
44
|
|
|
* @psalm-return FluentCheck<T> |
45
|
|
|
* @return BooleanCheck|GenericCheck|CallableCheck|CollectionCheck|ResponseCheck|ArrayCheck|DateTimeCheck|StringCheck|ExceptionCheck|FloatCheck|IntegerCheck |
46
|
|
|
*/ |
47
|
13 |
|
public function andThat($sut): FluentCheck |
48
|
|
|
{ |
49
|
13 |
|
return Check::that($sut); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @template T |
54
|
|
|
* @psalm-return FluentCheck<T> |
55
|
|
|
* @return BooleanCheck|GenericCheck|CallableCheck|CollectionCheck|ResponseCheck|ArrayCheck|DateTimeCheck|StringCheck|ExceptionCheck|FloatCheck|IntegerCheck |
56
|
|
|
*/ |
57
|
14 |
|
public function and(): self |
58
|
|
|
{ |
59
|
14 |
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @template T |
64
|
|
|
* @psalm-return FluentCheck<T> |
65
|
|
|
* @return BooleanCheck|GenericCheck|CallableCheck|CollectionCheck|ResponseCheck|ArrayCheck|DateTimeCheck|StringCheck|ExceptionCheck|FloatCheck|IntegerCheck |
66
|
|
|
*/ |
67
|
12 |
|
public function which(): self |
68
|
|
|
{ |
69
|
12 |
|
return $this; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
} |
73
|
|
|
|