Total Complexity | 5 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | final class ReflectorHelper |
||
25 | { |
||
26 | /** |
||
27 | * @param ReflectionClass<object> $class |
||
28 | * |
||
29 | * @return array<array-key, ReflectionClass<object>> |
||
|
|||
30 | */ |
||
31 | 49 | public static function getClassAncestry(ReflectionClass $class): array |
|
32 | { |
||
33 | 49 | $ancestry = [$class]; |
|
34 | 49 | while ($class = $class->getParentClass()) { |
|
35 | 8 | $ancestry[] = $class; |
|
36 | } |
||
37 | |||
38 | 49 | return array_reverse($ancestry); |
|
39 | } |
||
40 | |||
41 | /** |
||
42 | * @param ReflectionMethod $method |
||
43 | * |
||
44 | * @return array<array-key, ReflectionClass<object>|ReflectionMethod> |
||
45 | */ |
||
46 | 47 | public static function getMethodAncestry(ReflectionMethod $method): array |
|
52 | } |
||
53 | |||
54 | /** |
||
55 | * @param ReflectionClass<object>|ReflectionMethod $proband |
||
56 | * |
||
57 | * @return array<array-key, ReflectionClass<object>|ReflectionMethod> |
||
58 | */ |
||
59 | 49 | public static function getAncestry(ReflectionClass|ReflectionMethod $proband): array |
|
64 | } |
||
65 | } |
||
66 |