[e2e][Printer] Handle crash indentation on AddParamBasedOnParentClassMethodRector
Fixes https://github.com/rectorphp/rector/issues/8712
Step to reproduce only via e2e test:
cd e2e/print-new-node
composer install
php ../e2eTestRunner.php
without this patch, it will cause error:
➜ print-new-node git:(indentation-crash-error) php ../e2eTestRunner.php
2/2 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% ---------- begin diff ----------
@@ @@
-[ERROR] Could not process "./print-new-node/src/ExtendingTestClass.php" file, due
- to:
- "System error: "Rector\PhpParser\Printer\BetterStandardPrinter::p(): Return value must be of type string, null
- returned"
- Run Rector with "--debug" option and post the report here: https://github.com/rectorphp/rector/issues/new". On line: 154
For note: I already tried set origNode = null on the target rule, but no luck, it only resolvable via printer.
Fixed 🎉 /cc @RuesimOfCode
All checks have passed 🎉 @TomasVotruba I think it is ready.
This looks like bug in php-parser itself. If that's true, we should report it first there with a reproducer.
Ready to go :+1:
I can't approve my own PR, i think this is ready, just probably concern about renaming method bc break :)