1--TEST--
2Enum properties cannot be written to
3--FILE--
4<?php
5
6enum Foo {
7    case Bar;
8}
9
10enum IntFoo: int {
11    case Bar = 0;
12}
13
14$bar = Foo::Bar;
15try {
16    $bar->name = 'Baz';
17} catch (Error $e) {
18    echo $e->getMessage() . "\n";
19}
20try {
21    $bar->value = 1;
22} catch (Error $e) {
23    echo $e->getMessage() . "\n";
24}
25
26$intBar = IntFoo::Bar;
27try {
28    $intBar->name = 'Baz';
29} catch (Error $e) {
30    echo $e->getMessage() . "\n";
31}
32try {
33    $intBar->value = 1;
34} catch (Error $e) {
35    echo $e->getMessage() . "\n";
36}
37try {
38    $intBar->value2 = 1;
39} catch (Error $e) {
40    echo $e->getMessage() . "\n";
41}
42
43?>
44--EXPECT--
45Cannot modify readonly property Foo::$name
46Cannot create dynamic property Foo::$value
47Cannot modify readonly property IntFoo::$name
48Cannot modify readonly property IntFoo::$value
49Cannot create dynamic property IntFoo::$value2
50