Skip to content

Commit 2d045f6

Browse files
committed
[issue 9492] create reproducer for modified array_map args, as creates changed args on print
1 parent d29e5aa commit 2d045f6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

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.32",
26+
"phpstan/phpstan": "2.1.19 as 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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
use PHPStan\Parser\Parser;
99
use PHPStan\Parser\RichParser;
1010
use Rector\Testing\PHPUnit\AbstractLazyTestCase;
11+
<<<<<<< HEAD
1112
use ReflectionProperty;
13+
=======
14+
>>>>>>> ea9a6ad8a5 ([issue 9492] create reproducer for modified array_map args, as creates changed args on print)
1215

1316
/**
1417
* Test case for: https://github.com/rectorphp/rector/issues/9492
@@ -24,17 +27,30 @@ public function testAddingCommentOnSomeNodesFail(): void
2427
$stmts = $phpstanParser->parseFile(__DIR__ . '/Fixture/some_array_map.php');
2528

2629
// get private property "parser"
30+
<<<<<<< HEAD
2731
$parserReflectionProperty = new ReflectionProperty(RichParser::class, 'parser');
32+
=======
33+
$parserReflectionProperty = new \ReflectionProperty(RichParser::class, 'parser');
34+
>>>>>>> ea9a6ad8a5 ([issue 9492] create reproducer for modified array_map args, as creates changed args on print)
2835

2936
/** @var \PhpParser\Parser $innerParser */
3037
$innerParser = $parserReflectionProperty->getValue($phpstanParser);
3138
$tokens = $innerParser->getTokens();
3239

40+
<<<<<<< HEAD
3341
$standard = new Standard([]);
3442
$printerContents = $standard->printFormatPreserving($stmts, $stmts, $tokens);
3543

3644
$newlineNormalizedContents = str_replace("\r\n", PHP_EOL, $printerContents);
3745

3846
$this->assertStringEqualsFile(__DIR__ . '/Fixture/some_array_map.php', $newlineNormalizedContents);
47+
=======
48+
$standardPrinter = new Standard([
49+
'newline' => "\n",
50+
]);
51+
$printerContents = $standardPrinter->printFormatPreserving($stmts, $stmts, $tokens);
52+
53+
$this->assertStringEqualsFile(__DIR__ . '/Fixture/some_array_map.php', $printerContents);
54+
>>>>>>> ea9a6ad8a5 ([issue 9492] create reproducer for modified array_map args, as creates changed args on print)
3955
}
4056
}

0 commit comments

Comments
 (0)