private function fixClassyDefinitionOpenSpacing(Tokens $tokens, array $classDefInfo)
    {
        if ($classDefInfo['anonymousClass']) {
            if (false !== $classDefInfo['implements']) {
                $spacing = $classDefInfo['implements']['multiLine'] ? $this->whitespacesConfig->getLineEnding() : ' ';
            } elseif (false !== $classDefInfo['extends']) {
                $spacing = $classDefInfo['extends']['multiLine'] ? $this->whitespacesConfig->getLineEnding() : ' ';
            } else {
                $spacing = ' ';
            }
        } else {
            $spacing = $this->whitespacesConfig->getLineEnding();
        }

        $openIndex = $tokens->getNextTokenOfKind($classDefInfo['classy'], ['{']);
        if (' ' !== $spacing && false !== strpos($tokens[$openIndex - 1]->getContent(), "\n")) {
            return $openIndex;
        }

        if ($tokens[$openIndex - 1]->isWhitespace()) {
            if (' ' !== $spacing || !$tokens[$tokens->getPrevNonWhitespace($openIndex - 1)]->isComment()) {
                $tokens[$openIndex - 1] = new Token([T_WHITESPACE, $spacing]);
            }

            return $openIndex;
        }

        $tokens->insertAt($openIndex, new Token([T_WHITESPACE, $spacing]));

        return $openIndex + 1;
    }
private function fixClassyDefinitionOpenSpacing(Tokens $tokens, array $classDefInfo)
    {
        if ($classDefInfo['anonymousClass']) {
            if (false !== $classDefInfo['implements']) {
                $spacing = $classDefInfo['implements']['multiLine'] ? $this->whitespacesConfig->getLineEnding() : ' ';
            } elseif (false !== $classDefInfo['extends']) {
                $spacing = $classDefInfo['extends']['multiLine'] ? $this->whitespacesConfig->getLineEnding() : ' ';
            } else {
                $spacing = ' ';
            }
        } else {
            $spacing = $this->whitespacesConfig->getLineEnding();
        }

        $openIndex = $tokens->getNextTokenOfKind($classDefInfo['classy'], ['{']);
        if (' ' !== $spacing && false !== strpos($tokens[$openIndex - 1]->getContent(), "\n")) {
            return $openIndex;
        }

        if ($tokens[$openIndex - 1]->isWhitespace()) {
            if (' ' !== $spacing || !$tokens[$tokens->getPrevNonWhitespace($openIndex - 1)]->isComment()) {
                $tokens[$openIndex - 1] = new Token([T_WHITESPACE, $spacing]);
            }

            return $openIndex;
        }

        $tokens->insertAt($openIndex, new Token([T_WHITESPACE, $spacing]));

        return $openIndex + 1;
    }
private function fixClassyDefinitionOpenSpacing ( Tokens $ tokens , array $ classDefInfo ) { if ( $ classDefInfo [ 'anonymousClass' ] ) { if ( false !== $ classDefInfo [ 'implements' ] ) { $ spacing = $ classDefInfo [ 'implements' ] [ 'multiLine' ] ? $ this -> whitespacesConfig -> getLineEnding ( ) : ' ' ; } elseif ( false !== $ classDefInfo [ 'extends' ] ) { $ spacing = $ classDefInfo [ 'extends' ] [ 'multiLine' ] ? $ this -> whitespacesConfig -> getLineEnding ( ) : ' ' ; } else { $ spacing = ' ' ; } } else { $ spacing = $ this -> whitespacesConfig -> getLineEnding ( ) ; } $ openIndex = $ tokens -> getNextTokenOfKind ( $ classDefInfo [ 'classy' ] , [ '{' ] ) ; if ( ' ' !== $ spacing && false !== strpos ( $ tokens [ $ openIndex - 1 ] -> getContent ( ) , "\n" ) ) { return $ openIndex ; } if ( $ tokens [ $ openIndex - 1 ] -> isWhitespace ( ) ) { if ( ' ' !== $ spacing || ! $ tokens [ $ tokens -> getPrevNonWhitespace ( $ openIndex - 1 ) ] -> isComment ( ) ) { $ tokens [ $ openIndex - 1 ] = new Token ( [ T_WHITESPACE , $ spacing ] ) ; } return $ openIndex ; } $ tokens -> insertAt ( $ openIndex , new Token ( [ T_WHITESPACE , $ spacing ] ) ) ; return $ openIndex + 1 ; }
@param Tokens $tokens
@param array  $classDefInfo

@return int
@param Tokens $tokens @param array $classDefInfo