File: php74_dim_alternative_syntax.phpt

package info (click to toggle)
php-ast 1.1.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 632 kB
  • sloc: ansic: 2,173; xml: 621; php: 319; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 649 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--TEST--
'$x{"offset"}' flag in PHP 7.4
--SKIPIF--
<?php if (PHP_VERSION_ID < 70400 || PHP_VERSION_ID >= 80400) die('skip PHP 7.4-8.3 only'); ?>
--FILE--
<?php

require __DIR__ . '/../util.php';

$code = <<<'PHP'
<?php
var_export($x{'offset'});
PHP;

$node = ast\parse_code($code, $version=70);
echo ast_dump($node), "\n";
?>
--EXPECTF--
AST_STMT_LIST
    0: AST_CALL
        expr: AST_NAME
            flags: NAME_NOT_FQ (%d)
            name: "var_export"
        args: AST_ARG_LIST
            0: AST_DIM
                flags: DIM_ALTERNATIVE_SYNTAX (%d)
                expr: AST_VAR
                    name: "x"
                dim: "offset"