PHP Класс BetterReflection\Reflection\ReflectionParameter

Наследование: implements Reflector
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__clone ( )
__toString ( ) : string Return string representation of this parameter.
allowsNull ( ) : boolean Does this method allow null for a parameter?
canBePassedByValue ( ) : boolean
createFromClassInstanceAndMethod ( object $instance, string $methodName, string $parameterName ) : ReflectionParameter Create a reflection of a parameter using an instance
createFromClassNameAndMethod ( string $className, string $methodName, string $parameterName ) : ReflectionParameter Create a reflection of a parameter using a class name
createFromNode ( BetterReflection\Reflector\Reflector $reflector, Param $node, ReflectionFunctionAbstract $function, integer $parameterIndex ) : ReflectionParameter
createFromSpec ( string[] | string | Closure $spec, string $parameterName ) : ReflectionParameter Create the parameter from the given spec. Possible $spec parameters are:
export ( )
getClass ( ) : ReflectionClass | null Gets a ReflectionClass for the type hint (returns null if not a class)
getDeclaringClass ( ) : ReflectionClass | null Get the class from the method that this parameter belongs to, if it exists.
getDeclaringFunction ( ) : ReflectionFunctionAbstract Get the function (or method) that declared this parameter.
getDefaultValue ( ) : mixed Get the default value of the parameter.
getDefaultValueAsString ( ) : string Get the default value represented as a string.
getDefaultValueConstantName ( ) : string
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.
getName ( ) : string Get the name of the parameter.
getPosition ( ) : integer Find the position of the parameter, left to right, starting at zero.
getType ( ) : ReflectionType | null Get the ReflectionType instance representing the type declaration for this parameter
getTypeHint ( ) : phpDocumentor\Reflection\Type Get the type hint declared for the parameter. This is the real type hint for the parameter, e.g. method(closure $someFunc) defined by the method itself, and is separate from the DocBlock type hints.
hasType ( ) : boolean Does this parameter have a type declaration?
isArray ( ) : boolean Is this parameter an array?
isCallable ( ) : boolean Is this parameter a callable?
isDefaultValueAvailable ( ) : boolean Does the parameter have a default, regardless of whether it is optional.
isDefaultValueConstant ( ) : boolean
isOptional ( ) : boolean Is the parameter optional?
isPassedByReference ( ) : boolean Is this parameter passed by reference (denoted by &$param).
isVariadic ( ) : boolean Is this parameter a variadic (denoted by .
removeType ( ) Remove the parameter type declaration completely.
setType ( phpDocumentor\Reflection\Type $newParameterType ) Set the parameter type declaration.

Приватные методы

Метод Описание
__construct ( )
parseDefaultValueNode ( )

Описание методов

__clone() публичный Метод

public __clone ( )

__toString() публичный Метод

Return string representation of this parameter.
public __toString ( ) : string
Результат string

allowsNull() публичный Метод

Does this method allow null for a parameter?
public allowsNull ( ) : boolean
Результат boolean

canBePassedByValue() публичный Метод

public canBePassedByValue ( ) : boolean
Результат boolean

createFromClassInstanceAndMethod() публичный статический Метод

Create a reflection of a parameter using an instance
public static createFromClassInstanceAndMethod ( object $instance, string $methodName, string $parameterName ) : ReflectionParameter
$instance object
$methodName string
$parameterName string
Результат ReflectionParameter

createFromClassNameAndMethod() публичный статический Метод

Create a reflection of a parameter using a class name
public static createFromClassNameAndMethod ( string $className, string $methodName, string $parameterName ) : ReflectionParameter
$className string
$methodName string
$parameterName string
Результат ReflectionParameter

createFromNode() публичный статический Метод

public static createFromNode ( BetterReflection\Reflector\Reflector $reflector, Param $node, ReflectionFunctionAbstract $function, integer $parameterIndex ) : ReflectionParameter
$reflector BetterReflection\Reflector\Reflector
$node PhpParser\Node\Param
$function ReflectionFunctionAbstract
$parameterIndex integer
Результат ReflectionParameter

createFromSpec() публичный статический Метод

- [$instance, 'method'] - ['Foo', 'bar'] - ['foo'] - [function () }]
public static createFromSpec ( string[] | string | Closure $spec, string $parameterName ) : ReflectionParameter
$spec string[] | string | Closure
$parameterName string
Результат ReflectionParameter

