xref: /PHP-Parser/test/code/parser/stmt/declare.test (revision a1ccf577)
1Declare
2-----
3<?php
4
5declare (X='Y');
6
7declare (A='B', C='D') {
8    echo "foo";
9}
10
11declare (A='B', C='D'):
12enddeclare;
13-----
14array(
15    0: Stmt_Declare(
16        declares: array(
17            0: DeclareItem(
18                key: Identifier(
19                    name: X
20                )
21                value: Scalar_String(
22                    value: Y
23                )
24            )
25        )
26        stmts: null
27    )
28    1: Stmt_Declare(
29        declares: array(
30            0: DeclareItem(
31                key: Identifier(
32                    name: A
33                )
34                value: Scalar_String(
35                    value: B
36                )
37            )
38            1: DeclareItem(
39                key: Identifier(
40                    name: C
41                )
42                value: Scalar_String(
43                    value: D
44                )
45            )
46        )
47        stmts: array(
48            0: Stmt_Echo(
49                exprs: array(
50                    0: Scalar_String(
51                        value: foo
52                    )
53                )
54            )
55        )
56    )
57    2: Stmt_Declare(
58        declares: array(
59            0: DeclareItem(
60                key: Identifier(
61                    name: A
62                )
63                value: Scalar_String(
64                    value: B
65                )
66            )
67            1: DeclareItem(
68                key: Identifier(
69                    name: C
70                )
71                value: Scalar_String(
72                    value: D
73                )
74            )
75        )
76        stmts: array(
77        )
78    )
79)
80