\PhpParser\BuilderUse_

Summary

Methods
Properties
Constants
__construct()
__call()
getNode()
()
No public properties found
No constants found
normalizeNode()
normalizeName()
normalizeType()
normalizeValue()
normalizeDocComment()
setModifier()
as_()
$name
$type
$alias
N/A
No private methods found
No private properties found
N/A

Properties

$name

$name : 

Type

$type

$type : 

Type

$alias

$alias : 

Type

Methods

__construct()

__construct(\PhpParser\Node\Name|string  $name, integer  $type) 

Creates a name use (alias) builder.

Parameters

\PhpParser\Node\Name|string $name

Name of the entity (namespace, class, function, constant) to alias

integer $type

One of the Stmt\Use::TYPE* constants

__call()

__call(  $name,   $args) 

Parameters

$name
$args

getNode()

getNode() : \PhpParser\Node

Returns the built node.

Returns

\PhpParser\Node

The built node

()

() : 

$this as(string $alias) Sets alias for used name.

Returns

normalizeNode()

normalizeNode(\PhpParser\Node|\PhpParser\Builder  $node) : \PhpParser\Node

Normalizes a node: Converts builder objects to nodes.

Parameters

\PhpParser\Node|\PhpParser\Builder $node

The node to normalize

Returns

\PhpParser\Node

The normalized node

normalizeName()

normalizeName(\PhpParser\Node\Name|string  $name) : \PhpParser\Node\Name

Normalizes a name: Converts plain string names to PhpParser\Node\Name.

Parameters

\PhpParser\Node\Name|string $name

The name to normalize

Returns

\PhpParser\Node\Name

The normalized name

normalizeType()

normalizeType(\PhpParser\Node\Name|string|\PhpParser\Node\NullableType  $type) : \PhpParser\Node\Name|string|\PhpParser\Node\NullableType

Normalizes a type: Converts plain-text type names into proper AST representation.

In particular, builtin types are left as strings, custom types become Names and nullables are wrapped in NullableType nodes.

Parameters

\PhpParser\Node\Name|string|\PhpParser\Node\NullableType $type

The type to normalize

Returns

\PhpParser\Node\Name|string|\PhpParser\Node\NullableType

The normalized type

normalizeValue()

normalizeValue(mixed  $value) : \PhpParser\Node\Expr

Normalizes a value: Converts nulls, booleans, integers, floats, strings and arrays into their respective nodes

Parameters

mixed $value

The value to normalize

Returns

\PhpParser\Node\Expr

The normalized value

normalizeDocComment()

normalizeDocComment(\PhpParser\Comment\Doc|string  $docComment) : \PhpParser\Comment\Doc

Normalizes a doc comment: Converts plain strings to PhpParser\Comment\Doc.

Parameters

\PhpParser\Comment\Doc|string $docComment

The doc comment to normalize

Returns

\PhpParser\Comment\Doc

The normalized doc comment

setModifier()

setModifier(integer  $modifier) 

Sets a modifier in the $this->type property.

Parameters

integer $modifier

Modifier to set

as_()

as_(string  $alias) : $this

Sets alias for used name.

Parameters

string $alias

Alias to use (last component of full name by default)

Returns

$this —

The builder instance (for fluid interface)