@@ -379,12 +379,16 @@ public function formatList($list)
379379 }
380380
381381 // The options of a clause should stay on the same line and everything that follows.
382- if (($ this ->options ['parts_newline ' ])
383- && (!$ formattedOptions )
384- && (empty (self ::$ INLINE_CLAUSES [$ lastClause ]))
385- && (($ curr ->type !== Token::TYPE_KEYWORD )
386- || (($ curr ->type === Token::TYPE_KEYWORD )
387- && ($ curr ->flags & Token::FLAG_KEYWORD_FUNCTION )))
382+ if ($ this ->options ['parts_newline ' ]
383+ && !$ formattedOptions
384+ && empty (self ::$ INLINE_CLAUSES [$ lastClause ])
385+ && (
386+ $ curr ->type !== Token::TYPE_KEYWORD
387+ || (
388+ $ curr ->type === Token::TYPE_KEYWORD
389+ && $ curr ->flags & Token::FLAG_KEYWORD_FUNCTION
390+ )
391+ )
388392 ) {
389393 $ formattedOptions = true ;
390394 $ lineEnded = true ;
@@ -393,7 +397,7 @@ public function formatList($list)
393397
394398 // Checking if this clause ended.
395399 if ($ tmp = static ::isClause ($ curr )) {
396- if (( $ tmp == 2 ) || ( $ this ->options ['clause_newline ' ]) ) {
400+ if ($ tmp == 2 || $ this ->options ['clause_newline ' ]) {
397401 $ lineEnded = true ;
398402 if ($ this ->options ['parts_newline ' ]) {
399403 --$ indent ;
@@ -416,10 +420,10 @@ public function formatList($list)
416420 // Fragments delimited by a comma are broken into multiple
417421 // pieces only if the clause is not inlined or this fragment
418422 // is between brackets that are on new line.
419- if ((( empty (self ::$ INLINE_CLAUSES [$ lastClause ]) )
423+ if ((empty (self ::$ INLINE_CLAUSES [$ lastClause ])
420424 && !$ shortGroup
421- && ( $ this ->options ['parts_newline ' ]) )
422- || ( end ($ blocksLineEndings ) === true )
425+ && $ this ->options ['parts_newline ' ])
426+ || end ($ blocksLineEndings ) === true
423427 ) {
424428 $ lineEnded = true ;
425429 }
@@ -428,7 +432,7 @@ public function formatList($list)
428432 // Handling brackets.
429433 // Brackets are indented only if the length of the fragment between
430434 // them is longer than 30 characters.
431- if (( $ prev ->type === Token::TYPE_OPERATOR ) && ( $ prev ->value === '( ' ) ) {
435+ if ($ prev ->type === Token::TYPE_OPERATOR && $ prev ->value === '( ' ) {
432436 array_push ($ blocksIndentation , $ indent );
433437 $ shortGroup = true ;
434438 if (static ::getGroupLength ($ list ) > 30 ) {
@@ -437,7 +441,7 @@ public function formatList($list)
437441 $ shortGroup = false ;
438442 }
439443 array_push ($ blocksLineEndings , $ lineEnded );
440- } elseif (( $ curr ->type === Token::TYPE_OPERATOR ) && ( $ curr ->value === ') ' ) ) {
444+ } elseif ($ curr ->type === Token::TYPE_OPERATOR && $ curr ->value === ') ' ) {
441445 $ indent = array_pop ($ blocksIndentation );
442446 $ lineEnded |= array_pop ($ blocksLineEndings );
443447 $ shortGroup = false ;
@@ -467,14 +471,13 @@ public function formatList($list)
467471 } else {
468472 // If the line ended there is no point in adding whitespaces.
469473 // Also, some tokens do not have spaces before or after them.
470- if (!((( $ prev ->type === Token::TYPE_OPERATOR ) && (( $ prev ->value === '. ' ) || ( $ prev ->value === '( ' ) ))
474+ if (!(($ prev ->type === Token::TYPE_OPERATOR && ($ prev ->value === '. ' || $ prev ->value === '( ' ))
471475 // No space after . (
472- || (($ curr ->type === Token::TYPE_OPERATOR ) && (($ curr ->value === '. ' ) || ($ curr ->value === ', ' )
473- || ($ curr ->value === '( ' ) || ($ curr ->value === ') ' )))
476+ || ($ curr ->type === Token::TYPE_OPERATOR && ($ curr ->value === '. ' || $ curr ->value === ', ' || $ curr ->value === '( ' || $ curr ->value === ') ' ))
474477 // No space before . , ( )
475- || (( $ curr ->type === Token::TYPE_DELIMITER )) && ( mb_strlen ($ curr ->value , 'UTF-8 ' ) < 2 ) )
478+ || $ curr ->type === Token::TYPE_DELIMITER && mb_strlen ($ curr ->value , 'UTF-8 ' ) < 2 )
476479 // A space after delimiters that are longer than 2 characters.
477- || ( $ prev ->value === 'DELIMITER ' )
480+ || $ prev ->value === 'DELIMITER '
478481 ) {
479482 $ ret .= ' ' ;
480483 }
@@ -524,8 +527,8 @@ public function toString($token)
524527 $ text = $ token ->token ;
525528
526529 foreach ($ this ->options ['formats ' ] as $ format ) {
527- if (( $ token ->type === $ format ['type ' ])
528- && (( $ token ->flags & $ format ['flags ' ]) === $ format ['flags ' ])
530+ if ($ token ->type === $ format ['type ' ]
531+ && ($ token ->flags & $ format ['flags ' ]) === $ format ['flags ' ]
529532 ) {
530533 // Running transformation function.
531534 if (!empty ($ format ['function ' ])) {
@@ -626,11 +629,14 @@ public static function getGroupLength($list)
626629 */
627630 public static function isClause ($ token )
628631 {
629- if ((($ token ->type === Token::TYPE_NONE ) && (strtoupper ($ token ->token ) === 'DELIMITER ' ))
630- || (($ token ->type === Token::TYPE_KEYWORD ) && (isset (Parser::$ STATEMENT_PARSERS [$ token ->value ])))
632+ if (
633+ ($ token ->type === Token::TYPE_KEYWORD && isset (Parser::$ STATEMENT_PARSERS [$ token ->value ]))
634+ || ($ token ->type === Token::TYPE_NONE && strtoupper ($ token ->token ) === 'DELIMITER ' )
631635 ) {
632636 return 2 ;
633- } elseif (($ token ->type === Token::TYPE_KEYWORD ) && (isset (Parser::$ KEYWORD_PARSERS [$ token ->value ]))) {
637+ } elseif (
638+ $ token ->type === Token::TYPE_KEYWORD && isset (Parser::$ KEYWORD_PARSERS [$ token ->value ])
639+ ) {
634640 return 1 ;
635641 }
636642
0 commit comments