1<?php declare(strict_types=1);
2
3namespace PhpParser\Node\Stmt;
4
5use PhpParser\Node;
6
7class TryCatch extends Node\Stmt {
8    /** @var Node\Stmt[] Statements */
9    public array $stmts;
10    /** @var Catch_[] Catches */
11    public array $catches;
12    /** @var null|Finally_ Optional finally node */
13    public ?Finally_ $finally;
14
15    /**
16     * Constructs a try catch node.
17     *
18     * @param Node\Stmt[] $stmts Statements
19     * @param Catch_[] $catches Catches
20     * @param null|Finally_ $finally Optional finally node
21     * @param array<string, mixed> $attributes Additional attributes
22     */
23    public function __construct(array $stmts, array $catches, ?Finally_ $finally = null, array $attributes = []) {
24        $this->attributes = $attributes;
25        $this->stmts = $stmts;
26        $this->catches = $catches;
27        $this->finally = $finally;
28    }
29
30    public function getSubNodeNames(): array {
31        return ['stmts', 'catches', 'finally'];
32    }
33
34    public function getType(): string {
35        return 'Stmt_TryCatch';
36    }
37}
38