summaryrefslogtreecommitdiff
path: root/Zend/tests/enum/no-unset-propertes.phpt
blob: 338b22a02606b6924c2d7a1374f0e5610b5b25dc (plain)
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--
Enum properties are immutable
Enum properties are immutable
Enum properties are immutable