Copied!

This class defines helpers used in the implementation of builders. Don't use it directly.

  • internal
Cloneable Final Instantiable
Methods
public static addModifier ( int $modifiers , int $modifier ) : int
 

Adds a modifier and returns new modifier bitmask.

  • return int New modifiers
public static normalizeDocComment ( $docComment ) : PhpParser\Comment\Doc
 

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

public static normalizeIdentifier ( $name ) : PhpParser\Node\Identifier
 

Normalizes strings to Identifier.

  • return Identifier The normalized identifier
public static normalizeIdentifierOrExpr ( $name )
 

Normalizes strings to Identifier, also allowing expressions.

  • return Identifier | Expr The normalized identifier or expression
public static normalizeName ( $name ) : PhpParser\Node\Name
 

Normalizes a name: Converts string names to Name nodes.

  • return Name The normalized name
public static normalizeNameOrExpr ( $name )
 

Normalizes a name: Converts string names to Name nodes, while also allowing expressions.

  • return Name | Expr The normalized name or expression
public static normalizeNode ( $node ) : PhpParser\Node
 

Normalizes a node: Converts builder objects to nodes.

public static normalizeStmt ( $node ) : PhpParser\Node\Stmt
 

Normalizes a node to a statement.

Expressions are wrapped in a Stmt\Expression node.

  • return Stmt The normalized statement node
public static normalizeType ( $type )
 

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

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

  • return Name | Identifier | NullableType | UnionType The normalized type
public static normalizeValue ( $value ) : PhpParser\Node\Expr
 

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

  • return Expr The normalized value
Methods
private static normalizeNameCommon ( $name , bool $allowExpr )
 

Normalizes a name: Converts string names to Name nodes, optionally allowing expressions.

  • return Name | Expr The normalized name, or expression (if allowed)
Methods
public static addModifier ( int $modifiers , int $modifier ) : int
 

Adds a modifier and returns new modifier bitmask.

  • return int New modifiers
public static normalizeDocComment ( $docComment ) : PhpParser\Comment\Doc
 

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

public static normalizeIdentifier ( $name ) : PhpParser\Node\Identifier
 

Normalizes strings to Identifier.

  • return Identifier The normalized identifier
public static normalizeIdentifierOrExpr ( $name )
 

Normalizes strings to Identifier, also allowing expressions.

  • return Identifier | Expr The normalized identifier or expression
public static normalizeName ( $name ) : PhpParser\Node\Name
 

Normalizes a name: Converts string names to Name nodes.

  • return Name The normalized name
private static normalizeNameCommon ( $name , bool $allowExpr )
 

Normalizes a name: Converts string names to Name nodes, optionally allowing expressions.

  • return Name | Expr The normalized name, or expression (if allowed)
public static normalizeNameOrExpr ( $name )
 

Normalizes a name: Converts string names to Name nodes, while also allowing expressions.

  • return Name | Expr The normalized name or expression
public static normalizeNode ( $node ) : PhpParser\Node
 

Normalizes a node: Converts builder objects to nodes.

public static normalizeStmt ( $node ) : PhpParser\Node\Stmt
 

Normalizes a node to a statement.

Expressions are wrapped in a Stmt\Expression node.

  • return Stmt The normalized statement node
public static normalizeType ( $type )
 

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

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

  • return Name | Identifier | NullableType | UnionType The normalized type
public static normalizeValue ( $value ) : PhpParser\Node\Expr
 

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

  • return Expr The normalized value
© 2020 Bruce Wells
Search Namespaces \ Classes
Configuration Numbers (0-9.) only