From 1ce6ebfe4a0c8a7fce2c19bc60db2b573de66e0c Mon Sep 17 00:00:00 2001 From: "ondrej@mirtes.cz" Date: Sat, 31 Oct 2026 06:08:30 +0000 Subject: [PATCH] Fix Windows CI: normalize CRLF in printer tests from #8881 and #8886 On Windows, Git checks out the test files with CRLF, so the heredoc input contains \r\n. Format-preserving printing correctly keeps those line endings, so the output is normalized before comparing with LF-only expectations. Amp-Thread-ID: https://ampcode.com/threads/T-01a1908f-48b6-7423-b4cd-641c531e141f --- .../TagValueNodeReprint/TestModifyReprintTest.php | 2 +- tests/PhpParser/Printer/BetterStandardPrinterTest.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/BetterPhpDocParser/PhpDocParser/TagValueNodeReprint/TestModifyReprintTest.php b/tests/BetterPhpDocParser/PhpDocParser/TagValueNodeReprint/TestModifyReprintTest.php index 5ee46d5ad79..9cc2d0f8134 100644 --- a/tests/BetterPhpDocParser/PhpDocParser/TagValueNodeReprint/TestModifyReprintTest.php +++ b/tests/BetterPhpDocParser/PhpDocParser/TagValueNodeReprint/TestModifyReprintTest.php @@ -94,7 +94,7 @@ final class SomeEntity $this->assertSame( "/**\n * @ORM\DiscriminatorMap({1=\"First\", 5=\"Second\", 7=\"Third\"})\n */", - $this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo) + str_replace("\r\n", "\n", $this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo)) ); } diff --git a/tests/PhpParser/Printer/BetterStandardPrinterTest.php b/tests/PhpParser/Printer/BetterStandardPrinterTest.php index 6ba17954cba..3bc626e21a4 100644 --- a/tests/PhpParser/Printer/BetterStandardPrinterTest.php +++ b/tests/PhpParser/Printer/BetterStandardPrinterTest.php @@ -152,7 +152,9 @@ private function printWithRemovedImplements(string $fileContent): string } } - return $this->betterStandardPrinter->printFormatPreserving($newStmts, $oldStmts, $tokens); + $printed = $this->betterStandardPrinter->printFormatPreserving($newStmts, $oldStmts, $tokens); + + return str_replace("\r\n", "\n", $printed); } /**