blob: ccb87254663d324adc6577ee389fcd3566fe7d8a (
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
30
31
32
33
|
--TEST--
ReflectionType possible types
--FILE--
<?php
$functions = [
function(): void {},
function(): int {},
function(): float {},
function(): string {},
function(): bool {},
function(): array {},
function(): callable {},
function(): iterable {},
function(): StdClass {}
];
foreach ($functions as $function) {
$reflectionFunc = new ReflectionFunction($function);
$returnType = $reflectionFunc->getReturnType();
var_dump($returnType->getName());
}
?>
--EXPECT--
string(4) "void"
string(3) "int"
string(5) "float"
string(6) "string"
string(4) "bool"
string(5) "array"
string(8) "callable"
string(8) "iterable"
string(8) "StdClass"
|