xref: /PHP-8.3/ext/reflection/tests/bug75186.phpt (revision 35c80583)
1--TEST--
2Bug #75186: Inconsistent reflection of Closure:::__invoke()
3--FILE--
4<?php
5
6$rc = new ReflectionClass(Closure::class);
7foreach ($rc->getMethods() as $method) {
8    if ($method->name == '__invoke') {
9        var_dump($method);
10        $method->invoke(
11            function($what) { echo "Hello $what!\n"; },
12            "World"
13        );
14    }
15}
16
17?>
18--EXPECTF--
19object(ReflectionMethod)#%d (2) {
20  ["name"]=>
21  string(8) "__invoke"
22  ["class"]=>
23  string(7) "Closure"
24}
25Hello World!
26