mirror of
https://github.com/php/php-src.git
synced 2026-03-31 20:53:00 +02:00
RFC: https://wiki.php.net/rfc/enumerations Co-authored-by: Nikita Popov <nikita.ppv@gmail.com> Closes GH-6489.
24 lines
354 B
PHP
24 lines
354 B
PHP
--TEST--
|
|
Test ReflectionProperty::setValue() error cases.
|
|
--FILE--
|
|
<?php
|
|
|
|
enum Foo: int {
|
|
case Bar = 0;
|
|
}
|
|
|
|
$reflection = new ReflectionProperty(Foo::class, 'value');
|
|
|
|
try {
|
|
$reflection->setValue(Foo::Bar, 1);
|
|
} catch (Error $e) {
|
|
echo $e->getMessage() . "\n";
|
|
}
|
|
|
|
var_dump(Foo::Bar->value);
|
|
|
|
?>
|
|
--EXPECT--
|
|
Enum properties are immutable
|
|
int(0)
|