1--TEST-- 2Enum attributes 3--FILE-- 4<?php 5 6#[Attribute] 7class EnumAttribute { 8 public function __construct( 9 public string $value, 10 ) {} 11} 12 13#[EnumAttribute('Foo')] 14enum Foo {} 15 16var_dump((new \ReflectionClass(Foo::class))->getAttributes(EnumAttribute::class)[0]->newInstance()); 17 18?> 19--EXPECT-- 20object(EnumAttribute)#1 (1) { 21 ["value"]=> 22 string(3) "Foo" 23} 24