class ClassMetadataCache

Properties

static protected ReflectionClass<object>> $classes
static protected ReflectionMethod>> $methods
static protected array<class-string, array<string, mixed>> $defaultProperties
static protected ReflectionProperty>> $properties
static protected ReflectionProperty>> $allProperties
static protected array<class-string, array<class-string, true>> $traits
static protected CachedClassAttribute>> $attributes
static protected array<class-string, array<class-string, array<int, bool>>> $classAttributePresence
static protected array<class-string, array<string, array<class-string, bool>>> $propertyAttributePresence

Methods

static ReflectionClass
reflectClass(object|string $target)

Get the cached reflection class for the given class.

reflectMethod(object|string $target, string $method)

Get the cached reflection method for the given class and method.

static array
defaultProperties(object|string $target)

Get the cached default properties for the given class.

static array
properties(object|string $target)

Get the cached properties for the given class.

static array
allProperties(object|string $target)

Get the cached properties for the given class, followed by the private properties its parents declare.

static bool
usesTrait(object|string $target, string $trait)

Determine if the class uses a trait directly, through another trait or through a parent.

static CachedClassAttribute|null
getAttribute(object|string $target, string $attributeClass)

Get the cached class attribute metadata for the given class.

static bool
hasClassAttribute(object|string $target, string $attributeClass, bool $ascend = false)

Determine if the given class has the given attribute, optionally checking its parents.

static bool
hasPropertyAttribute(ReflectionProperty $property, string $attributeClass)

Determine if the given property has the given concrete property attribute.

static array
resolveTraits(ReflectionClass $reflection)

Collect the traits used by a class and its parents.

static CachedClassAttribute|null
resolveAttribute(string $class, string $attributeClass)

Resolve the class attribute metadata for the given class.

static string
className(object|string $target)

Get the class name for the given target.

static void
flushState()

Flush all static state.

Details

at line 68
static ReflectionClass reflectClass(object|string $target)

Get the cached reflection class for the given class.

Parameters

object|string $target

Return Value

ReflectionClass

Exceptions

ReflectionException

at line 82
static ReflectionMethod reflectMethod(object|string $target, string $method)

Get the cached reflection method for the given class and method.

Parameters

object|string $target
string $method

Return Value

ReflectionMethod

Exceptions

ReflectionException

at line 98
static array defaultProperties(object|string $target)

Get the cached default properties for the given class.

Parameters

object|string $target

Return Value

array

Exceptions

ReflectionException

at line 114
static array properties(object|string $target)

Get the cached properties for the given class.

Parameters

object|string $target

Return Value

array

Exceptions

ReflectionException

at line 133
static array allProperties(object|string $target)

Get the cached properties for the given class, followed by the private properties its parents declare.

Reflection omits a parent's private properties from the class's properties, though every instance of the class holds them.

Parameters

object|string $target

Return Value

array

Exceptions

ReflectionException

at line 160
static bool usesTrait(object|string $target, string $trait)

Determine if the class uses a trait directly, through another trait or through a parent.

Parameters

object|string $target
string $trait

Return Value

bool

Exceptions

ReflectionException

at line 176
static CachedClassAttribute|null getAttribute(object|string $target, string $attributeClass)

Get the cached class attribute metadata for the given class.

Parameters

object|string $target
string $attributeClass

Return Value

CachedClassAttribute|null

Exceptions

ReflectionException

at line 199
static bool hasClassAttribute(object|string $target, string $attributeClass, bool $ascend = false)

Determine if the given class has the given attribute, optionally checking its parents.

Parameters

object|string $target
string $attributeClass
bool $ascend

Return Value

bool

Exceptions

ReflectionException

at line 225
static bool hasPropertyAttribute(ReflectionProperty $property, string $attributeClass)

Determine if the given property has the given concrete property attribute.

Parameters

ReflectionProperty $property
string $attributeClass

Return Value

bool

at line 252
static protected array resolveTraits(ReflectionClass $reflection)

Collect the traits used by a class and its parents.

Parameters

ReflectionClass $reflection

Return Value

array

at line 272
static protected CachedClassAttribute|null resolveAttribute(string $class, string $attributeClass)

Resolve the class attribute metadata for the given class.

Parameters

string $class
string $attributeClass

Return Value

CachedClassAttribute|null

at line 309
static protected string className(object|string $target)

Get the class name for the given target.

Parameters

object|string $target

Return Value

string

at line 317
static void flushState()

Flush all static state.

Return Value

void