PhpProperty extends AbstractPhpMember implements ValueInterface Uses TypeDocblockGeneratorPart, ValuePart
Represents a PHP property.
Tags
Interfaces, Classes and Traits
Table of Contents
- VISIBILITY_PRIVATE = 'private'
- Private visibility.
- VISIBILITY_PROTECTED = 'protected'
- Protected visibility.
- VISIBILITY_PUBLIC = 'public'
- Public visibility.
- $description : string
- $docblock : Docblock
- $expression : string
- $hasExpression : bool
- $hasValue : bool
- $longDescription : string
- $name : string
- $parent : AbstractPhpStruct|null
- $static : bool
- $type : string
- $typeDescription : string
- $value : mixed
- $visibility : string
- __construct() : mixed
- PhpProperty constructor.
- create() : static
- Creates a new PHP property.
- generateDocblock() : mixed
- Generates docblock based on provided information.
- getDescription() : string
- Returns this description.
- getDocblock() : Docblock
- Returns the docblock.
- getExpression() : string
- Returns the expression.
- getLongDescription() : string
- Returns the long description.
- getName() : string
- Returns the name.
- getType() : string
- Returns the type.
- getTypeDescription() : string
- Returns the type description.
- getValue() : null|bool|float|int|PhpConstant|string
- Returns the value.
- getVisibility() : string
- Returns the visibility state of this member.
- hasValue() : bool
- Checks whether a value or expression is set.
- isExpression() : bool
- Returns whether an expression is set.
- isStatic() : bool
- Returns whether this member is static.
- setDescription() : $this
- Sets the description, which will also be used when generating a docblock.
- setDocblock() : $this
- Sets the docblock.
- setExpression() : $this
- Sets an expression.
- setLongDescription() : $this
- Sets the long description.
- setMultilineDescription() : $this
- Sets a multi-line description, which will also be used when generating a docblock.
- setName() : $this
- Sets the name.
- setStatic() : $this
- Sets whether or not this member is static.
- setType() : $this
- Sets the type.
- setTypeDescription() : $this
- Sets the description for the type.
- setValue() : $this
- Sets the value.
- setVisibility() : $this
- Sets the members visibility.
- unsetExpression() : $this
- Unsets the expression.
- unsetValue() : $this
- Unsets the value.
- generateTypeTag() : void
- Generates a type tag (return or var) but checks if one exists and updates this one.
- isPrimitive() : bool
- Returns whether the given value is a primitive.
- transformNullable() : string
- Transform a `?type` PHP notation in `type|null` docblock notation.
Constants
VISIBILITY_PRIVATE
Private visibility.
public
string
VISIBILITY_PRIVATE
= 'private'
VISIBILITY_PROTECTED
Protected visibility.
public
string
VISIBILITY_PROTECTED
= 'protected'
VISIBILITY_PUBLIC
Public visibility.
public
string
VISIBILITY_PUBLIC
= 'public'
Properties
$description
protected
string
$description
= ''
$docblock
private
Docblock
$docblock
$expression
private
string
$expression
= ''
$hasExpression
private
bool
$hasExpression
= false
$hasValue
private
bool
$hasValue
= false
$longDescription
private
string
$longDescription
= ''
$name
private
string
$name
= ''
$parent
private
AbstractPhpStruct|null
$parent
$static
private
bool
$static
= false
$type
private
string
$type
= ''
$typeDescription
private
string
$typeDescription
= ''
$value
private
mixed
$value
$visibility
private
string
$visibility
= self::VISIBILITY_PUBLIC
Methods
__construct()
PhpProperty constructor.
public
final __construct([string $name = '' ]) : mixed
This final method is needed to put in safe the function create
.
Parameters
- $name : string = ''
-
the name of the member
Tags
Return values
mixed —create()
Creates a new PHP property.
public
static create([string $name = '' ]) : static
Parameters
- $name : string = ''
-
the properties name
Return values
static —generateDocblock()
Generates docblock based on provided information.
public
generateDocblock() : mixed
Return values
mixed —getDescription()
Returns this description.
public
getDescription() : string
Return values
string —getDocblock()
Returns the docblock.
public
getDocblock() : Docblock
Return values
Docblock —getExpression()
Returns the expression.
public
getExpression() : string
Return values
string —getLongDescription()
Returns the long description.
public
getLongDescription() : string
Return values
string —getName()
Returns the name.
public
getName() : string
Return values
string —getType()
Returns the type.
public
getType() : string
Return values
string —getTypeDescription()
Returns the type description.
public
getTypeDescription() : string
Return values
string —getValue()
Returns the value.
public
getValue() : null|bool|float|int|PhpConstant|string
Return values
null|bool|float|int|PhpConstant|string —getVisibility()
Returns the visibility state of this member.
public
getVisibility() : string
Return values
string —the visibility
hasValue()
Checks whether a value or expression is set.
public
hasValue() : bool
Return values
bool —isExpression()
Returns whether an expression is set.
public
isExpression() : bool
Return values
bool —isStatic()
Returns whether this member is static.
public
isStatic() : bool
Return values
bool —true
if static and false
if not
setDescription()
Sets the description, which will also be used when generating a docblock.
public
setDescription(string $description) : $this
Parameters
- $description : string
Return values
$this —setDocblock()
Sets the docblock.
public
setDocblock(Docblock|string $doc) : $this
Parameters
- $doc : Docblock|string
Return values
$this —setExpression()
Sets an expression.
public
setExpression(string $expr) : $this
Parameters
- $expr : string
Return values
$this —setLongDescription()
Sets the long description.
public
setLongDescription(string $longDescription) : $this
Parameters
- $longDescription : string
Return values
$this —setMultilineDescription()
Sets a multi-line description, which will also be used when generating a docblock.
public
setMultilineDescription(array<string|int, mixed> $description) : $this
Each line is a value of the $description
array.
Parameters
- $description : array<string|int, mixed>
Return values
$this —setName()
Sets the name.
public
setName(string $name) : $this
Parameters
- $name : string
Return values
$this —setStatic()
Sets whether or not this member is static.
public
setStatic(bool $bool) : $this
Parameters
- $bool : bool
Return values
$this —setType()
Sets the type.
public
setType(string $type[, string $description = '' ]) : $this
Parameters
- $type : string
- $description : string = ''
Return values
$this —setTypeDescription()
Sets the description for the type.
public
setTypeDescription(string $description) : $this
Parameters
- $description : string
Return values
$this —setValue()
Sets the value.
public
setValue(mixed $value) : $this
Parameters
- $value : mixed
Tags
Return values
$this —setVisibility()
Sets the members visibility.
public
setVisibility(string $visibility) : $this
Parameters
- $visibility : string
-
the new visibility
Tags
Return values
$this —unsetExpression()
Unsets the expression.
public
unsetExpression() : $this
Return values
$this —unsetValue()
Unsets the value.
public
unsetValue() : $this
Return values
$this —generateTypeTag()
Generates a type tag (return or var) but checks if one exists and updates this one.
protected
generateTypeTag(AbstractTypeTag $tag) : void
Parameters
- $tag : AbstractTypeTag
Return values
void —isPrimitive()
Returns whether the given value is a primitive.
private
isPrimitive(mixed $value) : bool
Parameters
- $value : mixed
Return values
bool —transformNullable()
Transform a `?type` PHP notation in `type|null` docblock notation.
private
transformNullable(string $type) : string
Parameters
- $type : string