Skip to content

Commit

Permalink
Fixed a bug where formatter split the function name and the parameter…
Browse files Browse the repository at this point in the history
…s list.
  • Loading branch information
Dan Ungureanu committed Nov 12, 2015
1 parent 2a3d3b8 commit a42f12a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Utils/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit a42f12a

Please sign in to comment.