1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-12 09:29:47 +01:00
PHP-Parser/lib/PHPParser/Node/Stmt/TryCatch.php
nikic ae3774f0f2 Add support for finally clauses (PHP 5.5)
This adds a new finallyStmts subnode to the TryCatch node. If there is
no finally clause it will be null.
2012-09-07 23:41:56 +02:00

32 lines
1.1 KiB
PHP

<?php
/**
* @property PHPParser_Node[] $stmts Statements
* @property PHPParser_Node_Stmt_Catch[] $catches Catches
* @property PHPParser_Node[] $finallyStmts Finally statements
*/
class PHPParser_Node_Stmt_TryCatch extends PHPParser_Node_Stmt
{
/**
* Constructs a try catch node.
*
* @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
*/
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');
}
parent::__construct(
array(
'stmts' => $stmts,
'catches' => $catches,
'finallyStmts' => $finallyStmts,
),
$attributes
);
}
}