Documentation

Reflection
in package
uses StaticClass

FinalYes

PHP reflection helpers.

Table of Contents

Methods

__callStatic()  : mixed
Call to undefined static method.
areCommentsAvailable()  : bool
Finds out if reflection has access to PHPdoc comments. Comments may not be available due to the opcode cache.
expandClassName()  : string
Expands the name of the class to full name in the given context of given class.
getMethodDeclaringMethod()  : ReflectionMethod
Returns a reflection of a method that contains a declaration of $method.
getParameterDefaultValue()  : mixed
getPropertyDeclaringClass()  : ReflectionClass
Returns a reflection of a class or trait that contains a declaration of given property. Property can also be declared in the trait.
getUseStatements()  : array<string, class-string>
isBuiltinType()  : bool
isClassKeyword()  : bool
toString()  : string
__construct()  : mixed
Class is static and cannot be instantiated.
fetch()  : string|null
parseUseStatements()  : array<string|int, mixed>
Parses PHP code to [class => [alias => class, ...]]

Methods

__callStatic()

Call to undefined static method.

public static __callStatic(string $name, array<string|int, mixed> $args) : mixed
Parameters
$name : string
$args : array<string|int, mixed>
Tags
throws
MemberAccessException

areCommentsAvailable()

Finds out if reflection has access to PHPdoc comments. Comments may not be available due to the opcode cache.

public static areCommentsAvailable() : bool
Return values
bool

expandClassName()

Expands the name of the class to full name in the given context of given class.

public static expandClassName(string $name, ReflectionClass $context) : string

Thus, it returns how the PHP parser would understand $name if it were written in the body of the class $context.

Parameters
$name : string
$context : ReflectionClass
Tags
throws
InvalidArgumentException
Return values
string

getMethodDeclaringMethod()

Returns a reflection of a method that contains a declaration of $method.

public static getMethodDeclaringMethod(ReflectionMethod $method) : ReflectionMethod

Usually, each method is its own declaration, but the body of the method can also be in the trait and under a different name.

Parameters
$method : ReflectionMethod
Return values
ReflectionMethod

getParameterDefaultValue()

public static getParameterDefaultValue(ReflectionParameter $param) : mixed

use native ReflectionParameter::getDefaultValue()

Parameters
$param : ReflectionParameter

getPropertyDeclaringClass()

Returns a reflection of a class or trait that contains a declaration of given property. Property can also be declared in the trait.

public static getPropertyDeclaringClass(ReflectionProperty $prop) : ReflectionClass
Parameters
$prop : ReflectionProperty
Return values
ReflectionClass

getUseStatements()

public static getUseStatements(ReflectionClass $class) : array<string, class-string>
Parameters
$class : ReflectionClass
Return values
array<string, class-string>

of [alias => class]

isBuiltinType()

public static isBuiltinType(string $type) : bool

use Nette\Utils\Validators::isBuiltinType()

Parameters
$type : string
Return values
bool

isClassKeyword()

public static isClassKeyword(string $name) : bool

use Nette\Utils\Validators::isClassKeyword()

Parameters
$name : string
Return values
bool

toString()

public static toString(Reflector $ref) : string
Parameters
$ref : Reflector
Return values
string

__construct()

Class is static and cannot be instantiated.

private __construct() : mixed

fetch()

private static fetch(array<string|int, mixed> &$tokens, string|int|array<string|int, mixed> $take) : string|null
Parameters
$tokens : array<string|int, mixed>
$take : string|int|array<string|int, mixed>
Return values
string|null

parseUseStatements()

Parses PHP code to [class => [alias => class, ...]]

private static parseUseStatements(string $code[, string|null $forClass = null ]) : array<string|int, mixed>
Parameters
$code : string
$forClass : string|null = null
Return values
array<string|int, mixed>

        
On this page

Search results