1--TEST--
2Nullsafe operator in PHP 8.0
3--SKIPIF--
4<?php if (PHP_VERSION_ID < 80000) die('skip PHP >= 8.0 only'); ?>
5--FILE--
6<?php
7
8require __DIR__ . '/../util.php';
9
10$code = <<<'PHP'
11<?php
12$foo?->bar(2);
13$a = $b?->c;
14$a = new $b?->c;
15PHP;
16
17$node = ast\parse_code($code, $version=70);
18echo ast_dump($node), "\n";
19--EXPECTF--
20AST_STMT_LIST
21    0: AST_NULLSAFE_METHOD_CALL
22        expr: AST_VAR
23            name: "foo"
24        method: "bar"
25        args: AST_ARG_LIST
26            0: 2
27    1: AST_ASSIGN
28        var: AST_VAR
29            name: "a"
30        expr: AST_NULLSAFE_PROP
31            expr: AST_VAR
32                name: "b"
33            prop: "c"
34    2: AST_ASSIGN
35        var: AST_VAR
36            name: "a"
37        expr: AST_NEW
38            class: AST_NULLSAFE_PROP
39                expr: AST_VAR
40                    name: "b"
41                prop: "c"
42            args: AST_ARG_LIST