1 | <?php |
||
21 | class ClosureDefinition extends ParentDefinition |
||
22 | { |
||
23 | /** |
||
24 | * @todo Use Finder |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $filepath; |
||
29 | |||
30 | /** |
||
31 | * @var Node\Expr\Closure |
||
32 | */ |
||
33 | protected $statement; |
||
34 | |||
35 | /** |
||
36 | * @var int |
||
37 | */ |
||
38 | protected $returnTypes = CompiledExpression::MIXED; |
||
39 | |||
40 | /** |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $possibleReturnTypes = []; |
||
44 | |||
45 | /** |
||
46 | * @var SymbolTable |
||
47 | */ |
||
48 | protected $symbolTable; |
||
49 | |||
50 | /** |
||
51 | * @param Node\Expr\Closure $statement |
||
52 | */ |
||
53 | 1 | public function __construct(Node\Expr\Closure $statement) |
|
58 | |||
59 | /** |
||
60 | * @param Context $context |
||
61 | */ |
||
62 | 1 | public function preCompile(Context $context) |
|
78 | |||
79 | /** |
||
80 | * Compile function to check it |
||
81 | * |
||
82 | * @param Context $context |
||
83 | * @return bool |
||
84 | */ |
||
85 | 1 | public function compile(Context $context) |
|
161 | |||
162 | /** |
||
163 | * @param CompiledExpression[] $arguments |
||
164 | * @param Context $context |
||
165 | * @return CompiledExpression |
||
166 | */ |
||
167 | public function run(array $arguments, Context $context) |
||
171 | |||
172 | 1 | /** |
|
173 | 1 | * @return string |
|
174 | */ |
||
175 | public function getFilepath() |
||
179 | |||
180 | /** |
||
181 | * @param string $filepath |
||
182 | */ |
||
183 | public function setFilepath($filepath) |
||
187 | |||
188 | /** |
||
189 | * @return string |
||
190 | */ |
||
191 | public function getNamespace() |
||
195 | |||
196 | /** |
||
197 | * @return SymbolTable |
||
198 | */ |
||
199 | public function getSymbolTable() |
||
203 | } |
||
204 |
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.