Annotation of embedaddon/php/ext/reflection/tests/bug52057.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #52057 (ReflectionClass fails on Closure class)
3: --FILE--
4: <?php
5:
6: $closure = function($a) { echo $a; };
7:
8: $reflection = new ReflectionClass('closure');
9: var_dump($reflection->hasMethod('__invoke')); // true
10:
11: $reflection = new ReflectionClass($closure);
12: var_dump($reflection->hasMethod('__invoke')); // true
13:
14: $reflection = new ReflectionObject($closure);
15: var_dump($reflection->hasMethod('__invoke')); // true
16:
17: $reflection = new ReflectionClass('closure');
18: var_dump($h = $reflection->getMethod('__invoke')); // true
19: var_dump($h->class.'::'.$h->getName());
20:
21: $reflection = new ReflectionClass($closure);
22: var_dump($h = $reflection->getMethod('__invoke')); // true
23: var_dump($h->class.'::'.$h->getName());
24:
25: $reflection = new ReflectionObject($closure);
26: var_dump($h = $reflection->getMethod('__invoke')); // true
27: var_dump($h->class.'::'.$h->getName());
28:
29: ?>
30: --EXPECTF--
31: bool(true)
32: bool(true)
33: bool(true)
34: object(ReflectionMethod)#%d (2) {
35: ["name"]=>
36: string(8) "__invoke"
37: ["class"]=>
38: string(7) "Closure"
39: }
40: string(17) "Closure::__invoke"
41: object(ReflectionMethod)#%d (2) {
42: ["name"]=>
43: string(8) "__invoke"
44: ["class"]=>
45: string(7) "Closure"
46: }
47: string(17) "Closure::__invoke"
48: object(ReflectionMethod)#%d (2) {
49: ["name"]=>
50: string(8) "__invoke"
51: ["class"]=>
52: string(7) "Closure"
53: }
54: string(17) "Closure::__invoke"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>