Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Traverser] Refactor BetterNodeFinder::findFirstNext() to remove next attribute usage #3879

Merged
merged 19 commits into from
May 18, 2023

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented May 17, 2023

@TomasVotruba @staabm this is continue of PR:

to remove next attribute usage on BetterNodeFinder::findFirstNext()

Ref rectorphp/rector#7940

@samsonasik samsonasik marked this pull request as draft May 17, 2023 14:51
@TomasVotruba TomasVotruba marked this pull request as ready for review May 17, 2023 19:36
@samsonasik samsonasik marked this pull request as draft May 17, 2023 19:53
@samsonasik samsonasik marked this pull request as ready for review May 18, 2023 00:06
@samsonasik samsonasik marked this pull request as draft May 18, 2023 00:12
@samsonasik
Copy link
Member Author

It seems cause error infinite loop, I will check more :)

@samsonasik samsonasik marked this pull request as ready for review May 18, 2023 09:24
Comment on lines +554 to +556
// todo: use +1 key once all next node attribute reference and NodeConnectingVisitor removed
// left with add SlimNodeConnectingVisitor for only lookup parent
return $node->getAttribute(AttributeKey::NEXT_NODE);
Copy link
Member Author

Choose a reason for hiding this comment

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

@TomasVotruba @staabm I tried many things, and it keep crashing/infinite loop without this one left over.

I think this part can be removed once we have all next/prev node attribute removed and removed the NodeConnectingVisitor, left with add SlimNodeConnectingVisitor for only lookup parent

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I think it is good enough for now 👍

@samsonasik
Copy link
Member Author

@TomasVotruba I am merging it for now, in separate PR, i will try improve StmtKeyNodeVisitor itself to avoid parent lookup by something like "afterTraverse" and if possible, remove this left over next usage in BetterNodeFinder

@samsonasik samsonasik merged commit b064922 into main May 18, 2023
@samsonasik samsonasik deleted the refactor-find-first-next branch May 18, 2023 14:14
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.

2 participants