php-parser/lib/PHPParser/Node/Stmt/TryCatch.php

32 lines
1.1 KiB
PHP
Raw Normal View History

<?php
2011-05-30 17:29:10 +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-10-15 19:28:15 +02:00
/**
* 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
2011-10-15 19:28:15 +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(
'stmts' => $stmts,
'catches' => $catches,
'finallyStmts' => $finallyStmts,
2011-10-15 19:28:15 +02:00
),
$attributes
2011-10-15 19:28:15 +02:00
);
}
}