Precedence.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Stmt\TraitUseAdaptation;
  3. use PhpParser\Node;
  4. class Precedence extends Node\Stmt\TraitUseAdaptation
  5. {
  6. /** @var Node\Name[] Overwritten traits */
  7. public $insteadof;
  8. /**
  9. * Constructs a trait use precedence adaptation node.
  10. *
  11. * @param Node\Name $trait Trait name
  12. * @param string|Node\Identifier $method Method name
  13. * @param Node\Name[] $insteadof Overwritten traits
  14. * @param array $attributes Additional attributes
  15. */
  16. public function __construct(Node\Name $trait, $method, array $insteadof, array $attributes = []) {
  17. $this->attributes = $attributes;
  18. $this->trait = $trait;
  19. $this->method = \is_string($method) ? new Node\Identifier($method) : $method;
  20. $this->insteadof = $insteadof;
  21. }
  22. public function getSubNodeNames() : array {
  23. return ['trait', 'method', 'insteadof'];
  24. }
  25. public function getType() : string {
  26. return 'Stmt_TraitUseAdaptation_Precedence';
  27. }
  28. }