菜谱项目

Use_.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace PhpParser\Node\Stmt;
  3. use PhpParser\Node\Stmt;
  4. class Use_ extends Stmt
  5. {
  6. /**
  7. * Unknown type. Both Stmt\Use_ / Stmt\GroupUse and Stmt\UseUse have a $type property, one of them will always be
  8. * TYPE_UNKNOWN while the other has one of the three other possible types. For normal use statements the type on the
  9. * Stmt\UseUse is unknown. It's only the other way around for mixed group use declarations.
  10. */
  11. const TYPE_UNKNOWN = 0;
  12. /** Class or namespace import */
  13. const TYPE_NORMAL = 1;
  14. /** Function import */
  15. const TYPE_FUNCTION = 2;
  16. /** Constant import */
  17. const TYPE_CONSTANT = 3;
  18. /** @var int Type of alias */
  19. public $type;
  20. /** @var UseUse[] Aliases */
  21. public $uses;
  22. /**
  23. * Constructs an alias (use) list node.
  24. *
  25. * @param UseUse[] $uses Aliases
  26. * @param int $type Type of alias
  27. * @param array $attributes Additional attributes
  28. */
  29. public function __construct(array $uses, $type = self::TYPE_NORMAL, array $attributes = array()) {
  30. parent::__construct($attributes);
  31. $this->type = $type;
  32. $this->uses = $uses;
  33. }
  34. public function getSubNodeNames() {
  35. return array('type', 'uses');
  36. }
  37. }