blob: e8b080f5cbbbbc4a44246952b9bc76d0599a0a2e (
plain)
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
|
--TEST--
Reflection on invokable objects
--FILE--
<?php
class Test {
function __invoke($a, $b = 0) { }
}
$rm = new ReflectionMethod(new Test, '__invoke');
var_dump($rm->getName());
var_dump($rm->getNumberOfParameters());
var_dump($rm->getNumberOfRequiredParameters());
$rp = new ReflectionParameter(array(new Test, '__invoke'), 0);
var_dump($rp->isOptional());
$rp = new ReflectionParameter(array(new Test, '__invoke'), 1);
var_dump($rp->isOptional());
?>
===DONE===
--EXPECTF--
string(8) "__invoke"
int(2)
int(1)
bool(false)
bool(true)
===DONE===
|