-
Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy pathclosure_065.phpt
88 lines (74 loc) · 2.16 KB
/
closure_065.phpt
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
--TEST--
The closure name includes the source location (2)
--FILE--
<?php
namespace NameSpaceName {
class ClassName {
public function methodName() {
$c = function () {};
$r = new \ReflectionFunction($c);
var_dump($r->name);
}
public function nestedClosure() {
$c = function () {
$c = function () {
$c = function () {};
$r = new \ReflectionFunction($c);
var_dump($r->name);
};
$c();
};
$c();
}
}
function function_name() {
$c = function () { };
$r = new \ReflectionFunction($c);
var_dump($r->name);
}
}
namespace {
class ClassName {
public function methodName() {
$c = function () {};
$r = new \ReflectionFunction($c);
var_dump($r->name);
}
public function nestedClosure() {
$c = function () {
$c = function () {
$c = function () {};
$r = new \ReflectionFunction($c);
var_dump($r->name);
};
$c();
};
$c();
}
}
function function_name() {
$c = function () { };
$r = new \ReflectionFunction($c);
var_dump($r->name);
}
$class = new \NameSpaceName\ClassName();
$class->methodName();
$class->nestedClosure();
\NameSpaceName\function_name();
$class = new \ClassName();
$class->methodName();
$class->nestedClosure();
\function_name();
$c = function () { };
$r = new \ReflectionFunction($c);
var_dump($r->name);
}
?>
--EXPECTF--
string(49) "{closure:NameSpaceName\ClassName::methodName():6}"
string(79) "{closure:{closure:{closure:NameSpaceName\ClassName::nestedClosure():12}:13}:14}"
string(42) "{closure:NameSpaceName\function_name():27}"
string(36) "{closure:ClassName::methodName():36}"
string(65) "{closure:{closure:{closure:ClassName::nestedClosure():42}:43}:44}"
string(28) "{closure:function_name():57}"
string(%d) "{closure:%sclosure_%d.php:72}"