Skip to content

Commit e83972a

Browse files
committed
Verify enums and enum cases can be annotated
However, since XP core reflection does not support constant annotations, we cannot access case annotations. This will be covered by the reflection library!
1 parent 80958e6 commit e83972a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/test/php/lang/ast/unittest/emit/EnumTest.class.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ public function close() { }
193193
Assert::true($t->isSubclassOf('lang.Closeable'));
194194
}
195195

196+
#[Test]
197+
public function enum_annotations() {
198+
$t= $this->type('#[Test] enum <T> { }');
199+
Assert::equals(['test' => null], $t->getAnnotations());
200+
}
201+
202+
#[Test, Ignore('XP core reflection does not support constant annotations')]
203+
public function enum_member_annotations() {
204+
$t= $this->type('enum <T> { #[Test] case ONE; }');
205+
Assert::equals(['test' => null], $t->getConstant('ONE')->getAnnotations());
206+
}
207+
196208
#[Test]
197209
public function enum_values() {
198210
$t= $this->type('enum <T> {

0 commit comments

Comments
 (0)