diff --git a/src/main/php/lang/ast/syntax/PHP.class.php b/src/main/php/lang/ast/syntax/PHP.class.php index 5c31237..114c171 100755 --- a/src/main/php/lang/ast/syntax/PHP.class.php +++ b/src/main/php/lang/ast/syntax/PHP.class.php @@ -1477,16 +1477,25 @@ private function annotations($parse, $context) { } private function modifier($parse) { - $token= $parse->token->value; + $modifier= $parse->token->value; $parse->forward(); if ('(' === $parse->token->value) { + $token= $parse->token; $parse->expecting('(', 'modifiers'); - $token.= '('.$parse->token->value.')'; + + // Disambiguate function types from `private(set)` + if ('function' === $parse->token->value) { + array_unshift($parse->queue, $parse->token); + $parse->token= $token; + return $modifier; + } + + $modifier.= '('.$parse->token->value.')'; $parse->forward(); $parse->expecting(')', 'modifiers'); } - return $token; + return $modifier; } private function parameters($parse) {