File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ ReflectionFunction::__toString() with bound variables
3+ --FILE--
4+ <?php
5+
6+ $ closure_without_bounds = fn () => 0 ;
7+
8+ $ rf = new ReflectionFunction ($ closure_without_bounds );
9+ echo (string ) $ rf ;
10+
11+ $ global = "" ;
12+ $ closure_with_bounds = function () use ($ global ) {
13+ static $ counter = 0 ;
14+ return $ counter ++;
15+ };
16+
17+ $ rf = new ReflectionFunction ($ closure_with_bounds );
18+ echo (string ) $ rf ;
19+
20+ ?>
21+ --EXPECTF--
22+ Closure [ <user> function {closure:%s:%d} ] {
23+ @@ %sReflectionFunction__toString_bound_variables.php 3 - 3
24+ }
25+ Closure [ <user> function {closure:%s:%d} ] {
26+ @@ %sReflectionFunction__toString_bound_variables.php 9 - 12
27+
28+ - Bound Variables [2] {
29+ Variable #0 [ $global ]
30+ Variable #1 [ $counter ]
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments