diff --git a/src/main/php/lang/ast/syntax/PHP.class.php b/src/main/php/lang/ast/syntax/PHP.class.php index 114c171..62e8d5f 100755 --- a/src/main/php/lang/ast/syntax/PHP.class.php +++ b/src/main/php/lang/ast/syntax/PHP.class.php @@ -1477,6 +1477,8 @@ private function annotations($parse, $context) { } private function modifier($parse) { + static $hooks= ['set' => true]; + $modifier= $parse->token->value; $parse->forward(); @@ -1484,16 +1486,14 @@ private function modifier($parse) { $token= $parse->token; $parse->expecting('(', 'modifiers'); - // Disambiguate function types from `private(set)` - if ('function' === $parse->token->value) { + if (isset($hooks[$parse->token->value])) { + $modifier.= '('.$parse->token->value.')'; + $parse->forward(); + $parse->expecting(')', 'modifiers'); + } else { array_unshift($parse->queue, $parse->token); $parse->token= $token; - return $modifier; } - - $modifier.= '('.$parse->token->value.')'; - $parse->forward(); - $parse->expecting(')', 'modifiers'); } return $modifier; }