The readonly keyword in a promoted parameter is not taken into account by the extractor.
Steps To Reproduce
This piece of code:
$file = PhpFile::fromCode(<<<XX
<?php
class Test {
public function __construct(private readonly string \$foo)
{
}
}
XX);
$printer = new PsrPrinter();
echo $printer->printFile($file);
Prints:
<?php
class Test
{
public function __construct(private string $foo)
{
}
}
The readonly keyword disappeared.
Expected Behavior
The expected result is:
<?php
class Test
{
public function __construct(private readonly string $foo)
{
}
}
The readonly keyword has been passed thru the extractor as expected.
Version: 4.0.1
Bug Description
The readonly keyword in a promoted parameter is not taken into account by the extractor.
Steps To Reproduce
This piece of code:
Prints:
The
readonly
keyword disappeared.Expected Behavior
The expected result is:
The
readonly
keyword has been passed thru the extractor as expected.Possible Solution
I have ready a solution in a PR