Skip to content

Conversation

@samsonasik
Copy link
Member

…rPromotionRector+RemoveParentDelegatingConstructorRector
Comment on lines 140 to 146
// this reindex is needed as when multiple rules apply
// the existing node position can already be removed/moved by different rule from "parent" node
//
// that modify/remove deep node, for example:
// - first rule: - Class_ → ClassMethod → remove index 0
// - second rule: - ClassMethod → here fetch the index 0 no longer exists
NodeAttributeReIndexer::reIndexNodeAttributes($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 this is the fix, the reindex early before refactor() is needed, as the node position can already be removed by other rule that use parent node as node type to check.

I added comment above for future reference.

@samsonasik
Copy link
Member Author

Fixed 🎉 /cc @raneomik

@samsonasik
Copy link
Member Author

@TomasVotruba ready 👍

@samsonasik
Copy link
Member Author

samsonasik commented Jan 3, 2026

@TomasVotruba I created alternative PR for it at:

which reindex is only on after refactor when refactored node returned, but with traverser to avoid issues when multiples rules apply, and higher node remove deep node so reindex is needed in deep.

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.

Type error in "RemoveParentDelegatingConstructorRector::matchParentConstructorCallArgs" in a combination with a large PhpSet

2 participants