summaryrefslogtreecommitdiff
path: root/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt
blob: f7cb6b36ec7b6c656cb8ee5ff1765a43cff8f117 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--TEST--
Reflection::getClosureScopeClass()
--FILE--
<?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";
?>
--EXPECTF--
NULL
object(ReflectionClass)#%d (1) {
  ["name"]=>
  string(1) "A"
}
Done!