Copied!
CloneableInstantiable
Methods
public __construct( $name, $value)
 

Creates a class constant builder

  • param string|\Identifier $name Name
  • param \Node\Expr|bool|null|int|float|string|array $value Value
public addAttribute( $attribute)
 

Adds an attribute group.

  • param \Node\Attribute|\Node\AttributeGroup $attribute
  • return $this The builder instance (for fluid interface)
public addConst( $name, $value)
 

Add another constant to const group

  • param string|\Identifier $name Name
  • param \Node\Expr|bool|null|int|float|string|array $value Value
  • return $this The builder instance (for fluid interface)
public getNode() : PhpParser\Node
 

Returns the built class node.

  • return \Stmt\ClassConst The built constant node
public makeFinal()
 

Makes the constant final.

  • return $this The builder instance (for fluid interface)
public makePrivate()
 

Makes the constant private.

  • return $this The builder instance (for fluid interface)
public makeProtected()
 

Makes the constant protected.

  • return $this The builder instance (for fluid interface)
public makePublic()
 

Makes the constant public.

  • return $this The builder instance (for fluid interface)
public setDocComment( $docComment)
 

Sets doc comment for the constant.

  • param \PhpParser\Comment\Doc|string $docComment Doc comment to set
  • return $this The builder instance (for fluid interface)
public setType( $type)
 

Sets the constant type.

  • param string|\Node\Name|\Identifier|\Node\ComplexType $type
  • return $this
Properties
protected array $attributeGroups = []
 
  • var list<\Node\AttributeGroup>
protected array $attributes = []
 
  • var array<string,mixed>
protected array $constants = []
 
  • var list<\Const_>
protected int $flags = 0
protected ?PhpParser\Node $type = NULL
 
  • var \Identifier|\Node\Name|\Node\ComplexType|null
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration