1--TEST--
2Mismatched enum backing type
3--FILE--
4<?php
5
6enum Foo: int {
7    case Bar = 'bar';
8}
9
10try {
11    var_dump(Foo::Bar);
12} catch (Error $e) {
13    echo get_class($e), ': ', $e->getMessage(), "\n";
14}
15
16try {
17    var_dump(Foo::Bar);
18} catch (Error $e) {
19    echo get_class($e), ': ', $e->getMessage(), "\n";
20}
21
22try {
23    var_dump(Foo::from(42));
24} catch (Error $e) {
25    echo get_class($e), ': ', $e->getMessage(), "\n";
26}
27
28try {
29    var_dump(Foo::from('bar'));
30} catch (Error $e) {
31    echo get_class($e), ': ', $e->getMessage(), "\n";
32}
33
34?>
35--EXPECT--
36TypeError: Enum case type string does not match enum backing type int
37TypeError: Enum case type string does not match enum backing type int
38TypeError: Enum case type string does not match enum backing type int
39TypeError: Foo::from(): Argument #1 ($value) must be of type int, string given
40