No Description

Alias.php 1.3KB

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