Skip to content

Remove SwapMethodCallArgumentsRector as could lead to infinite swapping, use custom rule with type/value check instead#4766

Merged
TomasVotruba merged 1 commit intomainfrom
tv-avoid-dynamic-method-call-swap
Aug 11, 2023
Merged

Remove SwapMethodCallArgumentsRector as could lead to infinite swapping, use custom rule with type/value check instead#4766
TomasVotruba merged 1 commit intomainfrom
tv-avoid-dynamic-method-call-swap

Conversation

@TomasVotruba
Copy link
Copy Markdown
Member

@TomasVotruba TomasVotruba commented Aug 11, 2023

Introduced #3726

Since then I've realized this rule could lead to infinite argument swaps on each run. Which would condition to run Rector just once and make usage confusing.

Instead, it's better to create a custom rule for these swaps and check e.g. argument type and variable name to match their new positions. Only that way the rule can be idempotent and usable in CI 👍

…ng, use custom rule with type/value check instead
@TomasVotruba TomasVotruba merged commit cf1d5b0 into main Aug 11, 2023
@TomasVotruba TomasVotruba deleted the tv-avoid-dynamic-method-call-swap branch August 11, 2023 10:10
@gaydamakha
Copy link
Copy Markdown
Contributor

Yes indeed, I see the problem. I will use the custom one on my side instead.

@TomasVotruba
Copy link
Copy Markdown
Member Author

@gaydamakha Thanks for understanding 👍

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