Skip to content

Conversation

@samsonasik
Copy link
Member

@samsonasik samsonasik commented Dec 21, 2025

Per #7717 (review)
Ref https://getrector.com/demo/325600d2-b50f-4c59-aff5-66e0a8519ebb

That cause deep {} empty not removed by ReplaceBlockToItsStmtsRector as the $nodesabove too early removed and stopped.

This PR add fixture test and will provide a patch for it :)

… for InlineIfToExplicitIfRector + ReplaceBlockToItsStmtsRector
if ($originalNodeNodeClass !== $return::class) {
// stop traversing as node type changed and visitors won't work
return $nodes;
continue 2;
Copy link
Member Author

@samsonasik samsonasik Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomasVotruba this is the fix, it will continue to next nodes as node is on outer loop of collection of nodes, as different nodes not yet visited :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought return would stop everything too soon.
Looks good 👍

@samsonasik
Copy link
Member Author

@TomasVotruba ready 👍, let's merge as this obvious bug :)

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