Reflector
Reflector is the base interface that all PHP Reflection classes implement. It declares __toString(), providing a common type for all reflection objects.
All reflection classes, ReflectionClass, ReflectionMethod, ReflectionFunction, ReflectionProperty, ReflectionParameter, etc., implement this interface, allowing code to accept any reflector generically.
<?php
function describeReflector(Reflector $r): void {
echo (string) $r . PHP_EOL;
}
describeReflector(new ReflectionClass(DateTime::class));
describeReflector(new ReflectionFunction('array_map'));
?>