diff --git a/src/FinalNewLineNormalizer.php b/src/FinalNewLineNormalizer.php index 70dc3bd8..65273c51 100644 --- a/src/FinalNewLineNormalizer.php +++ b/src/FinalNewLineNormalizer.php @@ -24,6 +24,6 @@ public function normalize(string $json): string )); } - return $json . PHP_EOL; + return \rtrim($json) . PHP_EOL; } } diff --git a/test/Unit/FinalNewLineNormalizerTest.php b/test/Unit/FinalNewLineNormalizerTest.php index f9307c77..f2568862 100644 --- a/test/Unit/FinalNewLineNormalizerTest.php +++ b/test/Unit/FinalNewLineNormalizerTest.php @@ -56,7 +56,9 @@ public function testNormalizeEnsuresSingleFinalNewLine(string $whitespace) } JSON; - $normalized = \rtrim($json . $whitespace) . PHP_EOL; + $json .= $whitespace; + + $normalized = \rtrim($json) . PHP_EOL; $normalizer = new FinalNewLineNormalizer();