Skip to content

feat: support php-parser 3.4.0 (pipe operator and readonly anonymous classes)#2459

Open
jorgsowa wants to merge 5 commits intoprettier:mainfrom
jorgsowa:feat/support-php-parser-3.4.0
Open

feat: support php-parser 3.4.0 (pipe operator and readonly anonymous classes)#2459
jorgsowa wants to merge 5 commits intoprettier:mainfrom
jorgsowa:feat/support-php-parser-3.4.0

Conversation

@jorgsowa
Copy link
Collaborator

Supports php-parser 3.4.0

Changes:

  • readonly anonymous classes
  • pipe operator (PHP 8.5)

@jorgsowa jorgsowa changed the title feat: support php-parser 3.4.0 (pipe operator and readonly anonymous classes feat: support php-parser 3.4.0 (pipe operator and readonly anonymous classes) Mar 21, 2026
@czosel
Copy link
Collaborator

czosel commented Mar 22, 2026

This is probably still missing the dependency bump

@jorgsowa
Copy link
Collaborator Author

Yes, missed that. Done in 6ad88c1 (this PR)

@czosel
Copy link
Collaborator

czosel commented Mar 22, 2026

👍 now you might still have to set the PHP version in jsfmt.spec.js

Comment on lines +33 to +35
$result =
"Hello, World!" |>
(strtoupper(...) |> (trim(...) |> htmlspecialchars(...)));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think this still needs a few changes:

  • unnecessary brackets
  • pipe operator should be at beginning of each line if multi-line
  • only one pipe per line

The PHP docs show an example where the trailing semicolon is on its own line, we might also want to implement that?

Suggested change
$result =
"Hello, World!" |>
(strtoupper(...) |> (trim(...) |> htmlspecialchars(...)));
$result = "Hello, World!"
|> strtoupper(...)
|> trim(...)
|> htmlspecialchars(...)
;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants