mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-12 00:59:49 +01:00
caa5c0cc76
Nearly all special errors are now handled gracefully, i.e. the parser will be able to continue after encountering them. In some cases the associated error range has been improved using the new end attribute stack. To achieve this the error handling code has been moved out of the node constructors and into special methods in the parser.
36 lines
950 B
PHP
36 lines
950 B
PHP
<?php
|
|
|
|
namespace PhpParser\Node\Stmt;
|
|
|
|
use PhpParser\Node;
|
|
use PhpParser\Error;
|
|
|
|
class TryCatch extends Node\Stmt
|
|
{
|
|
/** @var Node[] Statements */
|
|
public $stmts;
|
|
/** @var Catch_[] Catches */
|
|
public $catches;
|
|
/** @var null|Finally_ Optional finally node */
|
|
public $finally;
|
|
|
|
/**
|
|
* Constructs a try catch node.
|
|
*
|
|
* @param Node[] $stmts Statements
|
|
* @param Catch_[] $catches Catches
|
|
* @param null|Finally_ $finally Optionaly finally node
|
|
* @param array|null $attributes Additional attributes
|
|
*/
|
|
public function __construct(array $stmts, array $catches, Finally_ $finally = null, array $attributes = array()) {
|
|
parent::__construct($attributes);
|
|
$this->stmts = $stmts;
|
|
$this->catches = $catches;
|
|
$this->finally = $finally;
|
|
}
|
|
|
|
public function getSubNodeNames() {
|
|
return array('stmts', 'catches', 'finally');
|
|
}
|
|
}
|