ReflectionFunction_getClosureScopeClass.phpt 539 B

1234567891011121314151617181920212223242526
  1. --TEST--
  2. Reflection::getClosureScopeClass()
  3. --FILE--
  4. <?php
  5. $closure = function($param) { return "this is a closure"; };
  6. $rf = new ReflectionFunction($closure);
  7. var_dump($rf->getClosureScopeClass());
  8. Class A {
  9. public static function getClosure() {
  10. return function($param) { return "this is a closure"; };
  11. }
  12. }
  13. $closure = A::getClosure();
  14. $rf = new ReflectionFunction($closure);
  15. var_dump($rf->getClosureScopeClass());
  16. echo "Done!\n";
  17. ?>
  18. --EXPECTF--
  19. NULL
  20. object(ReflectionClass)#%d (1) {
  21. ["name"]=>
  22. string(1) "A"
  23. }
  24. Done!