mirror of
https://github.com/php/php-src.git
synced 2026-04-26 01:18:19 +02:00
269c8dac1d
RFC: https://wiki.php.net/rfc/enumerations Co-authored-by: Nikita Popov <nikita.ppv@gmail.com> Closes GH-6489.
22 lines
277 B
PHP
22 lines
277 B
PHP
--TEST--
|
|
Backed enum with negative int
|
|
--FILE--
|
|
<?php
|
|
|
|
enum Foo: int {
|
|
case Bar = -1;
|
|
case Baz = -2;
|
|
}
|
|
|
|
var_dump(Foo::Bar->value);
|
|
var_dump(Foo::Baz->value);
|
|
var_dump(Foo::from(-1));
|
|
var_dump(Foo::from(-2));
|
|
|
|
?>
|
|
--EXPECT--
|
|
int(-1)
|
|
int(-2)
|
|
enum(Foo::Bar)
|
|
enum(Foo::Baz)
|