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