We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ddd37f0 commit 608a22eCopy full SHA for 608a22e
Zend/tests/partial_function/closures.phpt
@@ -0,0 +1,28 @@
1
+--TEST--
2
+Converting partials to closures.
3
+--FILE--
4
+<?php
5
+
6
+function volume(int $x, int $y, int $z): int {
7
+ return $x * $y * $z;
8
+}
9
10
+$p = volume(3, 5, ?);
11
12
+// This is a useful and common way to normalize different types of callable
13
+// to a single API for reflection purposes.
14
+$c = Closure::fromCallable($p);
15
+$ref = new ReflectionFunction($c);
16
17
+print $ref->getNumberOfParameters() . PHP_EOL;
18
+print $ref->getParameters()[0]->getType() . PHP_EOL;
19
+print $ref->getParameters()[0]->getName() . PHP_EOL;
20
21
+print $ref->getReturnType() . PHP_EOL;
22
23
+?>
24
+--EXPECTF--
25
+1
26
+int
27
+z
28
0 commit comments