1--TEST-- 2ReflectionEnumUnitCase::__construct() 3--FILE-- 4<?php 5 6enum Foo { 7 case Bar; 8 const Baz = self::Bar; 9} 10 11$case = new ReflectionEnumUnitCase(Foo::class, 'Bar'); 12var_dump($case->getName()); 13var_dump($case->isPublic()); 14var_dump($case->getModifiers()); 15 16try { 17 new ReflectionEnumUnitCase(Foo::class, 'Baz'); 18} catch (\Exception $e) { 19 echo $e->getMessage() . "\n"; 20} 21 22try { 23 new ReflectionEnumUnitCase(Foo::class, 'Qux'); 24} catch (\Exception $e) { 25 echo $e->getMessage() . "\n"; 26} 27 28try { 29 new ReflectionEnumUnitCase([], 'Foo'); 30} catch (Error $e) { 31 echo $e->getMessage() . "\n"; 32} 33 34?> 35--EXPECT-- 36string(3) "Bar" 37bool(true) 38int(1) 39Constant Foo::Baz is not a case 40Constant Foo::Qux does not exist 41ReflectionEnumUnitCase::__construct(): Argument #1 ($class) must be of type object|string, array given 42