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