2011-09-07 06:46:27 +00:00
|
|
|
--TEST--
|
|
|
|
Reflection::getClosureScopeClass()
|
2018-02-03 05:05:55 +00:00
|
|
|
--FILE--
|
2011-09-07 06:46:27 +00:00
|
|
|
<?php
|
|
|
|
$closure = function($param) { return "this is a closure"; };
|
|
|
|
$rf = new ReflectionFunction($closure);
|
|
|
|
var_dump($rf->getClosureScopeClass());
|
|
|
|
|
|
|
|
Class A {
|
|
|
|
public static function getClosure() {
|
|
|
|
return function($param) { return "this is a closure"; };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$closure = A::getClosure();
|
|
|
|
$rf = new ReflectionFunction($closure);
|
|
|
|
var_dump($rf->getClosureScopeClass());
|
|
|
|
echo "Done!\n";
|
2018-02-03 05:05:55 +00:00
|
|
|
?>
|
2011-09-07 06:46:27 +00:00
|
|
|
--EXPECTF--
|
|
|
|
NULL
|
|
|
|
object(ReflectionClass)#%d (1) {
|
|
|
|
["name"]=>
|
|
|
|
string(1) "A"
|
|
|
|
}
|
|
|
|
Done!
|