src/Fixer/Whitespace/MethodChainingIndentationFixer.php
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $lineEnding = $this->whitespacesConfig->getLineEnding();

        for ($index = 1, $count = \count($tokens); $index < $count; ++$index) {
            if (!$tokens[$index]->isGivenKind(T_OBJECT_OPERATOR)) {
                continue;
            }

            if ($this->canBeMovedToNextLine($index, $tokens)) {
                $newline = new Token([T_WHITESPACE, $lineEnding]);
                if ($tokens[$index - 1]->isWhitespace()) {
                    $tokens[$index - 1] = $newline;
                } else {
                    $tokens->insertAt($index, $newline);
                    ++$index;
                }
            }

            $currentIndent = $this->getIndentAt($tokens, $index - 1);
            if (null === $currentIndent) {
                continue;
            }

            $expectedIndent = $this->getExpectedIndentAt($tokens, $index);
            if ($currentIndent !== $expectedIndent) {
                $tokens[$index - 1] = new Token([T_WHITESPACE, $lineEnding.$expectedIndent]);
            }
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $lineEnding = $this->whitespacesConfig->getLineEnding();

        for ($index = 1, $count = \count($tokens); $index < $count; ++$index) {
            if (!$tokens[$index]->isGivenKind(T_OBJECT_OPERATOR)) {
                continue;
            }

            if ($this->canBeMovedToNextLine($index, $tokens)) {
                $newline = new Token([T_WHITESPACE, $lineEnding]);
                if ($tokens[$index - 1]->isWhitespace()) {
                    $tokens[$index - 1] = $newline;
                } else {
                    $tokens->insertAt($index, $newline);
                    ++$index;
                }
            }

            $currentIndent = $this->getIndentAt($tokens, $index - 1);
            if (null === $currentIndent) {
                continue;
            }

            $expectedIndent = $this->getExpectedIndentAt($tokens, $index);
            if ($currentIndent !== $expectedIndent) {
                $tokens[$index - 1] = new Token([T_WHITESPACE, $lineEnding.$expectedIndent]);
            }
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { $ lineEnding = $ this -> whitespacesConfig -> getLineEnding ( ) ; for ( $ index = 1 , $ count = \ count ( $ tokens ) ; $ index < $ count ; ++ $ index ) { if ( ! $ tokens [ $ index ] -> isGivenKind ( T_OBJECT_OPERATOR ) ) { continue ; } if ( $ this -> canBeMovedToNextLine ( $ index , $ tokens ) ) { $ newline = new Token ( [ T_WHITESPACE , $ lineEnding ] ) ; if ( $ tokens [ $ index - 1 ] -> isWhitespace ( ) ) { $ tokens [ $ index - 1 ] = $ newline ; } else { $ tokens -> insertAt ( $ index , $ newline ) ; ++ $ index ; } } $ currentIndent = $ this -> getIndentAt ( $ tokens , $ index - 1 ) ; if ( null === $ currentIndent ) { continue ; } $ expectedIndent = $ this -> getExpectedIndentAt ( $ tokens , $ index ) ; if ( $ currentIndent !== $ expectedIndent ) { $ tokens [ $ index - 1 ] = new Token ( [ T_WHITESPACE , $ lineEnding . $ expectedIndent ] ) ; } } }
{@inheritdoc}
{