Enum_
extends Declaration
in package
Table of Contents
Properties
- $attributeGroups : array<int, AttributeGroup>
- $attributes : array<string, mixed>
- $constants : array<int, ClassConst>
- $enumCases : array<int, EnumCase>
- $implements : array<int, Name>
- $methods : array<int, ClassMethod>
- $name : string
- $scalarType : Identifier|null
- $uses : array<int, TraitUse>
Methods
- __construct() : mixed
- Creates an enum builder.
- addAttribute() : $this
- Adds an attribute group.
- addStmt() : $this
- Adds a statement.
- addStmts() : $this
- Adds multiple statements.
- getNode() : Enum_
- Returns the built class node.
- implement() : $this
- Implements one or more interfaces.
- setDocComment() : $this
- Sets doc comment for the declaration.
- setScalarType() : $this
- Sets the scalar type.
Properties
$attributeGroups
protected
array<int, AttributeGroup>
$attributeGroups
= []
$attributes
protected
array<string, mixed>
$attributes
= []
$constants
protected
array<int, ClassConst>
$constants
= []
$enumCases
protected
array<int, EnumCase>
$enumCases
= []
$implements
protected
array<int, Name>
$implements
= []
$methods
protected
array<int, ClassMethod>
$methods
= []
$name
protected
string
$name
$scalarType
protected
Identifier|null
$scalarType
= null
$uses
protected
array<int, TraitUse>
$uses
= []
Methods
__construct()
Creates an enum builder.
public
__construct(string $name) : mixed
Parameters
- $name : string
-
Name of the enum
addAttribute()
Adds an attribute group.
public
addAttribute(Attribute|AttributeGroup $attribute) : $this
Parameters
- $attribute : Attribute|AttributeGroup
Return values
$this —The builder instance (for fluid interface)
addStmt()
Adds a statement.
public
addStmt(Stmt|Builder $stmt) : $this
Parameters
Return values
$this —The builder instance (for fluid interface)
addStmts()
Adds multiple statements.
public
addStmts(array<string|int, Stmt|Builder> $stmts) : $this
Parameters
Return values
$this —The builder instance (for fluid interface)
getNode()
Returns the built class node.
public
getNode() : Enum_
Return values
Enum_ —The built enum node
implement()
Implements one or more interfaces.
public
implement(Name|string ...$interfaces) : $this
Parameters
- $interfaces : Name|string
-
Names of interfaces to implement
Return values
$this —The builder instance (for fluid interface)
setDocComment()
Sets doc comment for the declaration.
public
setDocComment(Doc|string $docComment) : $this
Parameters
- $docComment : Doc|string
-
Doc comment to set
Return values
$this —The builder instance (for fluid interface)
setScalarType()
Sets the scalar type.
public
setScalarType(string|Identifier $scalarType) : $this
Parameters
- $scalarType : string|Identifier