Skip to content

Conversation

thekid
Copy link
Member

@thekid thekid commented Jan 29, 2023

This PR always uses the native syntax instead of using the information available in xp::$meta in PHP 8.

Runtime version Source
PHP 7.* Meta information if available, syntax tree otherwise
PHP 8.* (before) Meta information if available, PHP 8 attributes reflection otherwise
PHP 8.* (after this PR is merged) PHP 8 attributes reflection only 🆕

Changes to the compiler

Here's what we could do in XP Compiler:

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 0da5bcc..444e052 100755
--- a/src/main/php/lang/ast/emit/php/XpMeta.class.php
+++ b/src/main/php/lang/ast/emit/php/XpMeta.class.php
@@ -96,12 +96,4 @@ trait XpMeta {
   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
-  }
 }

However, this would require changes to XP Core to parse annotations from the source code even if meta information is available - thus we'll have to wait for xp-framework/rfc#338

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant