mirror of
https://github.com/php/php-src.git
synced 2025-01-08 20:17:28 +08:00
30 lines
554 B
PHP
30 lines
554 B
PHP
--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===
|