File tree Expand file tree Collapse file tree 4 files changed +22
-12
lines changed Expand file tree Collapse file tree 4 files changed +22
-12
lines changed Original file line number Diff line number Diff line change @@ -412,10 +412,12 @@ module.exports = {
412
412
if ( this . token === this . tok . T_DOUBLE_COLON ) {
413
413
this . next ( ) ;
414
414
415
- if ( this . is ( 'IDENTIFIER' ) || this . expect ( this . tok . T_STRING ) ) {
415
+ if ( this . token === this . tok . T_STRING || this . is ( 'IDENTIFIER' ) ) {
416
416
trait = method ;
417
417
method = this . text ( ) ;
418
418
this . next ( ) ;
419
+ } else {
420
+ this . expect ( this . tok . T_STRING ) ;
419
421
}
420
422
} else {
421
423
// convert identifier as string
@@ -440,7 +442,7 @@ module.exports = {
440
442
flags = this . read_member_flags ( ) ;
441
443
}
442
444
443
- if ( this . is ( 'IDENTIFIER' ) || this . token === this . tok . T_STRING ) {
445
+ if ( this . token === this . tok . T_STRING || this . is ( 'IDENTIFIER' ) ) {
444
446
alias = this . text ( ) ;
445
447
this . next ( ) ;
446
448
} else if ( flags === false ) {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ module.exports = {
10
10
*/
11
11
is_reference : function ( ) {
12
12
if ( this . token == '&' ) {
13
- this . next ( ) ;
13
+ this . next ( ) . ignoreComments ( ) ;
14
14
return true ;
15
15
}
16
16
return false ;
@@ -20,7 +20,7 @@ module.exports = {
20
20
*/
21
21
, is_variadic : function ( ) {
22
22
if ( this . token === this . tok . T_ELLIPSIS ) {
23
- this . next ( ) ;
23
+ this . next ( ) . ignoreComments ( ) ;
24
24
return true ;
25
25
}
26
26
return false ;
@@ -71,16 +71,23 @@ module.exports = {
71
71
var result = this . node ( nodeName ) ;
72
72
73
73
if ( this . expect ( this . tok . T_FUNCTION ) ) {
74
- this . next ( ) ;
74
+ this . next ( ) . ignoreComments ( ) ;
75
75
}
76
76
var isRef = this . is_reference ( ) ;
77
77
var name = false , use = [ ] , returnType = null , nullable = false ;
78
78
if ( type !== 1 ) {
79
- if ( ( type === 2 && this . is ( 'IDENTIFIER' ) ) || this . expect ( this . tok . T_STRING ) ) {
80
- name = this . text ( ) ;
81
- this . next ( ) ;
79
+ if ( type === 2 ) {
80
+ if ( this . token === this . tok . T_STRING || this . is ( 'IDENTIFIER' ) ) {
81
+ name = this . text ( ) ;
82
+ this . next ( ) ;
83
+ } else {
84
+ this . error ( 'IDENTIFIER' ) ;
85
+ }
82
86
} else {
83
- this . next ( ) ;
87
+ if ( this . expect ( this . tok . T_STRING ) ) {
88
+ name = this . text ( ) ;
89
+ }
90
+ this . next ( ) ;
84
91
}
85
92
}
86
93
if ( this . expect ( '(' ) ) this . next ( ) ;
Original file line number Diff line number Diff line change @@ -76,8 +76,9 @@ module.exports = {
76
76
if ( this . next ( ) . is ( [ this . tok . T_VARIABLE , '$' ] ) ) {
77
77
offset = this . read_reference_variable ( encapsed , false ) ;
78
78
} else if (
79
- this . is ( 'IDENTIFIER' ) || this . token === this . tok . T_STRING
80
- || this . token === this . tok . T_CLASS
79
+ this . token === this . tok . T_STRING
80
+ || this . token === this . tok . T_CLASS
81
+ || this . is ( 'IDENTIFIER' )
81
82
) {
82
83
offset = this . node ( 'constref' ) ;
83
84
var name = this . text ( ) ;
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ describe('Test comments', function() {
65
65
'/**' ,
66
66
' * Description' ,
67
67
' */' ,
68
- 'function /* ignore */ name(/* */ $arg) {' ,
68
+ 'function /* ignore */ & /* ignore */ name(/* */ $arg) {' ,
69
69
'// inner' ,
70
70
'return $arg /* ignore */;' ,
71
71
'}'
You can’t perform that action at this time.
0 commit comments