1 | <?php declare(strict_types = 1); |
||
13 | abstract class AbstractGenerator |
||
14 | { |
||
15 | /** @var GenericGenerator Parent class generator */ |
||
16 | protected $parent; |
||
17 | |||
18 | /** @var array Collection of code lines */ |
||
19 | protected $code = []; |
||
20 | |||
21 | /** |
||
22 | * MethodGenerator constructor. |
||
23 | * |
||
24 | * @param GenericGenerator $parent Parent generator |
||
25 | */ |
||
26 | public function __construct(GenericGenerator $parent = null) |
||
30 | |||
31 | /** |
||
32 | * Close current generator and return parent. |
||
33 | * |
||
34 | * @return AbstractGenerator Parent |
||
35 | */ |
||
36 | public function end() : AbstractGenerator |
||
40 | |||
41 | /** |
||
42 | * Get indentation string. |
||
43 | * |
||
44 | * @param int $indentation Code level |
||
45 | * |
||
46 | * @return string Indentation string |
||
47 | */ |
||
48 | protected function indentation($indentation = 0) : string |
||
52 | |||
53 | /** |
||
54 | * Add function code line. |
||
55 | * |
||
56 | * @param string $code Code line |
||
57 | * |
||
58 | * @return AbstractGenerator |
||
59 | */ |
||
60 | public function defLine(string $code) : AbstractGenerator |
||
66 | |||
67 | /** |
||
68 | * Set Comments block. |
||
69 | * |
||
70 | * @return CommentsGenerator Comments block generator |
||
71 | */ |
||
72 | public function defComment() : CommentsGenerator |
||
76 | |||
77 | /** |
||
78 | * Generate code. |
||
79 | * |
||
80 | * @param int $indentation Code level |
||
81 | * |
||
82 | * @return string Generated code |
||
83 | */ |
||
84 | abstract public function code($indentation = 0) : string; |
||
85 | } |
||
86 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: