class MethodCollectionService (View source)

Service for collecting methods and properties from entity hierarchies.

Extracted from AbstractClassCheck to enable reuse without inheritance.

Methods

array
collectPropertiesForClass(PHPClass $class, string $phpVersion)

Collect version-filtered stub properties from the full parent class chain.

array
collectForClass(PHPClass $class, string $phpVersion)

Collect version-filtered stub methods from the full class hierarchy.

array
collectForEnum(PHPEnum $enum, string $phpVersion)

Collect version-filtered stub methods from an enum and its implemented interface chain.

array
collectForInterface(PHPInterface $interface, string $phpVersion)

Collect version-filtered stub methods from an interface and its full parent interface chain.

void
collectMethodsFromClassLike(PHPClassLikeObject $entity, string $phpVersion, array $methodMap)

Add version-available methods from a single class-like entity to the map.

array
filterAndDeduplicateParams(array $params, string $phpVersion)

Filter parameters by version availability, then deduplicate consecutive same-named parameters where the second is variadic (the stub workaround for non-optional variadics).

void
collectMethodsFromInterfaceHierarchy(PHPInterface $interface, string $phpVersion, array $methodMap, array $visited)

Recursively collect methods from an interface and its parent interface chain.

Details

array collectPropertiesForClass(PHPClass $class, string $phpVersion)

Collect version-filtered stub properties from the full parent class chain.

Returns a map of property name -> PHPProperty. Child definitions win over parent.

Parameters

PHPClass $class
string $phpVersion

Return Value

array

array collectForClass(PHPClass $class, string $phpVersion)

Collect version-filtered stub methods from the full class hierarchy.

Child class definitions win over parent class definitions for the same effective name.

Traversal includes:

  • The class itself and its full parentClass chain
  • All implemented interfaces (and their parent interface chains) for each class in the hierarchy

Parameters

PHPClass $class
string $phpVersion

Return Value

array

array collectForEnum(PHPEnum $enum, string $phpVersion)

Collect version-filtered stub methods from an enum and its implemented interface chain.

Parameters

PHPEnum $enum
string $phpVersion

Return Value

array

array collectForInterface(PHPInterface $interface, string $phpVersion)

Collect version-filtered stub methods from an interface and its full parent interface chain.

Parameters

PHPInterface $interface
string $phpVersion

Return Value

array

void collectMethodsFromClassLike(PHPClassLikeObject $entity, string $phpVersion, array $methodMap)

Add version-available methods from a single class-like entity to the map.

Only inserts a name if not already present (first/child definition wins).

Strips PS_UNRESERVEPREFIX from method names so that e.g. PS_UNRESERVE_PREFIX_throw matches the reflection name "throw".

Parameters

PHPClassLikeObject $entity
string $phpVersion
array $methodMap

Return Value

void

array filterAndDeduplicateParams(array $params, string $phpVersion)

Filter parameters by version availability, then deduplicate consecutive same-named parameters where the second is variadic (the stub workaround for non-optional variadics).

Parameters

array $params
string $phpVersion

Return Value

array

void collectMethodsFromInterfaceHierarchy(PHPInterface $interface, string $phpVersion, array $methodMap, array $visited)

Recursively collect methods from an interface and its parent interface chain.

Parameters

PHPInterface $interface
string $phpVersion
array $methodMap
array $visited

Return Value

void