Property
in package
implements
Builder
Table of Contents
Interfaces
Properties
- $attributeGroups : array<int, AttributeGroup>
- $attributes : array<string, mixed>
- $default : Expr|null
- $flags : int
- $hooks : array<int, PropertyHook>
- $name : string
- $type : null|Identifier|Name|ComplexType
Methods
- __construct() : mixed
- Creates a property builder.
- addAttribute() : $this
- Adds an attribute group.
- addHook() : $this
- Adds a property hook.
- getNode() : Property
- Returns the built class node.
- makeAbstract() : $this
- Makes the property abstract. Requires at least one property hook to be specified as well.
- makeFinal() : $this
- Makes the property final.
- makePrivate() : $this
- Makes the property private.
- makePrivateSet() : $this
- Gives the property private(set) visibility.
- makeProtected() : $this
- Makes the property protected.
- makeProtectedSet() : $this
- Gives the property protected(set) visibility.
- makePublic() : $this
- Makes the property public.
- makeReadonly() : $this
- Makes the property readonly.
- makeStatic() : $this
- Makes the property static.
- setDefault() : $this
- Sets default value for the property.
- setDocComment() : $this
- Sets doc comment for the property.
- setType() : $this
- Sets the property type for PHP 7.4+.
Properties
$attributeGroups
protected
array<int, AttributeGroup>
$attributeGroups
= []
$attributes
protected
array<string, mixed>
$attributes
= []
$default
protected
Expr|null
$default
= null
$flags
protected
int
$flags
= 0
$hooks
protected
array<int, PropertyHook>
$hooks
= []
$name
protected
string
$name
$type
protected
null|Identifier|Name|ComplexType
$type
= null
Methods
__construct()
Creates a property builder.
public
__construct(string $name) : mixed
Parameters
- $name : string
-
Name of the property
addAttribute()
Adds an attribute group.
public
addAttribute(Attribute|AttributeGroup $attribute) : $this
Parameters
- $attribute : Attribute|AttributeGroup
Return values
$this —The builder instance (for fluid interface)
addHook()
Adds a property hook.
public
addHook(PropertyHook $hook) : $this
Parameters
- $hook : PropertyHook
Return values
$this —The builder instance (for fluid interface)
getNode()
Returns the built class node.
public
getNode() : Property
Return values
Property —The built property node
makeAbstract()
Makes the property abstract. Requires at least one property hook to be specified as well.
public
makeAbstract() : $this
Return values
$this —The builder instance (for fluid interface)
makeFinal()
Makes the property final.
public
makeFinal() : $this
Return values
$this —The builder instance (for fluid interface)
makePrivate()
Makes the property private.
public
makePrivate() : $this
Return values
$this —The builder instance (for fluid interface)
makePrivateSet()
Gives the property private(set) visibility.
public
makePrivateSet() : $this
Return values
$this —The builder instance (for fluid interface)
makeProtected()
Makes the property protected.
public
makeProtected() : $this
Return values
$this —The builder instance (for fluid interface)
makeProtectedSet()
Gives the property protected(set) visibility.
public
makeProtectedSet() : $this
Return values
$this —The builder instance (for fluid interface)
makePublic()
Makes the property public.
public
makePublic() : $this
Return values
$this —The builder instance (for fluid interface)
makeReadonly()
Makes the property readonly.
public
makeReadonly() : $this
Return values
$this —The builder instance (for fluid interface)
makeStatic()
Makes the property static.
public
makeStatic() : $this
Return values
$this —The builder instance (for fluid interface)
setDefault()
Sets default value for the property.
public
setDefault(mixed $value) : $this
Parameters
- $value : mixed
-
Default value to use
Return values
$this —The builder instance (for fluid interface)
setDocComment()
Sets doc comment for the property.
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 property type for PHP 7.4+.
public
setType(string|Name|Identifier|ComplexType $type) : $this
Parameters
- $type : string|Name|Identifier|ComplexType