Alias.php 1.3 KB

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