MethodCollectionService
class MethodCollectionService (View source)
Service for collecting methods and properties from entity hierarchies.
Extracted from AbstractClassCheck to enable reuse without inheritance.
Methods
Collect version-filtered stub properties from the full parent class chain.
Collect version-filtered stub methods from the full class hierarchy.
Collect version-filtered stub methods from an enum and its implemented interface chain.
Collect version-filtered stub methods from an interface and its full parent interface chain.
Add version-available methods from a single class-like entity to the map.
Filter parameters by version availability, then deduplicate consecutive same-named parameters where the second is variadic (the stub workaround for non-optional variadics).
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.
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
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.
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".
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.