mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
21 lines
338 B
PHP
21 lines
338 B
PHP
--TEST--
|
|
BackedEnum::from() reject invalid string
|
|
--FILE--
|
|
<?php
|
|
|
|
enum Suit: string {
|
|
case Hearts = 'H';
|
|
case Diamonds = 'D';
|
|
case Clubs = 'C';
|
|
case Spades = 'S';
|
|
}
|
|
|
|
try {
|
|
var_dump(Suit::from('A'));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage() . "\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
"A" is not a valid backing value for enum Suit
|