xref: /PHP-8.1/ext/reflection/tests/gh9447.phpt (revision 2cfb028e)
1--TEST--
2GH-9447: Invalid class FQN emitted by AST dump for new and class constants in constant expressions
3--FILE--
4<?php
5
6namespace App;
7
8use SomewhereElse\Qux;
9
10class Foo
11{
12    public function bar(
13        $a = Bar::BAZ,
14        $b = new Bar(),
15        $c = new parent(),
16        $d = new self(),
17        $e = new namespace\Bar(),
18        $f = new Qux(),
19        $g = new namespace\Qux(),
20        $i = new \Qux(),
21    ) {}
22}
23
24$r = new \ReflectionMethod(Foo::class, 'bar');
25
26foreach ($r->getParameters() as $p) {
27    echo $p, "\n";
28}
29
30?>
31--EXPECT--
32Parameter #0 [ <optional> $a = \App\Bar::BAZ ]
33Parameter #1 [ <optional> $b = new \App\Bar() ]
34Parameter #2 [ <optional> $c = new parent() ]
35Parameter #3 [ <optional> $d = new self() ]
36Parameter #4 [ <optional> $e = new \App\Bar() ]
37Parameter #5 [ <optional> $f = new \SomewhereElse\Qux() ]
38Parameter #6 [ <optional> $g = new \App\Qux() ]
39Parameter #7 [ <optional> $i = new \Qux() ]
40