-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
Comments in match statement throw error #1956
Labels
Comments
Yep, can confirm the same from my side. |
Yep, same here |
While not ideal, I addressed this in the meantime by moving the comment to either before the entire statement or after one of the arrows: <?php
function fizzbuzz(int $i)
{
/* this is a comment */
print match (0) {
$i % 15 => "fizzbuzz",
$i % 3 => "fizz",
$i % 5 => /* this is another comment */ "buzz",
default => $i,
} . PHP_EOL;
} That way Prettier won't fail on statements like these and you can still keep the comment fairly close to the desired statement. |
Fixed in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@prettier/plugin-php v0.18.3
Playground link
Input:
Output:
Of note, it doesn't matter what kind of comment, or where the comment is (end of line, before/after a pattern, etc.). Every scenario throws an exception.
The text was updated successfully, but these errors were encountered: