@@ -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