nikic/php-ast

Expose existence of trailing commas in AST_PARAM_LIST flags for php 8.0

TysonAndre opened this issue · 1 comments

Related to https://wiki.php.net/rfc/trailing_comma_in_parameter_list , would require changing php-src zend_language_parser.y
Exposing the trailing commas may be useful for:

  • assert() rendering of ASTs (not very useful, though)
  • Tooling using php-ast to warn about trailing commas being backwards incompatible when migrating to php 8.0 (e.g. phan)
  • Code formatters (not very useful - would probably use a parser that provided tokens anyway)

https://wiki.php.net/rfc/trailing-comma-function-calls may also have been useful, but it's too late for that in older php versions

nikic commented

I'm against this. It's a question of formatting, and as such should not be represented in the AST. I don't want to add this in the language parser just to make it available to php-ast.