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.

  • param int $modifiers Existing modifiers
  • param int $modifier Modifier to set
  • return int New modifiers
public static normalizeAttribute ( $attribute ) : PhpParser\Node\AttributeGroup
 

Normalizes a attribute: Converts attribute to the Attribute Group if needed.

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.

  • param string | Identifier $name The identifier to normalize
  • return Identifier The normalized identifier
public static normalizeIdentifierOrExpr ( $name )
 

Normalizes strings to Identifier, also allowing expressions.

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

Normalizes a name: Converts string names to Name nodes.

  • param Name | string $name The name to normalize
  • return Name The normalized name
public static normalizeNameOrExpr ( $name )
 

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

  • param Expr | Name | string $name The name to normalize
  • 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.

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.

  • param string | Name | Identifier | ComplexType $type The type to normalize
  • return Name | Identifier | ComplexType 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

  • param PhpParser\Node\Expr | bool | null | int | float | string | array $value The value to normalize
  • return Expr The normalized value
Methods
public static addModifier ( int $modifiers , int $modifier ) : int
 

Adds a modifier and returns new modifier bitmask.

  • param int $modifiers Existing modifiers
  • param int $modifier Modifier to set
  • return int New modifiers
public static normalizeAttribute ( $attribute ) : PhpParser\Node\AttributeGroup
 

Normalizes a attribute: Converts attribute to the Attribute Group if needed.

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.

  • param string | Identifier $name The identifier to normalize
  • return Identifier The normalized identifier
public static normalizeIdentifierOrExpr ( $name )
 

Normalizes strings to Identifier, also allowing expressions.

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

Normalizes a name: Converts string names to Name nodes.

  • param Name | string $name The name to normalize
  • return Name The normalized name
public static normalizeNameOrExpr ( $name )
 

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

  • param Expr | Name | string $name The name to normalize
  • 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.

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.

  • param string | Name | Identifier | ComplexType $type The type to normalize
  • return Name | Identifier | ComplexType 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

  • param PhpParser\Node\Expr | bool | null | int | float | string | array $value The value to normalize
  • return Expr The normalized value
© 2022 Bruce Wells
Search Namespaces \ Classes
Configuration