bug75186.phpt 492 B

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