1 | <?php |
||
13 | final class Validator |
||
14 | { |
||
15 | /** |
||
16 | * @var ObjectFacade |
||
17 | */ |
||
18 | private $facade; |
||
19 | |||
20 | /** |
||
21 | * Validator constructor. |
||
22 | * |
||
23 | * @param ObjectFacade $facade |
||
24 | */ |
||
25 | public function __construct(ObjectFacade $facade) |
||
29 | 4 | ||
30 | /** |
||
31 | * @param ObjectFacade $facade |
||
32 | * |
||
33 | * @return Validator |
||
|
|||
34 | */ |
||
35 | public static function new(ObjectFacade $facade): self |
||
39 | |||
40 | /** |
||
41 | * @param ReflectionMethod $method |
||
42 | * @param $value |
||
43 | * |
||
44 | * @return bool |
||
45 | */ |
||
46 | 3 | public function isValidSetterMethod(ReflectionMethod $method, $value): bool |
|
66 | |||
67 | 1 | /** |
|
68 | * @param ReflectionParameter $parameter |
||
69 | 1 | * @param $value |
|
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | 1 | public function isValidParameterValue(ReflectionParameter $parameter, $value): bool |
|
77 | 1 | ||
78 | /** |
||
79 | * @param ReflectionMethod $method |
||
80 | * |
||
81 | 1 | * @return bool |
|
82 | 1 | */ |
|
83 | public function isValidGetterMethod(ReflectionMethod $method): bool |
||
97 | |||
98 | /** |
||
99 | * @param ReflectionMethod $method |
||
100 | * @param array ...$args |
||
101 | * |
||
102 | * @return bool |
||
103 | */ |
||
104 | 2 | public function areValidMethodArguments(ReflectionMethod $method, ...$args): bool |
|
116 | |||
117 | /** |
||
118 | * @param ReflectionMethod $method |
||
119 | * @param array ...$args |
||
120 | * |
||
121 | * @return bool |
||
122 | */ |
||
123 | private function validateMethodArguments(ReflectionMethod $method, ...$args): bool |
||
142 | } |
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.