mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-11 16:49:43 +01:00
ae3774f0f2
This adds a new finallyStmts subnode to the TryCatch node. If there is no finally clause it will be null.
32 lines
1.1 KiB
PHP
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
|
|
);
|
|
}
|
|
} |