PHP Class BetterReflection\Reflection\ReflectionProperty

Inheritance: implements Reflector
Exibir arquivo Open project: roave/better-reflection Class Usage Examples

Public Methods

Method Description
__clone ( )
__toString ( ) : string Return string representation of this little old property.
createFromInstance ( object $instance, string $propertyName ) : BetterReflection\Reflection\ReflectionMethod Create a reflection of an instance's property by it's name
createFromName ( string $className, string $propertyName ) : BetterReflection\Reflection\ReflectionMethod Create a reflection of a class's property by it's name
createFromNode ( BetterReflection\Reflector\Reflector $reflector, Property $node, ReflectionClass $declaringClass, boolean $declaredAtCompileTime = true ) : ReflectionProperty
export ( )
getDeclaringClass ( ) : ReflectionClass
getDefaultValue ( ) : mixed Get the default value of the property (as defined before constructor is called, when the property is defined)
getDocBlockTypeStrings ( ) : string[] Get the DocBlock type hints as an array of strings.
getDocBlockTypes ( ) : phpDocumentor\Reflection\Type[] Get the types defined in the DocBlocks. This returns an array because the parameter may have multiple (compound) types specified (for example when you type hint pipe-separated "string|null", in which case this would return an array of Type objects, one for string, one for null.
getDocComment ( ) : string
getModifiers ( ) : integer Get the core-reflection-compatible modifier values.
getName ( ) : string Get the name of the property.
isDefault ( ) : boolean Has the property been declared at compile-time?
isPrivate ( ) : boolean Is the property private?
isProtected ( ) : boolean Is the property protected?
isPublic ( ) : boolean Is the property public?
isStatic ( ) : boolean Is the property static?
setVisibility ( integer $newVisibility ) Set the default visibility of this property. Use the core \ReflectionProperty::IS_* values as parameters, e.g.:

Private Methods

Method Description
__construct ( )
getVisibilityAsString ( ) : string

Method Details

__clone() public method

public __clone ( )

__toString() public method

Return string representation of this little old property.
public __toString ( ) : string
return string

createFromInstance() public static method

Create a reflection of an instance's property by it's name
public static createFromInstance ( object $instance, string $propertyName ) : BetterReflection\Reflection\ReflectionMethod
$instance object
$propertyName string
return BetterReflection\Reflection\ReflectionMethod

createFromName() public static method

Create a reflection of a class's property by it's name
public static createFromName ( string $className, string $propertyName ) : BetterReflection\Reflection\ReflectionMethod
$className string
$propertyName string
return BetterReflection\Reflection\ReflectionMethod

createFromNode() public static method

public static createFromNode ( BetterReflection\Reflector\Reflector $reflector, Property $node, ReflectionClass $declaringClass, boolean $declaredAtCompileTime = true ) : ReflectionProperty
$reflector BetterReflection\Reflector\Reflector
$node PhpParser\Node\Stmt\Property
$declaringClass ReflectionClass
$declaredAtCompileTime boolean
return ReflectionProperty

export() public static method

public static export ( )

getDeclaringClass() public method

public getDeclaringClass ( ) : ReflectionClass
return ReflectionClass

getDefaultValue() public method

Get the default value of the property (as defined before constructor is called, when the property is defined)
public getDefaultValue ( ) : mixed
return mixed

getDocBlockTypeStrings() public method

Get the DocBlock type hints as an array of strings.
public getDocBlockTypeStrings ( ) : string[]
return string[]

getDocBlockTypes() public method

Get the types defined in the DocBlocks. This returns an array because the parameter may have multiple (compound) types specified (for example when you type hint pipe-separated "string|null", in which case this would return an array of Type objects, one for string, one for null.
public getDocBlockTypes ( ) : phpDocumentor\Reflection\Type[]
return phpDocumentor\Reflection\Type[]

getDocComment() public method

public getDocComment ( ) : string
return string

getModifiers() public method

Get the core-reflection-compatible modifier values.
public getModifiers ( ) : integer
return integer

getName() public method

Get the name of the property.
public getName ( ) : string
return string

isDefault() public method

Note that unless the property is static, this is hard coded to return true, because we are unable to reflect instances of classes, therefore we can be sure that all properties are always declared at compile-time.
public isDefault ( ) : boolean
return boolean

isPrivate() public method

Is the property private?
public isPrivate ( ) : boolean
return boolean

isProtected() public method

Is the property protected?
public isProtected ( ) : boolean
return boolean

isPublic() public method

Is the property public?
public isPublic ( ) : boolean
return boolean

isStatic() public method

Is the property static?
public isStatic ( ) : boolean
return boolean

setVisibility() public method

Set the default visibility of this property. Use the core \ReflectionProperty::IS_* values as parameters, e.g.:
public setVisibility ( integer $newVisibility )
$newVisibility integer