@@ -129,6 +129,7 @@ private function getInterfaces(array $tokens, $i) {
129
129
}
130
130
131
131
public function tokenize () {
132
+ $ line = 1 ;
132
133
$ sourceCode = file_get_contents ($ this ->filename );
133
134
$ tokens = token_get_all ($ sourceCode );
134
135
$ numTokens = count ($ tokens );
@@ -159,7 +160,7 @@ public function tokenize() {
159
160
'interfaces ' => $ this ->getInterfaces ($ tokens , $ i ),
160
161
'keywords ' => $ this ->getKeywords ($ tokens , $ i ),
161
162
'docblock ' => $ token ->getDocblock (),
162
- 'startLine ' => $ token -> getLine () ,
163
+ 'startLine ' => $ line ,
163
164
'endLine ' => $ token ->getEndLine (),
164
165
'package ' => $ token ->getPackage (),
165
166
'file ' => $ this ->filename
@@ -183,7 +184,7 @@ public function tokenize() {
183
184
'keywords ' => $ this ->getKeywords ($ tokens , $ i ),
184
185
'visibility ' => $ token ->getVisibility (),
185
186
'signature ' => $ token ->getSignature (),
186
- 'startLine ' => $ token -> getLine () ,
187
+ 'startLine ' => $ line ,
187
188
'endLine ' => $ token ->getEndLine (),
188
189
'ccn ' => $ token ->getCCN (),
189
190
'file ' => $ this ->filename
@@ -204,15 +205,15 @@ public function tokenize() {
204
205
205
206
case 'PHP_Token_CLOSE_CURLY ' :
206
207
if ($ classEndLine !== false &&
207
- $ classEndLine == $ token -> getLine () ) {
208
+ $ classEndLine == $ line ) {
208
209
$ class = false ;
209
210
$ classEndLine = false ;
210
211
} elseif ($ traitEndLine !== false &&
211
- $ traitEndLine == $ token -> getLine () ) {
212
+ $ traitEndLine == $ line ) {
212
213
$ trait = false ;
213
214
$ traitEndLine = false ;
214
215
} elseif ($ interfaceEndLine !== false &&
215
- $ interfaceEndLine == $ token -> getLine () ) {
216
+ $ interfaceEndLine == $ line ) {
216
217
$ interface = false ;
217
218
$ interfaceEndLine = false ;
218
219
}
0 commit comments