1 | <?php |
||
9 | class NumericExpectations extends ScalarExpectations |
||
10 | { |
||
11 | /** |
||
12 | * NumericExpectations constructor. |
||
13 | * |
||
14 | * @param mixed $value |
||
15 | */ |
||
16 | 14 | public function __construct($value) |
|
22 | |||
23 | /** |
||
24 | * @param mixed $value |
||
25 | * |
||
26 | * @return bool |
||
27 | */ |
||
28 | 14 | final protected function isNumeric($value): bool |
|
32 | |||
33 | /** |
||
34 | * @param float $lhs |
||
35 | * @param float $rhs |
||
36 | * |
||
37 | * @return NumericExpectations |
||
38 | */ |
||
39 | 1 | public function isBetween(float $lhs, float $rhs): self |
|
43 | |||
44 | /** |
||
45 | * @param float $value |
||
46 | * |
||
47 | * @return NumericExpectations |
||
48 | */ |
||
49 | 2 | public function isBelow(float $value): self |
|
53 | |||
54 | /** |
||
55 | * @param float $value |
||
56 | * |
||
57 | * @return NumericExpectations |
||
58 | */ |
||
59 | 1 | public function isAbove(float $value): self |
|
63 | |||
64 | /** |
||
65 | * @param float $value |
||
66 | * |
||
67 | * @return NumericExpectations |
||
68 | */ |
||
69 | 1 | public function isBelowOrEqual(float $value): self |
|
73 | |||
74 | /** |
||
75 | * @param float $value |
||
76 | * |
||
77 | * @return NumericExpectations |
||
78 | */ |
||
79 | 2 | public function isAboveOrEqual(float $value): self |
|
83 | |||
84 | /** |
||
85 | * @return NumericExpectations |
||
|
|||
86 | */ |
||
87 | 1 | public function isPositive(): self |
|
91 | |||
92 | /** |
||
93 | * @return NumericExpectations |
||
94 | */ |
||
95 | 1 | public function isNegative(): self |
|
99 | } |
||
100 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.