ClassConst
in package
implements
Builder
Table of Contents
Interfaces
Properties
- $attributeGroups : array<int, AttributeGroup>
- $attributes : array<string, mixed>
- $constants : array<int, Const_>
- $flags : int
- $type : Identifier|Name|ComplexType|null
Methods
- __construct() : mixed
- Creates a class constant builder
- addAttribute() : $this
- Adds an attribute group.
- addConst() : $this
- Add another constant to const group
- getNode() : ClassConst
- Returns the built class node.
- makeFinal() : $this
- Makes the constant final.
- makePrivate() : $this
- Makes the constant private.
- makeProtected() : $this
- Makes the constant protected.
- makePublic() : $this
- Makes the constant public.
- setDocComment() : $this
- Sets doc comment for the constant.
- setType() : $this
- Sets the constant type.
Properties
$attributeGroups
protected
array<int, AttributeGroup>
$attributeGroups
= []
$attributes
protected
array<string, mixed>
$attributes
= []
$constants
protected
array<int, Const_>
$constants
= []
$flags
protected
int
$flags
= 0
$type
protected
Identifier|Name|ComplexType|null
$type
= null
Methods
__construct()
Creates a class constant builder
public
__construct(string|Identifier $name, Expr|bool|null|int|float|string|array<string|int, mixed> $value) : mixed
Parameters
- $name : string|Identifier
-
Name
- $value : Expr|bool|null|int|float|string|array<string|int, mixed>
-
Value
addAttribute()
Adds an attribute group.
public
addAttribute(Attribute|AttributeGroup $attribute) : $this
Parameters
- $attribute : Attribute|AttributeGroup
Return values
$this —The builder instance (for fluid interface)
addConst()
Add another constant to const group
public
addConst(string|Identifier $name, Expr|bool|null|int|float|string|array<string|int, mixed> $value) : $this
Parameters
- $name : string|Identifier
-
Name
- $value : Expr|bool|null|int|float|string|array<string|int, mixed>
-
Value
Return values
$this —The builder instance (for fluid interface)
getNode()
Returns the built class node.
public
getNode() : ClassConst
Return values
ClassConst —The built constant node
makeFinal()
Makes the constant final.
public
makeFinal() : $this
Return values
$this —The builder instance (for fluid interface)
makePrivate()
Makes the constant private.
public
makePrivate() : $this
Return values
$this —The builder instance (for fluid interface)
makeProtected()
Makes the constant protected.
public
makeProtected() : $this
Return values
$this —The builder instance (for fluid interface)
makePublic()
Makes the constant public.
public
makePublic() : $this
Return values
$this —The builder instance (for fluid interface)
setDocComment()
Sets doc comment for the constant.
public
setDocComment(Doc|string $docComment) : $this
Parameters
- $docComment : Doc|string
-
Doc comment to set
Return values
$this —The builder instance (for fluid interface)
setType()
Sets the constant type.
public
setType(string|Name|Identifier|ComplexType $type) : $this
Parameters
- $type : string|Name|Identifier|ComplexType