prettier / prettier/plugin-php
Unexpected syntax error with multi-level scope resolution
Open
Nobody has claimed this yet.
bug
upstream
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
@prettier/plugin-php v0.19.4
Playground link
Input:
<?php
enum Bar: int {
case test = 42;
}
class Foo
{
const BarInFoo = Bar::test;
}
print Foo::BarInFoo::class; //Prints Bar
?>
Output:
Parse Error : syntax error, unexpected '::' (T_DOUBLE_COLON) on line 11
9 | }
10 |
> 11 | print Foo::BarInFoo::class; //Prints Bar
| ^
12 | ?>
Expected behavior:
No error reported.
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
Reproduce the syntax error using the linked Playground example and the provided PHP input. Trace how the plugin parses the chained Foo::BarInFoo::class expression, then add regression coverage for the expected successful parse and verify that no error is reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100