1--TEST--
2Testing Closure::fromCallable() functionality: Reflection
3--FILE--
4<?php
5
6class Bar {
7    public static function staticMethod(Bar $bar, int $int, $none) {}
8    public static function instanceMethod(Bar $bar, int $int, $none) {}
9}
10
11function foo(Bar $bar, int $int, $none) {
12
13}
14
15$fn = function (Bar $bar, int $x, $none) {};
16$bar = new Bar();
17
18$callables = [
19    'foo',
20    $fn,
21    'Bar::staticMethod',
22    [$bar, 'instanceMethod']
23];
24
25
26foreach ($callables as $callable) {
27    $closure = Closure::fromCallable($callable);
28    $refl = new ReflectionFunction($closure);
29    foreach ($refl->getParameters() as $param) {
30        if ($param->hasType()) {
31            $type = $param->getType();
32            echo $type->getName() . "\n";
33        }
34    }
35}
36
37?>
38--EXPECT--
39Bar
40int
41Bar
42int
43Bar
44int
45Bar
46int
47