Precedence.php 1.0 KB

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