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