Reflection
final class Reflection
PHP reflection helpers.
Constants
private BUILTIN_TYPES |
|
private CLASS_KEYWORDS |
|
Methods
Determines if type is PHP built-in type. Otherwise, it is the class name.
Determines if type is special class name self/parent/static.
Returns the type of return value of given function or method and normalizes self
, static
, and parent
to actual class names.
Returns the type of given parameter and normalizes self
and parent
to the actual class names.
Returns the type of given property and normalizes self
and parent
to the actual class names.
Returns a reflection of a class or trait that contains a declaration of given property. Property can also be declared in the trait.
Returns a reflection of a method that contains a declaration of $method.
Finds out if reflection has access to PHPdoc comments. Comments may not be available due to the opcode cache.
Expands the name of the class to full name in the given context of given class.
Details
at line 36
static bool
isBuiltinType(string $type)
Determines if type is PHP built-in type. Otherwise, it is the class name.
at line 45
static bool
isClassKeyword(string $name)
Determines if type is special class name self/parent/static.
at line 55
static Type|null
getReturnType(ReflectionFunctionAbstract $func)
Returns the type of return value of given function or method and normalizes self
, static
, and parent
to actual class names.
If the function does not have a return type, it returns null.
at line 65
static Type|null
getParameterType(ReflectionParameter $param)
Returns the type of given parameter and normalizes self
and parent
to the actual class names.
If the parameter does not have a type, it returns null.
at line 75
static Type|null
getPropertyType(ReflectionProperty $prop)
Returns the type of given property and normalizes self
and parent
to the actual class names.
If the property does not have a type, it returns null.
at line 84
static mixed
getParameterDefaultValue(ReflectionParameter $param)
deprecated
deprecated
No description
at line 118
static ReflectionClass
getPropertyDeclaringClass(ReflectionProperty $prop)
Returns a reflection of a class or trait that contains a declaration of given property. Property can also be declared in the trait.
at line 137
static ReflectionMethod
getMethodDeclaringMethod(ReflectionMethod $method)
Returns a reflection of a method that contains a declaration of $method.
Usually, each method is its own declaration, but the body of the method can also be in the trait and under a different name.
at line 172
static bool
areCommentsAvailable()
Finds out if reflection has access to PHPdoc comments. Comments may not be available due to the opcode cache.
at line 179
static string
toString(Reflector $ref)
No description
at line 202
static string
expandClassName(string $name, ReflectionClass $context)
Expands the name of the class to full name in the given context of given class.
Thus, it returns how the PHP parser would understand $name if it were written in the body of the class $context.
at line 239
static array
getUseStatements(ReflectionClass $class)
No description
Traits
Static class.