rouge
rouge copied to clipboard
php: Support enum definition
Part of https://github.com/rouge-ruby/rouge/issues/2169
Support enum definition since PHP 8.1.
https://www.php.net/manual/en/language.enumerations.basics.php
enum Suit { case Hearts; case Diamonds; case Clubs; case Spades; }
https://www.php.net/manual/en/language.enumerations.backed.php
enum Suit: string { case Hearts = 'H'; case Diamonds = 'D'; case Clubs = 'C'; case Spades = 'S'; }
This pull requests introduced three new states:
in_enumin_enum_base_type: handles syntax rule of backed-enum, an enum type having base type.in_enum_body: handlescasekeyword.