File size: 338 Bytes
1e94262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--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