1 | <?php |
||
27 | class ClassOpener |
||
28 | { |
||
29 | private $reader; |
||
30 | private $transformer; |
||
31 | private $patcher; |
||
32 | |||
33 | /** |
||
34 | * Constructor |
||
35 | * |
||
36 | * @param Reader $reader Source code class reader, which will parse code into AST. |
||
37 | * @param Transformer $transformer Transform class AST. |
||
38 | * @param Patcher $patcher Patch class with its modified version. |
||
39 | */ |
||
40 | 4 | public function __construct(Reader $reader, Transformer $transformer, Patcher $patcher) |
|
46 | |||
47 | /** |
||
48 | * Open the final class for the further modification |
||
49 | * |
||
50 | * @param string $className Name of the class, a fully qualified class name must be provided |
||
51 | * eg.: \foo\bar\qaz |
||
52 | * |
||
53 | * @return void |
||
54 | */ |
||
55 | 4 | public function open(string $className) |
|
63 | |||
64 | /** |
||
65 | * Create a new instance of the class with the default dependencies. |
||
66 | * |
||
67 | * @return self A new instance of self |
||
|
|||
68 | */ |
||
69 | 4 | public static function create() : self |
|
83 | |||
84 | /** |
||
85 | * Get all visitors which will be applied to the class |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | 3 | private function getVisitors() : array |
|
95 | } |
||
96 |
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.