UseUse.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace PhpParser\Node\Stmt;
  3. use PhpParser\Node;
  4. class UseUse extends Node\Stmt
  5. {
  6. /** @var int One of the Stmt\Use_::TYPE_* constants. Will only differ from TYPE_UNKNOWN for mixed group uses */
  7. public $type;
  8. /** @var Node\Name Namespace, class, function or constant to alias */
  9. public $name;
  10. /** @var string Alias */
  11. public $alias;
  12. /**
  13. * Constructs an alias (use) node.
  14. *
  15. * @param Node\Name $name Namespace/Class to alias
  16. * @param null|string $alias Alias
  17. * @param int $type Type of the use element (for mixed group use declarations only)
  18. * @param array $attributes Additional attributes
  19. */
  20. public function __construct(Node\Name $name, $alias = null, $type = Use_::TYPE_UNKNOWN, array $attributes = array()) {
  21. if (null === $alias) {
  22. $alias = $name->getLast();
  23. }
  24. parent::__construct($attributes);
  25. $this->type = $type;
  26. $this->name = $name;
  27. $this->alias = $alias;
  28. }
  29. public function getSubNodeNames() {
  30. return array('type', 'name', 'alias');
  31. }
  32. }