src/Fixer/Basic/BracesFixer.php
private function getSiblingContinuousSingleLineComment(Tokens $tokens, $index, $after)
    {
        $siblingIndex = $index;
        do {
            if ($after) {
                $siblingIndex = $tokens->getNextTokenOfKind($siblingIndex, [[T_COMMENT]]);
            } else {
                $siblingIndex = $tokens->getPrevTokenOfKind($siblingIndex, [[T_COMMENT]]);
            }

            if (null === $siblingIndex) {
                return null;
            }
        } while (0 === strpos($tokens[$siblingIndex]->getContent(), '/*'));

        $newLines = 0;
        for ($i = min($siblingIndex, $index) + 1, $max = max($siblingIndex, $index); $i < $max; ++$i) {
            if ($tokens[$i]->isWhitespace() && Preg::match('/\R/', $tokens[$i]->getContent())) {
                if (1 === $newLines || Preg::match('/\R.*\R/', $tokens[$i]->getContent())) {
                    return null;
                }

                ++$newLines;
            }
        }

        return $siblingIndex;
    }
private function getSiblingContinuousSingleLineComment(Tokens $tokens, $index, $after)
    {
        $siblingIndex = $index;
        do {
            if ($after) {
                $siblingIndex = $tokens->getNextTokenOfKind($siblingIndex, [[T_COMMENT]]);
            } else {
                $siblingIndex = $tokens->getPrevTokenOfKind($siblingIndex, [[T_COMMENT]]);
            }

            if (null === $siblingIndex) {
                return null;
            }
        } while (0 === strpos($tokens[$siblingIndex]->getContent(), '/*'));

        $newLines = 0;
        for ($i = min($siblingIndex, $index) + 1, $max = max($siblingIndex, $index); $i < $max; ++$i) {
            if ($tokens[$i]->isWhitespace() && Preg::match('/\R/', $tokens[$i]->getContent())) {
                if (1 === $newLines || Preg::match('/\R.*\R/', $tokens[$i]->getContent())) {
                    return null;
                }

                ++$newLines;
            }
        }

        return $siblingIndex;
    }
private function getSiblingContinuousSingleLineComment ( Tokens $ tokens , $ index , $ after ) { $ siblingIndex = $ index ; do { if ( $ after ) { $ siblingIndex = $ tokens -> getNextTokenOfKind ( $ siblingIndex , [ [ T_COMMENT ] ] ) ; } else { $ siblingIndex = $ tokens -> getPrevTokenOfKind ( $ siblingIndex , [ [ T_COMMENT ] ] ) ; } if ( null === $ siblingIndex ) { return null ; } } while ( 0 === strpos ( $ tokens [ $ siblingIndex ] -> getContent ( ) , '/*' ) ) ; $ newLines = 0 ; for ( $ i = min ( $ siblingIndex , $ index ) + 1 , $ max = max ( $ siblingIndex , $ index ) ; $ i < $ max ; ++ $ i ) { if ( $ tokens [ $ i ] -> isWhitespace ( ) && Preg :: match ( '/\R/' , $ tokens [ $ i ] -> getContent ( ) ) ) { if ( 1 === $ newLines || Preg :: match ( '/\R.*\R/' , $ tokens [ $ i ] -> getContent ( ) ) ) { return null ; } ++ $ newLines ; } } return $ siblingIndex ; }
@param Tokens $tokens
@param int    $index
@param bool   $after

@return null|int
@param Tokens $tokens @param int $index @param bool $after