Conditions | 3 |
Paths | 2 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public static function firstParameterType(callable $callable): string |
||
13 | { |
||
14 | $reflection = is_object($callable) |
||
15 | ? (new ReflectionObject($callable))->getMethod('__invoke') |
||
16 | : new ReflectionFunction($callable); |
||
17 | |||
18 | $parameters = $reflection->getParameters(); |
||
19 | |||
20 | $parameterTypes = array_map(function (ReflectionParameter $parameter) { |
||
21 | return $parameter->getClass() ? $parameter->getClass()->name : null; |
||
22 | }, $parameters); |
||
23 | |||
24 | return $parameterTypes[0] ?? ''; |
||
25 | } |
||
26 | |||
36 |