File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Zend/tests/partial_application Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Partial application invokable
3
+ --FILE--
4
+ <?php
5
+
6
+ class C {
7
+ public function __invoke (int $ a , object $ b ): C {
8
+ var_dump ($ a , $ b );
9
+ return $ this ;
10
+ }
11
+ }
12
+
13
+ $ c = new C ();
14
+ $ f = $ c (?, ...);
15
+
16
+ echo (string ) new ReflectionFunction ($ f ), "\n" ;
17
+
18
+ $ f = $ c (?, new stdClass );
19
+
20
+ echo (string ) new ReflectionFunction ($ f ), "\n" ;
21
+
22
+ $ f (1 );
23
+
24
+ ?>
25
+ --EXPECTF--
26
+ Partial [ <user, prototype C> public method __invoke ] {
27
+ @@ %s.php 11 - 11
28
+
29
+ - Parameters [2] {
30
+ Parameter #0 [ <required> int $a ]
31
+ Parameter #1 [ <required> object $b ]
32
+ }
33
+ - Return [ C ]
34
+ }
35
+
36
+ Partial [ <user, prototype C> public method __invoke ] {
37
+ @@ %s.php 15 - 15
38
+
39
+ - Parameters [1] {
40
+ Parameter #0 [ <required> int $a ]
41
+ }
42
+ - Return [ C ]
43
+ }
44
+
45
+ int(1)
46
+ object(stdClass)#%d (0) {
47
+ }
You can’t perform that action at this time.
0 commit comments