phpstan-src icon indicating copy to clipboard operation
phpstan-src copied to clipboard

Transform `if` / `else if` into flat `if` / `elseif` when possible

Open herndlm opened this issue 2 years ago • 7 comments

Closes https://github.com/phpstan/phpstan/issues/10113

Alternative to https://github.com/phpstan/phpstan-src/pull/2728

herndlm avatar Nov 30 '23 19:11 herndlm

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.

phpstan-bot avatar Nov 30 '23 19:11 phpstan-bot

Looking good, but apparently I made Rector on Windows angry somehow?

herndlm avatar Nov 30 '23 19:11 herndlm

This pull request has been marked as ready for review.

phpstan-bot avatar Nov 30 '23 19:11 phpstan-bot

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?

herndlm avatar Dec 05 '23 15:12 herndlm

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 :/

herndlm avatar Dec 09 '23 20:12 herndlm

I believe this one is ready (for review) again. I was just waiting for you to switch to the simplified downgrader :)

herndlm avatar Dec 18 '23 13:12 herndlm

The failures in Rector worry me a bit: https://github.com/phpstan/phpstan-src/actions/runs/7420725636/job/20192723240

ondrejmirtes avatar Jan 05 '24 13:01 ondrejmirtes

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? 🤔

herndlm avatar Mar 29 '24 19:03 herndlm