Skip to content

Commit a42f12a

Browse files
committed
Fixed a bug where formatter split the function name and the parameters list.
1 parent 2a3d3b8 commit a42f12a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Utils/Formatter.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,9 @@ public function formatList($list)
304304
if (($this->options['parts_newline'])
305305
&& (!$formattedOptions)
306306
&& (empty(self::$INLINE_CLAUSES[$lastClause]))
307-
&& ($curr->type != Token::TYPE_KEYWORD)
307+
&& (($curr->type !== Token::TYPE_KEYWORD)
308+
|| (($curr->type === Token::TYPE_KEYWORD)
309+
&& ($curr->flags & Token::FLAG_KEYWORD_FUNCTION)))
308310
) {
309311
$formattedOptions = true;
310312
$lineEnded = true;
@@ -334,8 +336,8 @@ public function formatList($list)
334336
// Formatting fragments delimited by comma.
335337
if (($prev->type === Token::TYPE_OPERATOR) && ($prev->value === ',')) {
336338
// Fragments delimited by a comma are broken into multiple
337-
// pieces only if the clause if the clause is not inlined or
338-
// this fragment is between brackets that were on new line.
339+
// pieces only if the clause is not inlined or this fragment
340+
// is between brackets that are on new line.
339341
if (((empty(self::$INLINE_CLAUSES[$lastClause]))
340342
&& ($this->options['parts_newline']))
341343
|| (end($blocksLineEndings) === true)
@@ -401,8 +403,7 @@ public function formatList($list)
401403
$comment = '';
402404
}
403405

404-
// Saving the next token as the one that will be processed during
405-
// the next iteration.
406+
// Iteration finished, consider current token as previous.
406407
$prev = $curr;
407408
}
408409

0 commit comments

Comments
 (0)