Skip to content

Commit 6aceec7

Browse files
committed
fix newlines
1 parent de32119 commit 6aceec7

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"nikic/php-parser": "^5.6.2",
2424
"ondram/ci-detector": "^4.2",
2525
"phpstan/phpdoc-parser": "^2.3",
26-
"phpstan/phpstan": "2.1.x-dev",
26+
"phpstan/phpstan": "^2.1.32",
2727
"react/event-loop": "^1.6",
2828
"react/promise": "^3.3",
2929
"react/socket": "^1.17",

tests/PhpParser/Printer/PHPStanPrinterTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PHPStan\Parser\Parser;
99
use PHPStan\Parser\RichParser;
1010
use 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

Comments
 (0)