ClassReflection

Class
Final: Yes

Centralizes small reflection lookups used by DevTools runtime metadata.

Description

This helper keeps command discovery code focused on command behavior instead of raw reflection boilerplate.

Table of Contents

Methods

getAttributeArguments()

Returns the first matching attribute arguments normalized by constructor parameter name.

 : array<string, mixed>|null
isInstantiableSubclassOf()

Detects whether a class can be instantiated as a subclass of another class.

 : bool
Methods

getAttributeArguments()

Public Static

Returns the first matching attribute arguments normalized by constructor parameter name.

public static getAttributeArguments( class-string  $className, class-string  $attributeClass) : array<string, mixed>|null

Description

Positional arguments are mapped to their constructor parameter names so callers do not need to understand how the attribute was declared at the call site.

Parameters
$className : class-string

Description

the class being inspected

$attributeClass : class-string

Description

the attribute class being read

Return values
array<string, mixed>|null

Description

the normalized argument map, or null when the attribute is absent

isInstantiableSubclassOf()

Public Static

Detects whether a class can be instantiated as a subclass of another class.

public static isInstantiableSubclassOf( class-string  $className, class-string  $parentClass) : bool
Parameters
$className : class-string

Description

the class being inspected

$parentClass : class-string

Description

the required parent class or interface

Return values
bool

Description

true when the class is instantiable and extends or implements the expected parent