Method
extends FunctionLike
in package
Table of Contents
Properties
- $attributeGroups : array<int, AttributeGroup>
- $attributes : array<string, mixed>
- $flags : int
- $name : string
- $params : array<string|int, Param>
- $returnByRef : bool
- $returnType : Identifier|Name|ComplexType|null
- $stmts : array<int, Stmt>|null
Methods
- __construct() : mixed
- Creates a method builder.
- addAttribute() : $this
- Adds an attribute group.
- addParam() : $this
- Adds a parameter.
- addParams() : $this
- Adds multiple parameters.
- addStmt() : $this
- Adds a statement.
- addStmts() : $this
- Adds multiple statements.
- getNode() : ClassMethod
- Returns the built method node.
- makeAbstract() : $this
- Makes the method abstract.
- makeFinal() : $this
- Makes the method final.
- makePrivate() : $this
- Makes the method private.
- makeProtected() : $this
- Makes the method protected.
- makePublic() : $this
- Makes the method public.
- makeReturnByRef() : $this
- Make the function return by reference.
- makeStatic() : $this
- Makes the method static.
- setDocComment() : $this
- Sets doc comment for the declaration.
- setReturnType() : $this
- Sets the return type for PHP 7.
Properties
$attributeGroups
protected
array<int, AttributeGroup>
$attributeGroups
= []
$attributes
protected
array<string, mixed>
$attributes
= []
$flags
protected
int
$flags
= 0
$name
protected
string
$name
$params
protected
array<string|int, Param>
$params
= []
$returnByRef
protected
bool
$returnByRef
= false
$returnType
protected
Identifier|Name|ComplexType|null
$returnType
= null
$stmts
protected
array<int, Stmt>|null
$stmts
= []
Methods
__construct()
Creates a method builder.
public
__construct(string $name) : mixed
Parameters
- $name : string
-
Name of the method
addAttribute()
Adds an attribute group.
public
addAttribute(Attribute|AttributeGroup $attribute) : $this
Parameters
- $attribute : Attribute|AttributeGroup
Return values
$this —The builder instance (for fluid interface)
addParam()
Adds a parameter.
public
addParam(Param|Param $param) : $this
Parameters
Return values
$this —The builder instance (for fluid interface)
addParams()
Adds multiple parameters.
public
addParams(array<string|int, Param|Param> $params) : $this
Parameters
Return values
$this —The builder instance (for fluid interface)
addStmt()
Adds a statement.
public
addStmt(Node|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 method node.
public
getNode() : ClassMethod
Return values
ClassMethod —The built method node
makeAbstract()
Makes the method abstract.
public
makeAbstract() : $this
Return values
$this —The builder instance (for fluid interface)
makeFinal()
Makes the method final.
public
makeFinal() : $this
Return values
$this —The builder instance (for fluid interface)
makePrivate()
Makes the method private.
public
makePrivate() : $this
Return values
$this —The builder instance (for fluid interface)
makeProtected()
Makes the method protected.
public
makeProtected() : $this
Return values
$this —The builder instance (for fluid interface)
makePublic()
Makes the method public.
public
makePublic() : $this
Return values
$this —The builder instance (for fluid interface)
makeReturnByRef()
Make the function return by reference.
public
makeReturnByRef() : $this
Return values
$this —The builder instance (for fluid interface)
makeStatic()
Makes the method static.
public
makeStatic() : $this
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)
setReturnType()
Sets the return type for PHP 7.
public
setReturnType(string|Name|Identifier|ComplexType $type) : $this
Parameters
- $type : string|Name|Identifier|ComplexType
Return values
$this —The builder instance (for fluid interface)