1 | <?php |
||
5 | class ExtendedReflectionClass extends \ReflectionClass |
||
6 | { |
||
7 | /** |
||
8 | * Array of use statements for class. |
||
9 | * |
||
10 | * @var array |
||
11 | */ |
||
12 | protected $useStatements = []; |
||
13 | |||
14 | /** |
||
15 | * Check if use statements have been parsed. |
||
16 | * |
||
17 | * @var boolean |
||
18 | */ |
||
19 | protected $useStatementsParsed = false; |
||
20 | |||
21 | /** |
||
22 | * Parse class file and get use statements from current namespace. |
||
23 | * |
||
24 | * @return array |
||
25 | * @throws \RuntimeException |
||
26 | */ |
||
27 | protected function parseUseStatements() |
||
43 | |||
44 | /** |
||
45 | * Read file source up to the line where our class is defined. |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | private function readFileSource() |
||
69 | |||
70 | /** |
||
71 | * Parse the use statements from read source by |
||
72 | * tokenizing and reading the tokens. Returns |
||
73 | * an array of use statements and aliases. |
||
74 | * |
||
75 | * @param string $source |
||
76 | * |
||
77 | * @return array |
||
78 | */ |
||
79 | private function tokenizeSource($source) |
||
187 | |||
188 | /** |
||
189 | * Return array of use statements from class. |
||
190 | * |
||
191 | * @return array |
||
192 | */ |
||
193 | public function getUseStatements() |
||
197 | |||
198 | /** |
||
199 | * Check if class is using a class or an alias of a class. |
||
200 | * |
||
201 | * @param string $class |
||
202 | * |
||
203 | * @return boolean |
||
204 | */ |
||
205 | public function hasUseStatement($class) |
||
216 | } |
||
217 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: