public function fix(\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)) {
$token->setContent(preg_replace("#\r\n|\n#", $ending, $token->getContent()));
}
continue;
}
if ($token->isGivenKind(array(T_OPEN_TAG, T_WHITESPACE, T_COMMENT, T_DOC_COMMENT, T_START_HEREDOC))) {
$token->setContent(preg_replace("#\r\n|\n#", $ending, $token->getContent()));
}
}
}