xref: /PHP-Parser/test/code/parser/expr/throw.test (revision 23647573)
1Throw expression
2-----
3<?php
4test(throw $x);
5$a ?? throw new Exception;
6-----
7array(
8    0: Stmt_Expression(
9        expr: Expr_FuncCall(
10            name: Name(
11                name: test
12            )
13            args: array(
14                0: Arg(
15                    name: null
16                    value: Expr_Throw(
17                        expr: Expr_Variable(
18                            name: x
19                        )
20                    )
21                    byRef: false
22                    unpack: false
23                )
24            )
25        )
26    )
27    1: Stmt_Expression(
28        expr: Expr_BinaryOp_Coalesce(
29            left: Expr_Variable(
30                name: a
31            )
32            right: Expr_Throw(
33                expr: Expr_New(
34                    class: Name(
35                        name: Exception
36                    )
37                    args: array(
38                    )
39                )
40            )
41        )
42    )
43)
44