plugin-php
plugin-php copied to clipboard
First class callable syntax treated like arguments, trailing comma causes error
@prettier/plugin-php v0.19.3 Playground link
Input:
<?php
return $this->longMethodName(
$this->longPropertyName->evenLongerMethodNameNowCausesTheDotsToWrapWithComma(...),
);
Output:
<?php
return $this->longMethodName(
$this->longPropertyName->evenLongerMethodNameNowCausesTheDotsToWrapWithComma(
...,
),
);
Expected Output:
No trailing comma after ... in first class callable syntax, which is a syntax error. Or preferentially treating the (...) as being inseparable and not allowing line breaks inside it.
Yea, just bumped into this one myself, extracted a Laravel query filter to a named function for reuse, and a deep/long relation name caused it to break to a new line. Would agree that func(...) should be an unbreakable unit of syntax.