summaryrefslogtreecommitdiff
path: root/Zend/tests/enum/case-attributes.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/enum/case-attributes.phpt')
-rw-r--r--Zend/tests/enum/case-attributes.phpt25
1 files changed, 25 insertions, 0 deletions
diff --git a/Zend/tests/enum/case-attributes.phpt b/Zend/tests/enum/case-attributes.phpt
new file mode 100644
index 0000000000..a5ec8600cd
--- /dev/null
+++ b/Zend/tests/enum/case-attributes.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Enum case attributes
+--FILE--
+<?php
+
+#[Attribute(Attribute::TARGET_CLASS_CONSTANT)]
+class EnumCaseAttribute {
+ public function __construct(
+ public string $value,
+ ) {}
+}
+
+enum Foo {
+ #[EnumCaseAttribute('Bar')]
+ case Bar;
+}
+
+var_dump((new \ReflectionClassConstant(Foo::class, 'Bar'))->getAttributes(EnumCaseAttribute::class)[0]->newInstance());
+
+?>
+--EXPECT--
+object(EnumCaseAttribute)#1 (1) {
+ ["value"]=>
+ string(3) "Bar"
+}