1--TEST-- 2First-class callables in php 8.1 3--SKIPIF-- 4<?php if (PHP_VERSION_ID < 80100) die('skip PHP >= 8.1 only'); ?> 5--FILE-- 6<?php 7 8require __DIR__ . '/../util.php'; 9 10$code = <<<'PHP' 11<?php 12$c1 = foo(...); 13$c2 = C::foo(...); 14$c2 = $x->foo(...); 15PHP; 16 17$node = ast\parse_code($code, $version=80); 18echo ast_dump($node), "\n"; 19?> 20--EXPECTF-- 21AST_STMT_LIST 22 0: AST_ASSIGN 23 var: AST_VAR 24 name: "c1" 25 expr: AST_CALL 26 expr: AST_NAME 27 flags: NAME_NOT_FQ (1) 28 name: "foo" 29 args: AST_CALLABLE_CONVERT 30 1: AST_ASSIGN 31 var: AST_VAR 32 name: "c2" 33 expr: AST_STATIC_CALL 34 class: AST_NAME 35 flags: NAME_NOT_FQ (1) 36 name: "C" 37 method: "foo" 38 args: AST_CALLABLE_CONVERT 39 2: AST_ASSIGN 40 var: AST_VAR 41 name: "c2" 42 expr: AST_METHOD_CALL 43 expr: AST_VAR 44 name: "x" 45 method: "foo" 46 args: AST_CALLABLE_CONVERT