1 | <?php |
||
11 | final class Method |
||
12 | { |
||
13 | const PREFIXES = ['set', 'append']; |
||
14 | |||
15 | /** |
||
16 | * @var object |
||
17 | */ |
||
18 | private $object; |
||
19 | /** |
||
20 | * @var null|string |
||
21 | */ |
||
22 | private $method; |
||
23 | |||
24 | /** |
||
25 | * Method constructor. |
||
26 | * |
||
27 | * @param string $postifx |
||
28 | * @param object $object |
||
29 | */ |
||
30 | public function __construct(string $postifx, $object) |
||
35 | |||
36 | /** |
||
37 | * @param string $postfix |
||
38 | * @param object $object |
||
39 | * |
||
40 | * @return Method |
||
|
|||
41 | */ |
||
42 | public static function of(string $postfix, $object): self |
||
46 | |||
47 | /** |
||
48 | * @return bool |
||
49 | */ |
||
50 | public function isValid(): bool |
||
54 | |||
55 | /** |
||
56 | * @param $value |
||
57 | * |
||
58 | * @return bool |
||
59 | */ |
||
60 | public function assign($value): bool |
||
70 | |||
71 | /** |
||
72 | * @param string $postfix |
||
73 | * |
||
74 | * @return null|string |
||
75 | */ |
||
76 | private function getMethod(string $postfix) |
||
87 | } |
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.