Methods |
public
static
|
createFromClassNameAndMethod(string $className, non-empty-string $methodName, non-empty-string $parameterName): self
Create a reflection of a parameter using a class name
Create a reflection of a parameter using a class name
Throws
|
#
|
public
static
|
createFromClassInstanceAndMethod(object $instance, non-empty-string $methodName, non-empty-string $parameterName): self
Create a reflection of a parameter using an instance
Create a reflection of a parameter using an instance
Throws
|
#
|
public
static
|
createFromClosure(Closure $closure, non-empty-string $parameterName): ReflectionParameter
Create a reflection of a parameter using a closure
Create a reflection of a parameter using a closure
Throws
|
#
|
public
static
|
createFromSpec(object[]|string[]|string|Closure $spec, non-empty-string $parameterName): self
Create the parameter from the given spec. Possible $spec parameters are:
Create the parameter from the given spec. Possible $spec parameters are:
- [$instance, 'method']
- ['Foo', 'bar']
- ['foo']
- [function () {}]
Throws
Exception |
|
InvalidArgumentException |
|
|
#
|
public
|
__toString(): string
|
#
|
public
|
getName(): non-empty-string
Get the name of the parameter.
Get the name of the parameter.
|
#
|
public
|
getDeclaringFunction(): ReflectionMethod|ReflectionFunction
Get the function (or method) that declared this parameter.
Get the function (or method) that declared this parameter.
|
#
|
public
|
getDeclaringClass(): ?ReflectionClass
Get the class from the method that this parameter belongs to, if it
exists.
Get the class from the method that this parameter belongs to, if it
exists.
This will return null if the declaring function is not a method.
|
#
|
public
|
getImplementingClass(): ?ReflectionClass
|
#
|
public
|
isOptional(): bool
Is the parameter optional?
Is the parameter optional?
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
|
isDefaultValueAvailable(): bool
Does the parameter have a default, regardless of whether it is optional.
Does the parameter have a default, regardless of whether it is optional.
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
|
getDefaultValueExpr(): ?Expr
Deprecated
Use getDefaultValueExpression()
|
#
|
public
|
getDefaultValueExpression(): ?Expr
|
#
|
public
|
getDefaultValue(): mixed
Get the default value of the parameter.
Get the default value of the parameter.
Deprecated
Use getDefaultValueExpression()
Throws
|
#
|
public
|
allowsNull(): bool
Does this method allow null for a parameter?
Does this method allow null for a parameter?
|
#
|
public
|
getPosition(): int
Find the position of the parameter, left to right, starting at zero.
Find the position of the parameter, left to right, starting at zero.
|
#
|
public
|
getType(): ReflectionNamedType|ReflectionUnionType|ReflectionIntersectionType|null
Get the ReflectionType instance representing the type declaration for
this parameter
Get the ReflectionType instance representing the type declaration for
this parameter
(note: this has nothing to do with DocBlocks).
|
#
|
public
|
hasType(): bool
Does this parameter have a type declaration?
Does this parameter have a type declaration?
(note: this has nothing to do with DocBlocks).
|
#
|
public
|
isVariadic(): bool
Is this parameter a variadic (denoted by ...$param).
Is this parameter a variadic (denoted by ...$param).
|
#
|
public
|
isPassedByReference(): bool
Is this parameter passed by reference (denoted by &$param).
Is this parameter passed by reference (denoted by &$param).
|
#
|
public
|
canBePassedByValue(): bool
|
#
|
public
|
isPromoted(): bool
|
#
|
public
|
isDefaultValueConstant(): bool
|
#
|
public
|
getDefaultValueConstantName(): string
|
#
|
public
|
getStartLine(): positive-int
|
#
|
public
|
getEndLine(): positive-int
|
#
|
public
|
getStartColumn(): positive-int
|
#
|
public
|
getEndColumn(): positive-int
|
#
|
public
|
getAttributes(): list<ReflectionAttribute>
|
#
|
public
|
getAttributesByName(string $name): list<ReflectionAttribute>
|
#
|
public
|
getAttributesByInstance(class-string $className): list<ReflectionAttribute>
|
#
|