mirror of
https://github.com/rectorphp/rector.git
synced 2025-03-14 20:39:43 +01:00
do not touch end newlines, keep only in tests
This commit is contained in:
parent
1be856068b
commit
f05c71c58d
@ -77,9 +77,7 @@ final class FileProcessor
|
||||
|
||||
[$newStmts, $oldStmts, $oldTokens] = $this->parseAndTraverseFileInfoToNodes($smartFileInfo);
|
||||
|
||||
$printedContent = $this->formatPerservingPrinter->printToString($newStmts, $oldStmts, $oldTokens);
|
||||
|
||||
return trim($printedContent) . PHP_EOL;
|
||||
return $this->formatPerservingPrinter->printToString($newStmts, $oldStmts, $oldTokens);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,8 +40,6 @@ final class FormatPerservingPrinter
|
||||
*/
|
||||
public function printToString(array $newStmts, array $oldStmts, array $oldTokens): string
|
||||
{
|
||||
$printedContent = $this->betterStandardPrinter->printFormatPreserving($newStmts, $oldStmts, $oldTokens);
|
||||
|
||||
return trim($printedContent) . PHP_EOL;
|
||||
return $this->betterStandardPrinter->printFormatPreserving($newStmts, $oldStmts, $oldTokens);
|
||||
}
|
||||
}
|
||||
|
@ -71,6 +71,7 @@ abstract class AbstractRectorTestCase extends TestCase
|
||||
|
||||
try {
|
||||
$reconstructedFileContent = $this->fileProcessor->processFileToString(new SmartFileInfo($file));
|
||||
$reconstructedFileContent = $this->normalizeEndNewline($reconstructedFileContent);
|
||||
} catch (AnalysedCodeException $analysedCodeException) {
|
||||
// change message to include responsible file
|
||||
$message = sprintf('Analyze error in "%s" file:%s%s', $file, PHP_EOL, $analysedCodeException->getMessage());
|
||||
@ -86,4 +87,9 @@ abstract class AbstractRectorTestCase extends TestCase
|
||||
}
|
||||
|
||||
abstract protected function provideConfig(): string;
|
||||
|
||||
private function normalizeEndNewline(string $content): string
|
||||
{
|
||||
return trim($content) . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user