-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(php8 hanging comma) Add support for haning comma for functions, closures, arrow functions and methods #1769
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway good job!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great otherwise 👍
This change also adds a comma after "parameters" in a use block for a closure — which it should, but the resulting code can not be parsed again. Input: <?php
$test = function (SomeClass $one, SomeOtherClass $two, AndAnotherOne $three)
use ($one, $two, $three, $four, $five, $six, $seven, $eight, $nine, $ten, $eleven)
{
} Output: <?php
$test = function (
SomeClass $one,
SomeOtherClass $two,
AndAnotherOne $three,
) use (
$one,
$two,
$three,
$four,
$five,
$six,
$seven,
$eight,
$nine,
$ten,
$eleven,
) {}; And using the output as input again give the following message:
See Prettier playgrounds: before and after. Is this a quick fix? Or do you want me to look into it? |
package.json
Outdated
@@ -13,7 +13,7 @@ | |||
"dependencies": { | |||
"linguist-languages": "^7.5.1", | |||
"mem": "^8.0.0", | |||
"php-parser": "https://github.com/moddengine/php-parser#c71ee4b5c7bab44dbaf5cb9e9bce7e69b45c23b8" | |||
"php-parser": "hhttps://github.com/glayzzle/php-parser#cca83041d938b972c7ef74648f29de03777b0ea4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@czosel here bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not the latest version you're looking at. It currently links to the right commit on master
, and the latest version of this PR as well.
The parses doesn't understand the extra ,
.
@justim your code should work, can you open an new issue (before please test it on the latest version) |
This patch requires the PHP parser support for hanging commas glayzzle/php-parser#756
closes #1759