2011-05-27 18:20:44 +02:00
|
|
|
<?php
|
|
|
|
|
2011-05-30 17:29:10 +02:00
|
|
|
/**
|
2012-09-07 18:06:11 +02:00
|
|
|
* @property PHPParser_Node[] $stmts Statements
|
|
|
|
* @property PHPParser_Node_Stmt_Catch[] $catches Catches
|
|
|
|
* @property PHPParser_Node[] $finallyStmts Finally statements
|
2011-05-30 17:29:10 +02:00
|
|
|
*/
|
2011-06-05 18:40:04 +02:00
|
|
|
class PHPParser_Node_Stmt_TryCatch extends PHPParser_Node_Stmt
|
2011-05-27 18:20:44 +02:00
|
|
|
{
|
2011-10-15 19:28:15 +02:00
|
|
|
/**
|
|
|
|
* Constructs a try catch node.
|
|
|
|
*
|
2012-09-07 18:06:11 +02:00
|
|
|
* @param PHPParser_Node[] $stmts Statements
|
|
|
|
* @param PHPParser_Node_Stmt_Catch[] $catches Catches
|
|
|
|
* @param PHPParser_Node[] $finallyStmts Finally statements (null means no finally clause)
|
|
|
|
* @param array|null $attributes Additional attributes
|
2011-10-15 19:28:15 +02:00
|
|
|
*/
|
2012-09-07 18:06:11 +02:00
|
|
|
public function __construct(array $stmts, array $catches, array $finallyStmts = null, array $attributes = array()) {
|
|
|
|
if (empty($catches) && null === $finallyStmts) {
|
|
|
|
throw new PHPParser_Error('Cannot use try without catch or finally');
|
|
|
|
}
|
|
|
|
|
2011-10-15 19:28:15 +02:00
|
|
|
parent::__construct(
|
|
|
|
array(
|
2012-09-07 18:06:11 +02:00
|
|
|
'stmts' => $stmts,
|
|
|
|
'catches' => $catches,
|
|
|
|
'finallyStmts' => $finallyStmts,
|
2011-10-15 19:28:15 +02:00
|
|
|
),
|
2012-04-29 23:32:09 +02:00
|
|
|
$attributes
|
2011-10-15 19:28:15 +02:00
|
|
|
);
|
|
|
|
}
|
2011-05-27 18:20:44 +02:00
|
|
|
}
|