formatter: line break after opening "if (" #2091
|
Which formatter rule is responsible for making adding a line break after the opening - if (auth()->check()
+ if (
+ auth()->check()
&& !str_starts_with($request->getPathInfo(), '/nova')
&& auth()->user()->dynamics_contact_id !== null
) { |
Replies: 1 comment 5 replies
|
There is no dedicated ?break after You can allow a longer line in [formatter]
print-width = 140That will only keep it inline when the whole formatted condition fits within the new width. I do not see a separate setting for the exact style ?keep the first operand beside |
Seems to be working as-intended, but there's a misalignment of expectations from the name kinda-sorta overpromising.
Mago is still a parse-and-reprint formatter and
preserve-breaking-condition-expressiononly promises that, "when enabled [and existing breaks are detected], each boolean operator goes on its own line." It does not preserve the exact whitespace you use, just that there is some whitespace - of which Mago is opinionated about (see below).The way this works, is that it checks if you want to preserve breaks. If you do, it checks if there's already a line break between the left paren and the beginning of your conditional expression (in your source). If there is, when it creates …