Skip to content

Commit 3ddb387

Browse files
committed
Add invokable test
1 parent 3dcc430 commit 3ddb387

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
}

0 commit comments

Comments
 (0)