From a42f12a2d83afa8eadbdda02305613465a760a80 Mon Sep 17 00:00:00 2001 From: Dan Ungureanu Date: Thu, 12 Nov 2015 23:41:01 +0200 Subject: [PATCH] Fixed a bug where formatter split the function name and the parameters list. --- src/Utils/Formatter.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php index ea4b419ff..7ff13463f 100644 --- a/src/Utils/Formatter.php +++ b/src/Utils/Formatter.php @@ -304,7 +304,9 @@ public function formatList($list) if (($this->options['parts_newline']) && (!$formattedOptions) && (empty(self::$INLINE_CLAUSES[$lastClause])) - && ($curr->type != Token::TYPE_KEYWORD) + && (($curr->type !== Token::TYPE_KEYWORD) + || (($curr->type === Token::TYPE_KEYWORD) + && ($curr->flags & Token::FLAG_KEYWORD_FUNCTION))) ) { $formattedOptions = true; $lineEnded = true; @@ -334,8 +336,8 @@ public function formatList($list) // Formatting fragments delimited by comma. if (($prev->type === Token::TYPE_OPERATOR) && ($prev->value === ',')) { // Fragments delimited by a comma are broken into multiple - // pieces only if the clause if the clause is not inlined or - // this fragment is between brackets that were on new line. + // pieces only if the clause is not inlined or this fragment + // is between brackets that are on new line. if (((empty(self::$INLINE_CLAUSES[$lastClause])) && ($this->options['parts_newline'])) || (end($blocksLineEndings) === true) @@ -401,8 +403,7 @@ public function formatList($list) $comment = ''; } - // Saving the next token as the one that will be processed during - // the next iteration. + // Iteration finished, consider current token as previous. $prev = $curr; }