class Reflector

Methods

static bool
isCallable(mixed $var, bool $syntaxOnly = false)

This is a PHP 7.4 compatible implementation of is_callable.

static object|null
getClassAttribute(object|string $objectOrClass, string $attribute, bool $ascend = false)

Get the specified class attribute, optionally following an inheritance chain.

static Collection
getClassAttributes(object|string $objectOrClass, string $attribute, bool $includeParents = false)

Get the specified class attribute(s), optionally following an inheritance chain.

static string|null
getParameterClassName(ReflectionParameter $parameter)

Get the class name of the given parameter's type, if possible.

static array
getParameterClassNames(ReflectionParameter $parameter)

Get the class names of the given parameter's type, including union types.

static string
getTypeName(ReflectionParameter $parameter, ReflectionNamedType $type)

Get the given type's class name.

static bool
isParameterSubclassOf(ReflectionParameter $parameter, string $className)

Determine if the parameter's type is a subclass of the given type.

static bool
isParameterBackedEnumWithStringBackingType(ReflectionParameter $parameter)

Determine if the parameter's type is a Backed Enum with a string backing type.

Details

at line 20
static bool isCallable(mixed $var, bool $syntaxOnly = false)

This is a PHP 7.4 compatible implementation of is_callable.

Parameters

mixed $var
bool $syntaxOnly

Return Value

bool

at line 70
static object|null getClassAttribute(object|string $objectOrClass, string $attribute, bool $ascend = false)

Get the specified class attribute, optionally following an inheritance chain.

Parameters

object|string $objectOrClass
string $attribute
bool $ascend

Return Value

object|null

at line 87
static Collection getClassAttributes(object|string $objectOrClass, string $attribute, bool $includeParents = false)

Get the specified class attribute(s), optionally following an inheritance chain.

Parameters

object|string $objectOrClass
string $attribute
bool $includeParents

Return Value

Collection

Exceptions

ReflectionException

at line 106
static string|null getParameterClassName(ReflectionParameter $parameter)

Get the class name of the given parameter's type, if possible.

Parameters

ReflectionParameter $parameter

Return Value

string|null

at line 120
static array getParameterClassNames(ReflectionParameter $parameter)

Get the class names of the given parameter's type, including union types.

Parameters

ReflectionParameter $parameter

Return Value

array

at line 144
static protected string getTypeName(ReflectionParameter $parameter, ReflectionNamedType $type)

Get the given type's class name.

Parameters

ReflectionParameter $parameter
ReflectionNamedType $type

Return Value

string

at line 164
static bool isParameterSubclassOf(ReflectionParameter $parameter, string $className)

Determine if the parameter's type is a subclass of the given type.

Parameters

ReflectionParameter $parameter
string $className

Return Value

bool

at line 176
static bool isParameterBackedEnumWithStringBackingType(ReflectionParameter $parameter)

Determine if the parameter's type is a Backed Enum with a string backing type.

Parameters

ReflectionParameter $parameter

Return Value

bool