diff --git a/src/main/php/lang/ast/emit/php/XpMeta.class.php b/src/main/php/lang/ast/emit/php/XpMeta.class.php index d34de7e7..84c4a7ea 100755 --- a/src/main/php/lang/ast/emit/php/XpMeta.class.php +++ b/src/main/php/lang/ast/emit/php/XpMeta.class.php @@ -102,12 +102,4 @@ protected function emitMeta($result, $type, $annotations, $comment) { protected function emitComment($result, $comment) { // Omit from generated code } - - protected function emitAnnotation($result, $annotation) { - // Omit from generated code - } - - protected function emitAnnotations($result, $annotations) { - // Omit from generated code - } } \ No newline at end of file diff --git a/src/test/php/lang/ast/unittest/emit/AnnotationsTest.class.php b/src/test/php/lang/ast/unittest/emit/AnnotationsTest.class.php index dfea94ce..fcbf55d4 100755 --- a/src/test/php/lang/ast/unittest/emit/AnnotationsTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/AnnotationsTest.class.php @@ -1,6 +1,9 @@ []]]; + yield ['#[Test("a")]', ['Test' => ['a']]]; + yield ['#[Test(1, 2, 3)]', ['Test' => [1, 2, 3]]]; + yield ['#[Test(value: "a")]', ['Test' => ['value' => 'a']]]; + } + + #[Test, Runtime(php: '>=8.0.0-dev'), Values(from: 'declarations')] + public function also_emits_php_attributes($declaration, $expected) { + $type= $this->declare($declaration); + $declared= []; + foreach ((new ReflectionClass($type->literal()))->getAttributes() as $attribute) { + $declared[$attribute->getName()]= $attribute->getArguments(); + } + + Assert::equals($expected, $declared); + } } \ No newline at end of file diff --git a/src/test/php/lang/ast/unittest/emit/AttributesTest.class.php b/src/test/php/lang/ast/unittest/emit/AttributesTest.class.php index c395d437..894c2f85 100755 --- a/src/test/php/lang/ast/unittest/emit/AttributesTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/AttributesTest.class.php @@ -1,7 +1,5 @@