1 | <?php |
||
25 | class Exporter |
||
26 | { |
||
27 | /** |
||
28 | * Get PHP code string from a closure of function as string |
||
29 | * |
||
30 | * @param array<string,array|string|integer> $context current compile context |
||
31 | * @param object $closure Closure object |
||
32 | * |
||
33 | * @return string |
||
34 | * |
||
35 | * @expect 'function($a) {return;}' when input array('flags' => array('standalone' => 0)), function ($a) {return;} |
||
36 | * @expect 'function($a) {return;}' when input array('flags' => array('standalone' => 0)), function ($a) {return;} |
||
37 | */ |
||
38 | 79 | protected static function closure($context, $closure) { |
|
48 | |||
49 | /** |
||
50 | * Export required custom helper functions |
||
51 | * |
||
52 | * @param array<string,array|string|integer> $context current compile context |
||
53 | * |
||
54 | * @return string |
||
55 | */ |
||
56 | 714 | public static function helpers($context) { |
|
71 | |||
72 | /** |
||
73 | * Replace SafeString class with alias class name |
||
74 | * |
||
75 | * @param array<string,array|string|integer> $context current compile context |
||
76 | * @param string $str the PHP code to be replaced |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | 579 | protected static function replaceSafeString($context, $str) { |
|
83 | |||
84 | /** |
||
85 | * Get methods from ReflectionClass |
||
86 | * |
||
87 | * @param array<string,array|string|integer> $context current compile context |
||
88 | * @param \ReflectionClass $class instance of the ReflectionClass |
||
89 | * |
||
90 | * @return array |
||
91 | */ |
||
92 | 513 | public static function getClassMethods($context, $class) { |
|
102 | |||
103 | /** |
||
104 | * Get statics code from ReflectionClass |
||
105 | * |
||
106 | * @param \ReflectionClass $class instance of the ReflectionClass |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | 336 | public static function getClassStatics($class) { |
|
119 | |||
120 | |||
121 | |||
122 | |||
123 | |||
124 | /** |
||
125 | * Get metadata from ReflectionObject |
||
126 | * |
||
127 | * @param object $refobj instance of the ReflectionObject |
||
128 | * |
||
129 | * @return array |
||
130 | */ |
||
131 | 579 | public static function getMeta($refobj) { |
|
145 | |||
146 | /** |
||
147 | * Export SafeString class as string |
||
148 | * |
||
149 | * @param array<string,array|string|integer> $context current compile context |
||
150 | * |
||
151 | * @return string |
||
152 | */ |
||
153 | 336 | public static function safestring($context) { |
|
160 | |||
161 | /** |
||
162 | * Export StringObject class as string |
||
163 | * |
||
164 | * @param array<string,array|string|integer> $context current compile context |
||
165 | * |
||
166 | * @return string |
||
167 | */ |
||
168 | 380 | public static function stringobject($context) { |
|
177 | |||
178 | /** |
||
179 | * Export required standalone Runtime methods |
||
180 | * |
||
181 | * @param array<string,array|string|integer> $context current compile context |
||
182 | * |
||
183 | * @return string |
||
184 | */ |
||
185 | 513 | public static function runtime($context) { |
|
213 | |||
214 | /** |
||
215 | * Export Runtime constants |
||
216 | * |
||
217 | * @param array<string,array|string|integer> $context current compile context |
||
218 | * |
||
219 | * @return string |
||
220 | */ |
||
221 | 714 | public static function constants($context) { |
|
235 | |||
236 | /** |
||
237 | * Scan for required standalone functions |
||
238 | * |
||
239 | * @param array<string,array|string|integer> $context current compile context |
||
240 | * @param string $code patched PHP code string of the method |
||
241 | * @param string $ocode original PHP code string of the method |
||
242 | * |
||
243 | * @return array<string|array> list of converted code and children array |
||
244 | */ |
||
245 | 513 | protected static function scanDependency($context, $code, $ocode) { |
|
265 | } |
||
266 | |||
267 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.