Skip to content

Remove SwapFuncCallArgumentsRector as keeps swaping to infinity, use custom rule instead#4874

Merged
TomasVotruba merged 6 commits intomainfrom
tv-cleanup-unused-rules
Aug 28, 2023
Merged

Remove SwapFuncCallArgumentsRector as keeps swaping to infinity, use custom rule instead#4874
TomasVotruba merged 6 commits intomainfrom
tv-cleanup-unused-rules

Conversation

@TomasVotruba
Copy link
Copy Markdown
Member

@TomasVotruba TomasVotruba commented Aug 28, 2023

Follow up to #4766

The SwapFuncCallArgumentsRector keeps swaping argument on every single Rector run. This will lead to broken code on 2nd run and is hard to spot. Instead use custom rule to change the arguments position, checking for type, name etc. to make sure the swap happens once and rule is deterministic 👍

@TomasVotruba TomasVotruba changed the title tv cleanup unused rules Remove SwapFuncCallArgumentsRector as keeps swaping to infinity, use custom rules instead Aug 28, 2023
@TomasVotruba TomasVotruba changed the title Remove SwapFuncCallArgumentsRector as keeps swaping to infinity, use custom rules instead Remove SwapFuncCallArgumentsRector as keeps swaping to infinity, use custom rule instead Aug 28, 2023
@TomasVotruba TomasVotruba force-pushed the tv-cleanup-unused-rules branch from aa56294 to 00b0cae Compare August 28, 2023 12:38
Comment on lines +122 to +125
if ($this->annotationsToAttributes === []) {
throw new ConfigurationException(sprintf('The "%s" rule requires configuration.', self::class));
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It seems people add this rule and expect to convert all annotations to attributes. Then they come to Github issue to report.

Instead, we can make this feedback loop shorter and let them now immediately :)

@TomasVotruba TomasVotruba force-pushed the tv-cleanup-unused-rules branch from b0ba1f1 to de9ec62 Compare August 28, 2023 12:40
@TomasVotruba TomasVotruba merged commit 9e8ed6c into main Aug 28, 2023
@TomasVotruba TomasVotruba deleted the tv-cleanup-unused-rules branch August 28, 2023 12:43
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.

1 participant