phpstan / phpdoc-parser

Next-gen phpDoc parser with support for intersection types and generics
MIT License
1.36k stars 61 forks source link

ConstExprParser: support numeric literal separator #189

Closed jiripudil closed 1 year ago

jiripudil commented 1 year ago

This PR adds support for an underscore separator in numeric literals, e.g.

/** @var int<0, 999_999_999> */

The logic should be the same as supported by PHP (https://wiki.php.net/rfc/numeric_literal_separator). To maintain BC, this is also implemented similarly to how PHP does it: the separator is supported by the lexer but then stripped

ondrejmirtes commented 1 year ago

Thank you very much! I'm gonna release this as part of phpdoc-parser 1.21 but it's not going to be right away, because I just did this massive amount of work https://github.com/phpstan/phpdoc-parser/commit/308c57c96db3237c6648ca266a72516d2be82f0a which I still need to improve a bit :)

jiripudil commented 1 year ago

Sure, no rush :)