1First-class callables 2----- 3<?php 4foo(...); 5$this->foo(...); 6A::foo(...); 7 8// These are invalid, but accepted on the parser level. 9new Foo(...); 10$this?->foo(...); 11 12#[Foo(...)] 13function foo() {} 14----- 15array( 16 0: Stmt_Expression( 17 expr: Expr_FuncCall( 18 name: Name( 19 name: foo 20 ) 21 args: array( 22 0: VariadicPlaceholder( 23 ) 24 ) 25 ) 26 ) 27 1: Stmt_Expression( 28 expr: Expr_MethodCall( 29 var: Expr_Variable( 30 name: this 31 ) 32 name: Identifier( 33 name: foo 34 ) 35 args: array( 36 0: VariadicPlaceholder( 37 ) 38 ) 39 ) 40 ) 41 2: Stmt_Expression( 42 expr: Expr_StaticCall( 43 class: Name( 44 name: A 45 ) 46 name: Identifier( 47 name: foo 48 ) 49 args: array( 50 0: VariadicPlaceholder( 51 ) 52 ) 53 ) 54 ) 55 3: Stmt_Expression( 56 expr: Expr_New( 57 class: Name( 58 name: Foo 59 ) 60 args: array( 61 0: VariadicPlaceholder( 62 ) 63 ) 64 ) 65 comments: array( 66 0: // These are invalid, but accepted on the parser level. 67 ) 68 ) 69 4: Stmt_Expression( 70 expr: Expr_NullsafeMethodCall( 71 var: Expr_Variable( 72 name: this 73 ) 74 name: Identifier( 75 name: foo 76 ) 77 args: array( 78 0: VariadicPlaceholder( 79 ) 80 ) 81 ) 82 ) 83 5: Stmt_Function( 84 attrGroups: array( 85 0: AttributeGroup( 86 attrs: array( 87 0: Attribute( 88 name: Name( 89 name: Foo 90 ) 91 args: array( 92 0: VariadicPlaceholder( 93 ) 94 ) 95 ) 96 ) 97 ) 98 ) 99 byRef: false 100 name: Identifier( 101 name: foo 102 ) 103 params: array( 104 ) 105 returnType: null 106 stmts: array( 107 ) 108 ) 109) 110