Annotation of embedaddon/php/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Reflection::getClosureScopeClass()
3: --SKIPIF--
4: <?php
5: if (!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);
13: var_dump($rf->getClosureScopeClass());
14:
15: Class 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);
23: var_dump($rf->getClosureScopeClass());
24: echo "Done!\n";
25: --EXPECTF--
26: NULL
27: object(ReflectionClass)#%d (1) {
28: ["name"]=>
29: string(1) "A"
30: }
31: Done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>