prettier / prettier/plugin-php
Syntax error anonymous readonly class
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
@prettier/plugin-php v0.24.0
Playground link
Input:
<?php
abstract readonly class Foo {
public function bar() {
echo 'bar';
}
}
$foo = new readonly class extends Foo{};
echo $foo->bar();
Output:
Parse Error : syntax error, unexpected 'readonly' (T_READ_ONLY) on line 9
7 | }
8 |
> 9 | $foo = new readonly class extends Foo{};
| ^
10 | echo $foo->bar();
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Playground reproduction and compare how the PHP plugin handles new readonly class extends Foo{}. Trace the parser or formatter entry point reached by this input and add or run a focused reproduction; the work is done when the input no longer produces the reported syntax error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100