$stmts
$stmts : array<mixed,\PhpParser\Node>
$stmts : array<mixed,\PhpParser\Node>
$catches : array<mixed,\PhpParser\Node\Stmt\Catch_>
$finally : null|\PhpParser\Node\Stmt\Finally_
__construct(array<mixed,\PhpParser\Node> $stmts, array<mixed,\PhpParser\Node\Stmt\Catch_> $catches, null|\PhpParser\Node\Stmt\Finally_ $finally = null, array|null $attributes = array())
Constructs a try catch node.
array<mixed,\PhpParser\Node> | $stmts | Statements |
array<mixed,\PhpParser\Node\Stmt\Catch_> | $catches | Catches |
null|\PhpParser\Node\Stmt\Finally_ | $finally | Optionaly finally node |
array|null | $attributes | Additional attributes |
getDocComment() : null|\PhpParser\Comment\Doc
Gets the doc comment of the node.
The doc comment has to be the last comment associated with the node.
Doc comment object or null
None found |
setDocComment(\PhpParser\Comment\Doc $docComment)
Sets the doc comment of the node.
This will either replace an existing doc comment or add it to the comments array.
\PhpParser\Comment\Doc | $docComment | Doc comment to set |
None found |
setAttribute(string $key, mixed $value)
Sets an attribute on a node.
string | $key | |
mixed | $value |
None found |
hasAttribute(string $key) : boolean
Returns whether an attribute exists.
string | $key |
None found |
getAttribute(string $key, mixed $default = null) : mixed
Returns the value of an attribute.
string | $key | |
mixed | $default |
None found |
None found |
None found |
None found |
<?php
namespace PhpParser\Node\Stmt;
use PhpParser\Node;
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');
}
}