File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ XP Reflection ChangeLog
33
44## ?.?.? / ????-??-??
55
6+ ## 3.3.0 / ????-??-??
7+
8+ * Added support for static method calls in constant expressions in PHP 7.
9+ This allows using first-class callables as annotation arguments.
10+ (@thekid )
11+
612## 3.2.0 / 2024-08-26
713
814* Merged PR #43 : Add support for asymmetric visibility for properties, see
Original file line number Diff line number Diff line change 22
33use ReflectionClass ;
44use lang \IllegalAccessException ;
5- use lang \ast \nodes \{Literal , Variable };
5+ use lang \ast \nodes \{Literal , Variable , InvokeExpression };
66use lang \ast \{Visitor , Type };
77
88class SyntaxTree extends Visitor {
@@ -102,8 +102,14 @@ public function scope($self) {
102102 ? substr ($ c , 1 )
103103 : (new ReflectionClass ($ c ))->getConstant ($ self ->member ->expression )
104104 ;
105+ } else if ($ self ->member instanceof InvokeExpression) {
106+ $ arguments = [];
107+ foreach ($ self ->member ->arguments as $ key => $ node ) {
108+ $ arguments [$ key ]= $ node ->visit ($ this );
109+ }
110+ return (new ReflectionClass ($ c ))->getMethod ($ self ->member ->expression )->invokeArgs (null , $ arguments );
105111 } else {
106- throw new IllegalAccessException ('Cannot resolve ' .$ type -> name .':: ' .$ self ->member ->kind );
112+ throw new IllegalAccessException ('Cannot resolve ' .$ c .':: ' .$ self ->member ->kind );
107113 }
108114 }
109115
You can’t perform that action at this time.
0 commit comments