1--TEST--
2ReflectionMethod returns tentative return type information correctly
3--FILE--
4<?php
5
6class MyDateTimeZone extends DateTimeZone
7{
8    #[ReturnTypeWillChange]
9    public static function listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): string
10    {
11        return "";
12    }
13}
14
15function printInfo(ReflectionMethod $methodInfo) {
16    var_dump($methodInfo->hasReturnType());
17    var_dump($methodInfo->hasTentativeReturnType());
18    var_dump((string) $methodInfo->getReturnType());
19    var_dump((string) $methodInfo->getTentativeReturnType());
20    var_dump((string) $methodInfo);
21    echo "\n";
22}
23
24printInfo(new ReflectionMethod(DateTimeZone::class, 'listIdentifiers'));
25printInfo(new ReflectionMethod(MyDateTimeZone::class, 'listIdentifiers'));
26printInfo(new ReflectionMethod(FileSystemIterator::class, 'current'));
27
28?>
29--EXPECTF--
30bool(false)
31bool(true)
32string(0) ""
33string(5) "array"
34string(%d) "Method [ <internal:date> static public method listIdentifiers ] {
35
36  - Parameters [2] {
37    Parameter #0 [ <optional> int $timezoneGroup = DateTimeZone::ALL ]
38    Parameter #1 [ <optional> ?string $countryCode = null ]
39  }
40  - Tentative return [ array ]
41}
42"
43
44bool(true)
45bool(false)
46string(6) "string"
47string(0) ""
48string(%d) "Method [ <user, overwrites DateTimeZone, prototype DateTimeZone> static public method listIdentifiers ] {
49  @@ %s
50
51  - Parameters [2] {
52    Parameter #0 [ <optional> int $timezoneGroup = DateTimeZone::ALL ]
53    Parameter #1 [ <optional> ?string $countryCode = NULL ]
54  }
55  - Return [ string ]
56}
57"
58
59bool(false)
60bool(true)
61string(0) ""
62string(37) "SplFileInfo|FilesystemIterator|string"
63string(191) "Method [ <internal:SPL, overwrites DirectoryIterator, prototype Iterator> public method current ] {
64
65  - Parameters [0] {
66  }
67  - Tentative return [ SplFileInfo|FilesystemIterator|string ]
68}
69"
70