Skip to content

Conversation

@nsfisis
Copy link
Contributor

@nsfisis nsfisis commented Oct 27, 2025

Part of #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_enum
  • in_enum_base_type: handles syntax rule of backed-enum, an enum type having base type.
  • in_enum_body: handles case keyword.

@nsfisis nsfisis mentioned this pull request Oct 27, 2025
6 tasks
@tancnle
Copy link
Collaborator

tancnle commented Dec 31, 2025

Thanks, @nsfisis. LGTM 🚀

@tancnle tancnle added this pull request to the merge queue Dec 31, 2025
Merged via the queue into rouge-ruby:master with commit 7274caf Dec 31, 2025
10 checks passed
@nsfisis nsfisis deleted the php/enum branch December 31, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants