summaryrefslogtreecommitdiff
path: root/ext/reflection/tests/default_value_internal_userland_arginfo.phpt
blob: b55a9463791b0f18f61b630ff0bf9f05132325b4 (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
--TEST--
Fetching default value of an internal trampoline function with userland arginfo
--FILE--
<?php
$closure = function ($b = 0) {};
$ro = new ReflectionObject($closure);
$rm = $ro->getMethod('__invoke');
echo $rm, "\n";

$rp = $rm->getParameters()[0];
var_dump($rp->isDefaultValueAvailable());
try {
    var_dump($rp->getDefaultValue());
} catch (ReflectionException $e) {
    echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Method [ <internal> public method __invoke ] {

  - Parameters [1] {
    Parameter #0 [ <optional> $b = <default> ]
  }
}

bool(false)
Internal error: Failed to retrieve the default value