Repository navigation
[CodeQuality][PHPUnit80] Return node when arg removed in place, so change is recorded - #810
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two rules remove a method argument in place but then
return nullon some branches. The AST is mutated, yet the change is not reported through the returned node.AssertCompareOnCountableWithMethodToAssertCountRector: theCountablemethod-call branch rewrites$node->argsand renames the method, then fell through toreturn null. Now returns$node.AssertEqualsParameterToSpecificMethodsTypeRector:refactor()unsets the max-depth arg (index 4) but could still return null viaprocessAssertEqualsWithDelta(); that helper also unset the default delta arg then returned null. Both now return the mutated node.Output is unchanged - the mutation was already applied in place and picked up by the printer content diff. The fix makes the rules report the change through the return value, which is the rule contract (
refactor()returns the node when it changed it, null otherwise).Full suite green against rector-src main and against the upcoming FileProcessor print-skip change (rectorphp/rector-src#8791), which relies on rules honoring that contract.