export() публичный статический Метод

public static export ( )

getClass() публичный Метод

Gets a ReflectionClass for the type hint (returns null if not a class)
public getClass ( ) : ReflectionClass | null
Результат ReflectionClass | null

getDeclaringClass() публичный Метод

This will return null if the declaring function is not a method.
public getDeclaringClass ( ) : ReflectionClass | null
Результат ReflectionClass | null

getDeclaringFunction() публичный Метод

Get the function (or method) that declared this parameter.
public getDeclaringFunction ( ) : ReflectionFunctionAbstract
Результат ReflectionFunctionAbstract

getDefaultValue() публичный Метод

Get the default value of the parameter.
public getDefaultValue ( ) : mixed
Результат mixed

getDefaultValueAsString() публичный Метод

Get the default value represented as a string.
public getDefaultValueAsString ( ) : string
Результат string

getDefaultValueConstantName() публичный Метод

public getDefaultValueConstantName ( ) : string
Результат string

getDocBlockTypeStrings() публичный Метод

Get the DocBlock type hints as an array of strings.
public getDocBlockTypeStrings ( ) : string[]
Результат string[]

getDocBlockTypes() публичный Метод

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.
См. также: getTypeHint()
public getDocBlockTypes ( ) : phpDocumentor\Reflection\Type[]
Результат phpDocumentor\Reflection\Type[]

getName() публичный Метод

Get the name of the parameter.
public getName ( ) : string
Результат string

getPosition() публичный Метод

Find the position of the parameter, left to right, starting at zero.
public getPosition ( ) : integer
Результат integer

getType() публичный Метод

(note: this has nothing to do with DocBlocks).
public getType ( ) : ReflectionType | null
Результат ReflectionType | null

getTypeHint() публичный Метод

Get the type hint declared for the parameter. This is the real type hint for the parameter, e.g. method(closure $someFunc) defined by the method itself, and is separate from the DocBlock type hints.
См. также: getDocBlockTypes()
public getTypeHint ( ) : phpDocumentor\Reflection\Type
Результат phpDocumentor\Reflection\Type

hasType() публичный Метод

(note: this has nothing to do with DocBlocks).
public hasType ( ) : boolean
Результат boolean

isArray() публичный Метод

Is this parameter an array?
public isArray ( ) : boolean
Результат boolean

isCallable() публичный Метод

Is this parameter a callable?
public isCallable ( ) : boolean
Результат boolean

isDefaultValueAvailable() публичный Метод

Note this is distinct from "isOptional" because you can have a default value, but the parameter not be optional. In the example, the $foo parameter isOptional() == false, but isDefaultValueAvailable == true
public isDefaultValueAvailable ( ) : boolean
Результат boolean

isDefaultValueConstant() публичный Метод

public isDefaultValueConstant ( ) : boolean
Результат boolean

isOptional() публичный Метод

Note this is distinct from "isDefaultValueAvailable" because you can have a default value, but the parameter not be optional. In the example, the $foo parameter isOptional() == false, but isDefaultValueAvailable == true
public isOptional ( ) : boolean
Результат boolean

isPassedByReference() публичный Метод

Is this parameter passed by reference (denoted by &$param).
public isPassedByReference ( ) : boolean
Результат boolean

isVariadic() публичный Метод

..$param).
public isVariadic ( ) : boolean
Результат boolean

removeType() публичный Метод

Remove the parameter type declaration completely.
public removeType ( )

setType() публичный Метод

You must use the phpDocumentor reflection type classes as the parameter.
public setType ( phpDocumentor\Reflection\Type $newParameterType )
$newParameterType phpDocumentor\Reflection\Type