Transform `if` / `else if` into flat `if` / `elseif` when possible
Closes https://github.com/phpstan/phpstan/issues/10113
Alternative to https://github.com/phpstan/phpstan-src/pull/2728
You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x.
Looking good, but apparently I made Rector on Windows angry somehow?
This pull request has been marked as ready for review.
any idea what the (rector) issue might be here? it kept happening after a rebase, I don't want to rebase unnecessarily. wonder if I need to bump some rector cache key?
Got inspired by CleaningParserTest and ended up writing the test a bit different. WDYT? the (stolen) core part could be useful for more traverse/transform tests if needed, but it felt not right to try to make it generic now.
Rector still doesn't like me here apparently :/
I believe this one is ready (for review) again. I was just waiting for you to switch to the simplified downgrader :)
The failures in Rector worry me a bit: https://github.com/phpstan/phpstan-src/actions/runs/7420725636/job/20192723240
I don't know Rector well enough but I guess the errors related to that if/else rector mean that the change here is not possible. Is https://github.com/phpstan/phpstan-src/pull/2728 a better alternative after all, maybe? Or something else? 🤔