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

        for ($index = 0, $count = \count($tokens); $index < $count; ++$index) {
            $token = $tokens[$index];

            if ($token->isGivenKind(T_ENCAPSED_AND_WHITESPACE)) {
                if ($tokens[$tokens->getNextMeaningfulToken($index)]->isGivenKind(T_END_HEREDOC)) {
                    $tokens[$index] = new Token([
                        $token->getId(),
                        Preg::replace(
                            "#\r\n|\n#",
                            $ending,
                            $token->getContent()
                        ),
                    ]);
                }

                continue;
            }

            if ($token->isGivenKind([T_OPEN_TAG, T_WHITESPACE, T_COMMENT, T_DOC_COMMENT, T_START_HEREDOC])) {
                $tokens[$index] = new Token([
                    $token->getId(),
                    Preg::replace(
                        "#\r\n|\n#",
                        $ending,
                        $token->getContent()
                    ),
                ]);
            }
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $ending = $this->whitespacesConfig->getLineEnding();

        for ($index = 0, $count = \count($tokens); $index < $count; ++$index) {
            $token = $tokens[$index];

            if ($token->isGivenKind(T_ENCAPSED_AND_WHITESPACE)) {
                if ($tokens[$tokens->getNextMeaningfulToken($index)]->isGivenKind(T_END_HEREDOC)) {
                    $tokens[$index] = new Token([
                        $token->getId(),
                        Preg::replace(
                            "#\r\n|\n#",
                            $ending,
                            $token->getContent()
                        ),
                    ]);
                }

                continue;
            }

            if ($token->isGivenKind([T_OPEN_TAG, T_WHITESPACE, T_COMMENT, T_DOC_COMMENT, T_START_HEREDOC])) {
                $tokens[$index] = new Token([
                    $token->getId(),
                    Preg::replace(
                        "#\r\n|\n#",
                        $ending,
                        $token->getContent()
                    ),
                ]);
            }
        }
    }
{@inheritdoc}