class Use_
Same name in this branch
- 11.1.x vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php \PhpParser\Node\Stmt\Use_
Hierarchy
- class \PhpParser\Builder\Use_ implements \PhpParser\Builder
Expanded class hierarchy of Use_
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ Builder/ Use_.php, line 10
Namespace
PhpParser\BuilderView source
class Use_ implements Builder {
protected Node\Name $name;
/** @var Stmt\Use_::TYPE_* */
protected int $type;
protected ?string $alias = null;
/**
* Creates a name use (alias) builder.
*
* @param Node\Name|string $name Name of the entity (namespace, class, function, constant) to alias
* @param Stmt\Use_::TYPE_* $type One of the Stmt\Use_::TYPE_* constants
*/
public function __construct($name, int $type) {
$this->name = BuilderHelpers::normalizeName($name);
$this->type = $type;
}
/**
* Sets alias for used name.
*
* @param string $alias Alias to use (last component of full name by default)
*
* @return $this The builder instance (for fluid interface)
*/
public function as(string $alias) {
$this->alias = $alias;
return $this;
}
/**
* Returns the built node.
*
* @return Stmt\Use_ The built node
*/
public function getNode() : Node {
return new Stmt\Use_([
new Node\UseItem($this->name, $this->alias),
], $this->type);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
Use_::$alias | protected | property | ||
Use_::$name | protected | property | ||
Use_::$type | protected | property | @var Stmt\Use_::TYPE_* | |
Use_::as | public | function | Sets alias for used name. | |
Use_::getNode | public | function | Returns the built node. | Overrides Builder::getNode |
Use_::__construct | public | function | Creates a name use (alias) builder. |