1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-12 09:29:47 +01:00
PHP-Parser/test/code/parser/stmt/tryCatch.test

114 lines
2.3 KiB
Plaintext
Raw Normal View History

2011-11-27 11:20:35 +01:00
Try/catch
-----
<?php
try {
doTry();
2011-11-27 11:20:35 +01:00
} catch (A $b) {
doCatchA();
2011-11-27 11:20:35 +01:00
} catch (B $c) {
doCatchB();
} finally {
doFinally();
2011-11-27 11:20:35 +01:00
}
// no finally
try { }
catch (A $b) { }
// no catch
try { }
finally { }
2011-11-27 11:20:35 +01:00
-----
array(
0: Stmt_TryCatch(
stmts: array(
0: Expr_FuncCall(
name: Name(
parts: array(
0: doTry
)
)
args: array(
)
)
2011-11-27 11:20:35 +01:00
)
catches: array(
0: Stmt_Catch(
type: Name(
parts: array(
0: A
)
)
var: b
stmts: array(
0: Expr_FuncCall(
name: Name(
parts: array(
0: doCatchA
)
)
args: array(
)
)
2011-11-27 11:20:35 +01:00
)
)
1: Stmt_Catch(
type: 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(
2011-11-27 11:20:35 +01:00
)
)
)
)
1: Stmt_TryCatch(
stmts: array(
)
catches: array(
0: Stmt_Catch(
type: Name(
parts: array(
0: A
)
)
var: b
stmts: array(
)
)
)
finallyStmts: null
)
2: Stmt_TryCatch(
stmts: array(
)
catches: array(
)
finallyStmts: array(
)
)
2011-11-27 11:20:35 +01:00
)