File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,18 @@ private function tconst($token) {
52
52
return null ;
53
53
}
54
54
55
+ private function tclass ($ token ) {
56
+ if (is_array ($ token )) {
57
+ $ name = substr (token_name ($ token [0 ]), 2 );
58
+ $ text = $ token [1 ];
59
+
60
+ return 'PHP_Token_ ' . $ name ;
61
+ } else {
62
+ $ text = $ token ;
63
+ return self ::$ customTokens [$ token ];
64
+ }
65
+ }
66
+
55
67
public function tokenize () {
56
68
$ sourceCode = file_get_contents ($ this ->filename );
57
69
$ tokens = token_get_all ($ sourceCode );
@@ -89,10 +101,28 @@ public function tokenize() {
89
101
$ parent = $ className ;
90
102
}
91
103
104
+ $ interfaces = false ;
105
+ if (isset ($ tokens [$ i + 4 ]) && $ this ->tid ($ tokens [$ i + 4 ]) === T_IMPLEMENTS ||
106
+ isset ($ tokens [$ i + 8 ]) && $ this ->tid ($ tokens [$ i + 8 ]) === T_IMPLEMENTS ) {
107
+ if ($ this ->tid ($ tokens [$ i + 4 ]) === T_IMPLEMENTS ) {
108
+ $ ii = $ i + 3 ;
109
+ } else {
110
+ $ ii = $ i + 7 ;
111
+ }
112
+
113
+ while (!$ this ->tclass ($ tokens [$ ii +1 ]) === 'PHP_Token_OPEN_CURLY ' ) {
114
+ $ ii ++;
115
+
116
+ if ($ this ->tconst ($ tokens [$ ii ]) === T_STRING ) {
117
+ $ interfaces [] = (string )$ tokens [$ ii ];
118
+ }
119
+ }
120
+ }
121
+
92
122
$ tmp = array (
93
123
'methods ' => array (),
94
124
'parent ' => $ parent ,
95
- 'interfaces ' => $ token -> getInterfaces () ,
125
+ 'interfaces ' => $ interfaces ,
96
126
'keywords ' => $ token ->getKeywords (),
97
127
'docblock ' => $ token ->getDocblock (),
98
128
'startLine ' => $ token ->getLine (),
You can’t perform that action at this time.
0 commit comments