1--TEST--
2ReflectionNamedType::getName() and ReflectionNamedType::__toString()
3--FILE--
4<?php
5
6function testInternalTypes(?Traversable $traversable): ?string {
7	return 'test';
8}
9
10function testUserDefinedTypes(?Test $traversable): ?Test {
11	return new Test;
12}
13
14$function = new ReflectionFunction('testInternalTypes');
15$type = $function->getParameters()[0]->getType();
16$return = $function->getReturnType();
17
18var_dump($type->getName());
19var_dump((string) $type);
20var_dump($return->getName());
21var_dump((string) $return);
22
23$function = new ReflectionFunction('testUserDefinedTypes');
24$type = $function->getParameters()[0]->getType();
25$return = $function->getReturnType();
26
27var_dump($type->getName());
28var_dump((string) $type);
29var_dump($return->getName());
30var_dump((string) $return);
31
32?>
33--EXPECT--
34string(11) "Traversable"
35string(11) "Traversable"
36string(6) "string"
37string(6) "string"
38string(4) "Test"
39string(4) "Test"
40string(4) "Test"
41string(4) "Test"
42