@@ -26,13 +26,13 @@ |
||
26 | 26 | public function dump(TokenCollection $tokens, $start = 0, $len = 0) |
27 | 27 | { |
28 | 28 | $str = ''; |
29 | - if($len == 0) { |
|
29 | + if ($len == 0) { |
|
30 | 30 | $len = sizeof($tokens); |
31 | 31 | } |
32 | - if($start < 0) { |
|
32 | + if ($start < 0) { |
|
33 | 33 | $start = 0; |
34 | 34 | } |
35 | - for($i = $start; $i < $len; $i++) { |
|
35 | + for ($i = $start; $i < $len; $i++) { |
|
36 | 36 | $str .= sprintf("\n%s : %s", token_name($tokens[$i]->getType()), $tokens[$i]->getValue()); |
37 | 37 | } |
38 | 38 | return $str; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $this->tokenizer = $tokenizer; |
50 | 50 | $this->searcher = new Searcher(); |
51 | - $this->result= new Result; |
|
51 | + $this->result = new Result; |
|
52 | 52 | |
53 | 53 | $this->extractors = (object) array( |
54 | 54 | 'class' => new ClassExtractor($this->searcher) |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | $endAnonymous = 0; |
81 | 81 | $mainContextClass = null; // class containing a anonymous class |
82 | 82 | |
83 | - for($n = 0; $n < $len; $n++) { |
|
83 | + for ($n = 0; $n < $len; $n++) { |
|
84 | 84 | |
85 | - if($mainContextClass && $n > $endAnonymous) { |
|
85 | + if ($mainContextClass && $n > $endAnonymous) { |
|
86 | 86 | // anonymous class is finished. We back to parent class |
87 | 87 | // methods will be added to the main class now |
88 | 88 | $class = $mainContextClass; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $token = $tokens[$n]; |
93 | 93 | |
94 | - switch($token->getType()) { |
|
94 | + switch ($token->getType()) { |
|
95 | 95 | |
96 | 96 | case T_USE: |
97 | 97 | $alias = $this->extractors->alias->extract($n, $tokens); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | case T_CLASS: |
132 | 132 | $i = $n; |
133 | 133 | // avoid MyClass::class syntax |
134 | - if($this->searcher->isPrecededBy(T_DOUBLE_COLON, $i, $tokens, 1)) { |
|
134 | + if ($this->searcher->isPrecededBy(T_DOUBLE_COLON, $i, $tokens, 1)) { |
|
135 | 135 | continue; |
136 | 136 | } |
137 | 137 | |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | $result->pushClass($c); |
143 | 143 | |
144 | 144 | // PHP 7 and inner classes |
145 | - if($c instanceof ReflectedAnonymousClass) { |
|
145 | + if ($c instanceof ReflectedAnonymousClass) { |
|
146 | 146 | // avoid to consider anonymous class as main class |
147 | 147 | $p = $n; |
148 | 148 | $endAnonymous = $this->searcher->getPositionOfClosingBrace($p, $tokens); |
149 | 149 | $mainContextClass = $class; |
150 | 150 | |
151 | 151 | // add anonymous class in method |
152 | - if($method) { |
|
152 | + if ($method) { |
|
153 | 153 | $method->pushAnonymousClass($c); |
154 | 154 | } |
155 | 155 | } |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | break; |
158 | 158 | |
159 | 159 | case T_FUNCTION: |
160 | - if($class) { |
|
160 | + if ($class) { |
|
161 | 161 | // avoid closure |
162 | 162 | $next = $tokens[$n + 1]; |
163 | - if(T_WHITESPACE != $next->getType()) { |
|
163 | + if (T_WHITESPACE != $next->getType()) { |
|
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | $method = $this->extractors->method->extract($n, $tokens, $class); |