Catch_.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Stmt;
  3. use PhpParser\Node;
  4. use PhpParser\Node\Expr;
  5. class Catch_ extends Node\Stmt
  6. {
  7. /** @var Node\Name[] Types of exceptions to catch */
  8. public $types;
  9. /** @var Expr\Variable|null Variable for exception */
  10. public $var;
  11. /** @var Node\Stmt[] Statements */
  12. public $stmts;
  13. /**
  14. * Constructs a catch node.
  15. *
  16. * @param Node\Name[] $types Types of exceptions to catch
  17. * @param Expr\Variable|null $var Variable for exception
  18. * @param Node\Stmt[] $stmts Statements
  19. * @param array $attributes Additional attributes
  20. */
  21. public function __construct(
  22. array $types, Expr\Variable $var = null, array $stmts = [], array $attributes = []
  23. ) {
  24. $this->attributes = $attributes;
  25. $this->types = $types;
  26. $this->var = $var;
  27. $this->stmts = $stmts;
  28. }
  29. public function getSubNodeNames() : array {
  30. return ['types', 'var', 'stmts'];
  31. }
  32. public function getType() : string {
  33. return 'Stmt_Catch';
  34. }
  35. }