xref: /PHP-Parser/test/code/parser/expr/exit.test (revision cde9bab3)
1Exit
2-----
3<?php
4exit;
5exit();
6exit('Die!');
7die;
8die();
9die('Exit!');
10
11exit(status: 42);
12exit(...$args);
13exit($a, $b);
14\exit($a);
15exit(...);
16DIE($a, $b);
17-----
18array(
19    0: Stmt_Expression(
20        expr: Expr_Exit(
21            expr: null
22        )
23    )
24    1: Stmt_Expression(
25        expr: Expr_Exit(
26            expr: null
27        )
28    )
29    2: Stmt_Expression(
30        expr: Expr_Exit(
31            expr: Scalar_String(
32                value: Die!
33            )
34        )
35    )
36    3: Stmt_Expression(
37        expr: Expr_Exit(
38            expr: null
39        )
40    )
41    4: Stmt_Expression(
42        expr: Expr_Exit(
43            expr: null
44        )
45    )
46    5: Stmt_Expression(
47        expr: Expr_Exit(
48            expr: Scalar_String(
49                value: Exit!
50            )
51        )
52    )
53    6: Stmt_Expression(
54        expr: Expr_FuncCall(
55            name: Name(
56                name: exit
57            )
58            args: array(
59                0: Arg(
60                    name: Identifier(
61                        name: status
62                    )
63                    value: Scalar_Int(
64                        value: 42
65                    )
66                    byRef: false
67                    unpack: false
68                )
69            )
70        )
71    )
72    7: Stmt_Expression(
73        expr: Expr_FuncCall(
74            name: Name(
75                name: exit
76            )
77            args: array(
78                0: Arg(
79                    name: null
80                    value: Expr_Variable(
81                        name: args
82                    )
83                    byRef: false
84                    unpack: true
85                )
86            )
87        )
88    )
89    8: Stmt_Expression(
90        expr: Expr_FuncCall(
91            name: Name(
92                name: exit
93            )
94            args: array(
95                0: Arg(
96                    name: null
97                    value: Expr_Variable(
98                        name: a
99                    )
100                    byRef: false
101                    unpack: false
102                )
103                1: Arg(
104                    name: null
105                    value: Expr_Variable(
106                        name: b
107                    )
108                    byRef: false
109                    unpack: false
110                )
111            )
112        )
113    )
114    9: Stmt_Expression(
115        expr: Expr_FuncCall(
116            name: Name_FullyQualified(
117                name: exit
118            )
119            args: array(
120                0: Arg(
121                    name: null
122                    value: Expr_Variable(
123                        name: a
124                    )
125                    byRef: false
126                    unpack: false
127                )
128            )
129        )
130    )
131    10: Stmt_Expression(
132        expr: Expr_FuncCall(
133            name: Name(
134                name: exit
135            )
136            args: array(
137                0: VariadicPlaceholder(
138                )
139            )
140        )
141    )
142    11: Stmt_Expression(
143        expr: Expr_FuncCall(
144            name: Name(
145                name: DIE
146            )
147            args: array(
148                0: Arg(
149                    name: null
150                    value: Expr_Variable(
151                        name: a
152                    )
153                    byRef: false
154                    unpack: false
155                )
156                1: Arg(
157                    name: null
158                    value: Expr_Variable(
159                        name: b
160                    )
161                    byRef: false
162                    unpack: false
163                )
164            )
165        )
166    )
167)
168