prettier / prettier/plugin-php
PHP 8.5 not supported?
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
With PHP 8.5 the new pipe operator has been introduced.
Unfortunately it seems that prettier/plugin-php isn't able to format correctly and throws an error.
I have PHP 8.5 installed and I don't use composer, just plain old PHP.
2026-01-29T12:14:37+01:00 ERROR [project::lsp_store] Formatting failed: default prettier instance failed to format buffer: SyntaxError: Parse Error : syntax error, unexpected '>' on line 137
135 | {
136 | return array_map(fn($part) => trim($part, DIRECTORY_SEPARATOR), $parts)
> 137 | |> fn(array $paths) => implode(DIRECTORY_SEPARATOR, $paths)
| ^
138 | |> fn(string $path) => preg_replace("#" . DIRECTORY_SEPARATOR . "+#", DIRECTORY_SEPARATOR, $path);
139 | }
140 | }
While handling prettier request: {"jsonrpc":"2.0","id":3,"method":"prettier/format","params":{"text":"..snip..","options":{"plugins":[".../Zed/prettier/node_modules/@prettier/plugin-php/standalone.js"],"parser":"php","filepath":"some filepath","prettierOptions":{"tabWidth":2,"printWidth":100,"useTabs":false,"phpVersion":"auto"},"ignorePath":null}}}
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 failure with prettier/plugin-php's standalone parser using the PHP 8.5 pipe-operator example and the shown parser options. Trace the PHP parser entry point for the unexpected token; done means the example formats successfully without a parse 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
- 55/100