Download src/php/php-src/Zend/tests/enum/backed-implements.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 609 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/enum/backed-implements.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/enum/backed-implements.phpt
-
curl -L -o backed-implements.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/enum/backed-implements.phpt
609 Bytes
| --TEST-- | |
| Backed Enum implements | |
| --FILE-- | |
| interface Colorful { | |
| public function color(): string; | |
| } | |
| enum Suit: string implements Colorful { | |
| case Hearts = 'H'; | |
| case Diamonds = 'D'; | |
| case Clubs = 'C'; | |
| case Spades = 'S'; | |
| public function color(): string { | |
| return match ($this) { | |
| self::Hearts, self::Diamonds => 'Red', | |
| self::Clubs, self::Spades => 'Black', | |
| }; | |
| } | |
| } | |
| echo Suit::Hearts->color() . "\n"; | |
| echo Suit::Diamonds->color() . "\n"; | |
| echo Suit::Clubs->color() . "\n"; | |
| echo Suit::Spades->color() . "\n"; | |
| --EXPECT-- | |
| Red | |
| Red | |
| Black | |
| Black | |