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