TryCatch.php 1.0 KB

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