1--TEST-- 2Backed Enum with multiple implementing interfaces 3--FILE-- 4<?php 5 6interface Colorful { 7 public function color(): string; 8} 9 10interface Shaped { 11 public function shape(): string; 12} 13 14interface ExtendedShaped extends Shaped { 15} 16 17enum Suit: string implements Colorful, ExtendedShaped { 18 case Hearts = 'H'; 19 case Diamonds = 'D'; 20 case Clubs = 'C'; 21 case Spades = 'S'; 22 23 public function color(): string { 24 return match ($this) { 25 self::Hearts, self::Diamonds => 'Red', 26 self::Clubs, self::Spades => 'Black', 27 }; 28 } 29 30 public function shape(): string { 31 return match ($this) { 32 self::Hearts => 'heart', 33 self::Diamonds => 'diamond', 34 self::Clubs => 'club', 35 self::Spades => 'spade', 36 }; 37 } 38} 39 40echo Suit::Hearts->color() . "\n"; 41echo Suit::Hearts->shape() . "\n"; 42echo Suit::Diamonds->color() . "\n"; 43echo Suit::Diamonds->shape() . "\n"; 44echo Suit::Clubs->color() . "\n"; 45echo Suit::Clubs->shape() . "\n"; 46echo Suit::Spades->color() . "\n"; 47echo Suit::Spades->shape() . "\n"; 48 49?> 50--EXPECT-- 51Red 52heart 53Red 54diamond 55Black 56club 57Black 58spade 59