Methods |
public
static
|
getNames(
array<ReflectionAttribute<object>|ReflectionClass<object>|ReflectionClassConstant|ReflectionExtension|ReflectionFunctionAbstract|ReflectionNamedType|ReflectionParameter|ReflectionProperty|ReflectionZendExtension> $reflectors,
): string[]
Get a list of names from a list of reflectors
Get a list of names from a list of reflectors
|
#
|
public
static
|
getBaseClass(ReflectionClass<object> $class): ReflectionClass<object>
Follow parents of a class to the root class
Follow parents of a class to the root class
|
#
|
public
static
|
getPrototype(ReflectionMethod $method): ?ReflectionMethod
Get the prototype of a method, or null if it has no prototype
Get the prototype of a method, or null if it has no prototype
|
#
|
public
static
|
getPrototypeClass(ReflectionMethod $method): ReflectionClass<object>
Get the declaring class of a method's prototype, falling back to the
method's declaring class if it has no prototype
Get the declaring class of a method's prototype, falling back to the
method's declaring class if it has no prototype
|
#
|
public
static
|
getTraitMethod(ReflectionClass<object> $class, string $methodName): ?ReflectionMethod
Get the trait method inserted into a class with the given name
Get the trait method inserted into a class with the given name
|
#
|
public
static
|
getTraitAliases(ReflectionClass<object> $class): array<string, array{class-string, string}>
Get the trait method aliases of a class as an array that maps aliases to
[ trait, method ] arrays
Get the trait method aliases of a class as an array that maps aliases to
[ trait, method ] arrays
|
#
|
public
static
|
getTraitProperty(ReflectionClass<object> $class, string $propertyName): ?ReflectionProperty
Get the trait property inserted into a class with the given name
Get the trait property inserted into a class with the given name
|
#
|
public
static
|
getTraitConstant(ReflectionClass<object> $class, string $constantName): ?ReflectionClassConstant
Get the trait constant inserted into a class with the given name
Get the trait constant inserted into a class with the given name
|
#
|
public
static
|
getAllProperties(ReflectionClass<object> $class): ReflectionProperty[]
Get the properties of a class, including private parent properties
Get the properties of a class, including private parent properties
|
#
|
public
static
|
getAcceptedTypes(
ReflectionFunctionAbstract|callable $function,
bool $skipBuiltins = false,
int $param = 0,
): ($skipBuiltins is true ? array<class-string[]|class-string> : array<string[]|string>)
Get a list of types accepted by the given parameter of a function or
callable
Get a list of types accepted by the given parameter of a function or
callable
Throws
|
#
|
public
static
|
normaliseType(?ReflectionType $type): array<ReflectionNamedType[]|ReflectionNamedType>
Resolve a ReflectionType to an array of ReflectionNamedType instances
Resolve a ReflectionType to an array of ReflectionNamedType instances
PHP reflection methods like {@see ReflectionParameter::getType()} and
{@see ReflectionFunctionAbstract::getReturnType()} can return any of the
following:
- {@see ReflectionType} (until PHP 8)
- {@see ReflectionNamedType}
- {@see ReflectionUnionType} comprised of {@see ReflectionNamedType} (PHP
8+) and {@see ReflectionIntersectionType} (PHP 8.2+)
- {@see ReflectionIntersectionType} comprised of
{@see ReflectionNamedType} (PHP 8.1+)
-
null
This method normalises these to an array that represents an equivalent
union type, where each element is either:
- a {@see ReflectionNamedType} instance, or
- a list of {@see ReflectionNamedType} instances that represent an
intersection type
|
#
|
public
static
|
getTypes(?ReflectionType $type): ReflectionNamedType[]
Get the types in a ReflectionType
Get the types in a ReflectionType
|
#
|
public
static
|
getTypeNames(?ReflectionType $type): string[]
Get the name of each type in a ReflectionType
Get the name of each type in a ReflectionType
|
#
|
public
static
|
getConstants(ReflectionClass<object>|class-string $class): array<string, mixed>
Get the public constants of a class or interface, indexed by name
Get the public constants of a class or interface, indexed by name
|
#
|
public
static
|
getConstantsByValue(ReflectionClass<object>|class-string $class): array<int|string, string[]|string>
Get the public constants of a class or interface, indexed by value
Get the public constants of a class or interface, indexed by value
If the value of a constant is not an integer or string, it is ignored.
For any values used by multiple constants, an array is returned.
|
#
|
public
static
|
hasConstantWithValue(ReflectionClass<object>|class-string $class, mixed $value): bool
Check if a class or interface has a public constant with the given value
Check if a class or interface has a public constant with the given value
|
#
|
public
static
|
getConstantName(ReflectionClass<object>|class-string $class, mixed $value): string
Get the name of a public constant with the given value from a class or
interface
Get the name of a public constant with the given value from a class or
interface
Throws
|
#
|
public
static
|
getConstantValue(ReflectionClass<object>|class-string $class, string $name, bool $ignoreCase = false): mixed
Get the value of a public constant with the given name from a class or
interface
Get the value of a public constant with the given name from a class or
interface
Throws
|
#
|