1 | <?php |
||
19 | class ClassMethod extends AbstractDefinition |
||
20 | { |
||
21 | /** |
||
22 | * Contains a number representing all modifiers (public, static, ...) |
||
23 | * |
||
24 | * @var int |
||
25 | */ |
||
26 | protected $type; |
||
27 | |||
28 | /** |
||
29 | * @var Node\Stmt\ClassMethod |
||
30 | */ |
||
31 | protected $statement; |
||
32 | |||
33 | /** |
||
34 | * @var \PHPSA\ControlFlow\ControlFlowGraph |
||
35 | */ |
||
36 | protected $cfg; |
||
37 | |||
38 | /** |
||
39 | * Return type |
||
40 | * |
||
41 | * @var int |
||
42 | */ |
||
43 | protected $returnType = CompiledExpression::UNKNOWN; |
||
44 | |||
45 | /** |
||
46 | * Array of possible return values |
||
47 | * |
||
48 | * @var array |
||
49 | */ |
||
50 | protected $possibleReturnValues = []; |
||
51 | |||
52 | /** |
||
53 | * @param string $name |
||
54 | * @param Node\Stmt\ClassMethod $statement |
||
55 | * @param integer $type |
||
56 | */ |
||
57 | 50 | public function __construct($name, Node\Stmt\ClassMethod $statement, $type) |
|
69 | |||
70 | /** |
||
71 | * @param Context $context |
||
72 | * @return boolean|null |
||
73 | */ |
||
74 | 49 | public function compile(Context $context) |
|
131 | |||
132 | /** |
||
133 | * @param Context $context |
||
134 | * @param CompiledExpression[] $args |
||
135 | * @return CompiledExpression |
||
136 | * @throws \PHPSA\Exception\RuntimeException |
||
137 | */ |
||
138 | public function run(Context $context, array $args = null) |
||
142 | |||
143 | /** |
||
144 | * @return bool |
||
145 | */ |
||
146 | 49 | public function isAbstract() |
|
150 | |||
151 | /** |
||
152 | * @return bool |
||
153 | */ |
||
154 | 49 | public function isStatic() |
|
158 | |||
159 | /** |
||
160 | * @return bool |
||
161 | */ |
||
162 | public function isPublic() |
||
166 | |||
167 | /** |
||
168 | * @return bool |
||
169 | */ |
||
170 | public function isProtected() |
||
174 | |||
175 | /** |
||
176 | * @return bool |
||
177 | */ |
||
178 | public function isPrivate() |
||
182 | |||
183 | /** |
||
184 | * @param integer $newType |
||
185 | */ |
||
186 | 35 | public function addNewType($newType) |
|
194 | |||
195 | /** |
||
196 | * @return int |
||
197 | */ |
||
198 | 1 | public function getReturnType() |
|
202 | |||
203 | /** |
||
204 | * @param $value |
||
205 | */ |
||
206 | 35 | public function addReturnPossibleValue($value) |
|
210 | |||
211 | /** |
||
212 | * @return array |
||
213 | */ |
||
214 | public function getPossibleReturnValues() |
||
218 | |||
219 | /** |
||
220 | * @return Node\Param[] |
||
221 | */ |
||
222 | 1 | public function getParams() |
|
226 | |||
227 | /** |
||
228 | * @return int |
||
229 | */ |
||
230 | public function getModifier() |
||
234 | |||
235 | /** |
||
236 | * @param int $type |
||
237 | */ |
||
238 | public function setModifier($type) |
||
242 | |||
243 | /** |
||
244 | * @return \PHPSA\ControlFlow\ControlFlowGraph |
||
245 | */ |
||
246 | public function getCFG() |
||
250 | } |
||
251 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.