@@ -383,12 +383,16 @@ public function formatList($list)
383383 }
384384
385385 // The options of a clause should stay on the same line and everything that follows.
386- if (($ this ->options ['parts_newline ' ])
387- && (!$ formattedOptions )
388- && (empty (self ::$ INLINE_CLAUSES [$ lastClause ]))
389- && (($ curr ->type !== Token::TYPE_KEYWORD )
390- || (($ curr ->type === Token::TYPE_KEYWORD )
391- && ($ curr ->flags & Token::FLAG_KEYWORD_FUNCTION )))
386+ if ($ this ->options ['parts_newline ' ]
387+ && !$ formattedOptions
388+ && empty (self ::$ INLINE_CLAUSES [$ lastClause ])
389+ && (
390+ $ curr ->type !== Token::TYPE_KEYWORD
391+ || (
392+ $ curr ->type === Token::TYPE_KEYWORD
393+ && $ curr ->flags & Token::FLAG_KEYWORD_FUNCTION
394+ )
395+ )
392396 ) {
393397 $ formattedOptions = true ;
394398 $ lineEnded = true ;
@@ -397,7 +401,7 @@ public function formatList($list)
397401
398402 // Checking if this clause ended.
399403 if ($ tmp = static ::isClause ($ curr )) {
400- if (( $ tmp == 2 ) || ( $ this ->options ['clause_newline ' ]) ) {
404+ if ($ tmp == 2 || $ this ->options ['clause_newline ' ]) {
401405 $ lineEnded = true ;
402406 if ($ this ->options ['parts_newline ' ]) {
403407 --$ indent ;
@@ -420,10 +424,10 @@ public function formatList($list)
420424 // Fragments delimited by a comma are broken into multiple
421425 // pieces only if the clause is not inlined or this fragment
422426 // is between brackets that are on new line.
423- if ((( empty (self ::$ INLINE_CLAUSES [$ lastClause ]) )
427+ if ((empty (self ::$ INLINE_CLAUSES [$ lastClause ])
424428 && !$ shortGroup
425- && ( $ this ->options ['parts_newline ' ]) )
426- || ( end ($ blocksLineEndings ) === true )
429+ && $ this ->options ['parts_newline ' ])
430+ || end ($ blocksLineEndings ) === true
427431 ) {
428432 $ lineEnded = true ;
429433 }
@@ -432,7 +436,7 @@ public function formatList($list)
432436 // Handling brackets.
433437 // Brackets are indented only if the length of the fragment between
434438 // them is longer than 30 characters.
435- if (( $ prev ->type === Token::TYPE_OPERATOR ) && ( $ prev ->value === '( ' ) ) {
439+ if ($ prev ->type === Token::TYPE_OPERATOR && $ prev ->value === '( ' ) {
436440 array_push ($ blocksIndentation , $ indent );
437441 $ shortGroup = true ;
438442 if (static ::getGroupLength ($ list ) > 30 ) {
@@ -441,7 +445,7 @@ public function formatList($list)
441445 $ shortGroup = false ;
442446 }
443447 array_push ($ blocksLineEndings , $ lineEnded );
444- } elseif (( $ curr ->type === Token::TYPE_OPERATOR ) && ( $ curr ->value === ') ' ) ) {
448+ } elseif ($ curr ->type === Token::TYPE_OPERATOR && $ curr ->value === ') ' ) {
445449 $ indent = array_pop ($ blocksIndentation );
446450 $ lineEnded |= array_pop ($ blocksLineEndings );
447451 $ shortGroup = false ;
@@ -471,14 +475,13 @@ public function formatList($list)
471475 } else {
472476 // If the line ended there is no point in adding whitespaces.
473477 // Also, some tokens do not have spaces before or after them.
474- if (!((( $ prev ->type === Token::TYPE_OPERATOR ) && (( $ prev ->value === '. ' ) || ( $ prev ->value === '( ' ) ))
478+ if (!(($ prev ->type === Token::TYPE_OPERATOR && ($ prev ->value === '. ' || $ prev ->value === '( ' ))
475479 // No space after . (
476- || (($ curr ->type === Token::TYPE_OPERATOR ) && (($ curr ->value === '. ' ) || ($ curr ->value === ', ' )
477- || ($ curr ->value === '( ' ) || ($ curr ->value === ') ' )))
480+ || ($ curr ->type === Token::TYPE_OPERATOR && ($ curr ->value === '. ' || $ curr ->value === ', ' || $ curr ->value === '( ' || $ curr ->value === ') ' ))
478481 // No space before . , ( )
479- || (( $ curr ->type === Token::TYPE_DELIMITER )) && ( mb_strlen ($ curr ->value , 'UTF-8 ' ) < 2 ) )
482+ || $ curr ->type === Token::TYPE_DELIMITER && mb_strlen ($ curr ->value , 'UTF-8 ' ) < 2 )
480483 // A space after delimiters that are longer than 2 characters.
481- || ( $ prev ->value === 'DELIMITER ' )
484+ || $ prev ->value === 'DELIMITER '
482485 ) {
483486 $ ret .= ' ' ;
484487 }
@@ -528,8 +531,8 @@ public function toString($token)
528531 $ text = $ token ->token ;
529532
530533 foreach ($ this ->options ['formats ' ] as $ format ) {
531- if (( $ token ->type === $ format ['type ' ])
532- && (( $ token ->flags & $ format ['flags ' ]) === $ format ['flags ' ])
534+ if ($ token ->type === $ format ['type ' ]
535+ && ($ token ->flags & $ format ['flags ' ]) === $ format ['flags ' ]
533536 ) {
534537 // Running transformation function.
535538 if (!empty ($ format ['function ' ])) {
@@ -630,11 +633,14 @@ public static function getGroupLength($list)
630633 */
631634 public static function isClause ($ token )
632635 {
633- if ((($ token ->type === Token::TYPE_NONE ) && (strtoupper ($ token ->token ) === 'DELIMITER ' ))
634- || (($ token ->type === Token::TYPE_KEYWORD ) && (isset (Parser::$ STATEMENT_PARSERS [$ token ->value ])))
636+ if (
637+ ($ token ->type === Token::TYPE_KEYWORD && isset (Parser::$ STATEMENT_PARSERS [$ token ->value ]))
638+ || ($ token ->type === Token::TYPE_NONE && strtoupper ($ token ->token ) === 'DELIMITER ' )
635639 ) {
636640 return 2 ;
637- } elseif (($ token ->type === Token::TYPE_KEYWORD ) && (isset (Parser::$ KEYWORD_PARSERS [$ token ->value ]))) {
641+ } elseif (
642+ $ token ->type === Token::TYPE_KEYWORD && isset (Parser::$ KEYWORD_PARSERS [$ token ->value ])
643+ ) {
638644 return 1 ;
639645 }
640646
0 commit comments