1--TEST--
2ReflectionEnumBackedCase::getBackingValue()
3--FILE--
4<?php
5
6enum Enum_ {
7    case Foo;
8}
9
10enum IntEnum: int {
11    case Foo = 0;
12}
13
14enum StringEnum: string {
15    case Foo = 'Foo';
16}
17
18try {
19    var_dump(new ReflectionEnumBackedCase(Enum_::class, 'Foo'));
20} catch (ReflectionException $e) {
21    echo $e->getMessage() . "\n";
22}
23
24try {
25    var_dump(new ReflectionEnumBackedCase([], 'Foo'));
26} catch (Error $e) {
27    echo $e->getMessage() . "\n";
28}
29
30var_dump((new ReflectionEnumBackedCase(IntEnum::class, 'Foo'))->getBackingValue());
31var_dump((new ReflectionEnumBackedCase(StringEnum::class, 'Foo'))->getBackingValue());
32
33?>
34--EXPECT--
35Enum case Enum_::Foo is not a backed case
36ReflectionEnumBackedCase::__construct(): Argument #1 ($class) must be of type object|string, array given
37int(0)
38string(3) "Foo"
39