Skip to content

ReflectionParameter::__toString should return FQCN symbols #9447

Closed
@nicolas-grekas

Description

@nicolas-grekas

Description

The following code:

namespace App;

class Foo
{
    public function baz(string $arg = new Foo() . Foo::BAR)
    {
    }
}

$r = new \ReflectionMethod(Foo::class, 'baz');

echo $r->getParameters()[0];

Resulted in this output:

Parameter #0 [ <optional> string $arg = new \App\Foo() . App\Foo::BAR ]

But I expected this output instead:

Parameter #0 [ <optional> string $arg = new \App\Foo() . \App\Foo::BAR ]

Originally reported at doctrine/common#983

PHP Version

8.1+

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions