1--TEST-- 2Backed Enum implements 3--FILE-- 4<?php 5 6interface Colorful { 7 public function color(): string; 8} 9 10enum Suit: string implements Colorful { 11 case Hearts = 'H'; 12 case Diamonds = 'D'; 13 case Clubs = 'C'; 14 case Spades = 'S'; 15 16 public function color(): string { 17 return match ($this) { 18 self::Hearts, self::Diamonds => 'Red', 19 self::Clubs, self::Spades => 'Black', 20 }; 21 } 22} 23 24echo Suit::Hearts->color() . "\n"; 25echo Suit::Diamonds->color() . "\n"; 26echo Suit::Clubs->color() . "\n"; 27echo Suit::Spades->color() . "\n"; 28 29?> 30--EXPECT-- 31Red 32Red 33Black 34Black 35