From 0a2013ff2455ad5d813dc46b7ba55e0b05f26cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Fri, 12 Jan 2018 15:27:22 +0100 Subject: [PATCH 1/2] Fix: Actually append whitespace to JSON --- test/Unit/FinalNewLineNormalizerTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); From ca520ce70df566be7d9a55538cab877b531c10d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Fri, 12 Jan 2018 15:29:03 +0100 Subject: [PATCH 2/2] Fix: Actually rtrim() JSON in FinalNewLineNormalizer --- src/FinalNewLineNormalizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } }