Skip to content

Conversation

@TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Nov 27, 2025

Test case for: rectorphp/rector#9492

This test uses PHPStan RichParser and native Standard printer to decouple from any Rector custom logic.


How to reproduce:

vendor/bin/phpunit tests/PhpParser/Printer/PHPStanPrinterTest.php

PHPStan 2.1.18 ✔️

Keeps original argument order:

Runtime:       PHP 8.2.29
Configuration: /home/runner/work/rector-src/rector-src/phpunit.xml

.                                                                   1 / 1 (100%)

Time: 00:00.346, Memory: 52.00 MB

OK (1 test, 2 assertions)

PHPStan 2.1.19 🔴

Changes argument order:

Time: 00:00.138, Memory: 38.00 MB

There was 1 failure:

1) Rector\Tests\PhpParser\Printer\PHPStanPrinterTest::testAddingCommentOnSomeNodesFail
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
 '...re;\n
 \n
-$result = array_map(array: [1, 2, 3], callback: fn(int $value) => $value);\n
+$result = array_map(callback: fn(int $value) => $value, array: [1, 2, 3]);\n

@TomasVotruba TomasVotruba changed the title tv sort args [issue 9492] create reproducer for PHPStan changing array_map args, printing invalid content as result Nov 27, 2025
@TomasVotruba TomasVotruba force-pushed the tv-sort-args branch 2 times, most recently from 2ab86f8 to 52ef860 Compare November 27, 2025 15:24
@TomasVotruba TomasVotruba force-pushed the tv-sort-args branch 2 times, most recently from baa4f0f to 2712027 Compare November 28, 2025 07:55
@TomasVotruba TomasVotruba force-pushed the tv-sort-args branch 4 times, most recently from 1ac947d to 34e1591 Compare November 28, 2025 08:19
@TomasVotruba TomasVotruba merged commit d29e5aa into main Dec 4, 2025
68 of 97 checks passed
@TomasVotruba TomasVotruba deleted the tv-sort-args branch December 4, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants