10000 Add preview support for PHP Enumerations · Issue #100 · xp-framework/compiler · GitHub
[go: up one dir, main page]

Skip to content
Add preview support for PHP Enumerations #100
@thekid

Description

@thekid

See https://wiki.php.net/rfc/enumerations

enum Suit implements Colorful {
  case Hearts;
  case Diamonds;
  case Clubs;
  case Spades;
 
  // Fulfills the interface contract.
  public function color(): string {
    return match ($this) {
      Suit::Hearts, Suit::Diamonds => 'Red',
      Suit::Clubs, Suit::Spaces => 'Black',
    };
  }
}

Currently, the XP syntax is implemented via https://github.com/xp-lang/xp-enums

4B3D

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0