php-parser/test/code/parser/stmt/tryCatch.test
Nikita Popov 537b59d4d1 PHP 7.1: Support multi-catch
Catch::$type is now an array Catch::$types.
2016-07-22 15:40:00 +02:00

126 lines
2.7 KiB
Plaintext

Try/catch
-----
<?php
try {
doTry();
} catch (A $b) {
doCatchA();
} catch (B $c) {
doCatchB();
} finally {
doFinally();
}
// no finally
try { }
catch (A $b) { }
// no catch
try { }
finally { }
-----
array(
0: Stmt_TryCatch(
stmts: array(
0: Expr_FuncCall(
name: Name(
parts: array(
0: doTry
)
)
args: array(
)
)
)
catches: array(
0: Stmt_Catch(
types: array(
0: Name(
parts: array(
0: A
)
)
)
var: b
stmts: array(
0: Expr_FuncCall(
name: Name(
parts: array(
0: doCatchA
)
)
args: array(
)
)
)
)
1: Stmt_Catch(
types: array(
0: Name(
parts: array(
0: B
)
)
)
var: c
stmts: array(
0: Expr_FuncCall(
name: Name(
parts: array(
0: doCatchB
)
)
args: array(
)
)
)
)
)
finallyStmts: array(
0: Expr_FuncCall(
name: Name(
parts: array(
0: doFinally
)
)
args: array(
)
)
)
)
1: Stmt_TryCatch(
stmts: array(
)
catches: array(
0: Stmt_Catch(
types: array(
0: Name(
parts: array(
0: A
)
)
)
var: b
stmts: array(
)
)
)
finallyStmts: null
comments: array(
0: // no finally
)
)
2: Stmt_TryCatch(
stmts: array(
)
catches: array(
)
finallyStmts: array(
)
comments: array(
0: // no catch
)
)
)