1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
--TEST--
Enum properties cannot be unset
--FILE--
<?php
enum Foo {
case Bar;
}
enum IntFoo: int {
case Bar = 0;
}
$foo = Foo::Bar;
try {
unset($foo->name);
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
$intFoo = IntFoo::Bar;
try {
unset($intFoo->name);
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
try {
unset($intFoo->value);
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
?>
--EXPECT--
Cannot unset readonly property Foo::$name
Cannot unset readonly property IntFoo::$name
Cannot unset readonly property IntFoo::$value
|