88use PHPStan \Parser \Parser ;
99use PHPStan \Parser \RichParser ;
1010use Rector \Testing \PHPUnit \AbstractLazyTestCase ;
11+ use ReflectionProperty ;
1112
1213/**
1314 * Test case for: https://github.com/rectorphp/rector/issues/9492
@@ -23,17 +24,17 @@ public function testAddingCommentOnSomeNodesFail(): void
2324 $ stmts = $ phpstanParser ->parseFile (__DIR__ . '/Fixture/some_array_map.php ' );
2425
2526 // get private property "parser"
26- $ parserReflectionProperty = new \ ReflectionProperty (RichParser::class, 'parser ' );
27+ $ parserReflectionProperty = new ReflectionProperty (RichParser::class, 'parser ' );
2728
2829 /** @var \PhpParser\Parser $innerParser */
2930 $ innerParser = $ parserReflectionProperty ->getValue ($ phpstanParser );
3031 $ tokens = $ innerParser ->getTokens ();
3132
32- $ standardPrinter = new Standard ([
33- 'newline ' => "\n" ,
34- ]);
35- $ printerContents = $ standardPrinter ->printFormatPreserving ($ stmts , $ stmts , $ tokens );
33+ $ standard = new Standard ([]);
34+ $ printerContents = $ standard ->printFormatPreserving ($ stmts , $ stmts , $ tokens );
3635
37- $ this ->assertStringEqualsFile (__DIR__ . '/Fixture/some_array_map.php ' , $ printerContents );
36+ $ newlineNormalizedContents = str_replace ("\r\n" , PHP_EOL , $ printerContents );
37+
38+ $ this ->assertStringEqualsFile (__DIR__ . '/Fixture/some_array_map.php ' , $ newlineNormalizedContents );
3839 }
3940}
0 commit comments