1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
--TEST-- Enum reflection getConstants() --FILE-- <?php enum Foo { case Bar; case Baz; } var_dump((new \ReflectionClass(Foo::class))->getConstants()); ?> --EXPECT-- array(2) { ["Bar"]=> enum(Foo::Bar) ["Baz"]=> enum(Foo::Baz) }