-
-
Notifications
You must be signed in to change notification settings - Fork 379
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
Fix MultiDirnameRector #6796
Fix MultiDirnameRector #6796
Conversation
@@ -7,16 +7,6 @@ function multiDirname() | |||
dirname(dirname($path)); | |||
|
|||
new dirname(dirname(dirname($path))); | |||
|
|||
|
|||
// untouched |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved these cases to a new file to be able to check that the rule is not actually applied
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 👏
|
||
dirname($path, 1); | ||
|
||
dirname($path, 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In these cases the rule would have been applied even though no actual change was made in the code
@@ -56,12 +56,14 @@ public function refactor(Node $node): ?Node | |||
$activeFuncCallNode = $node; | |||
$lastFuncCallNode = $node; | |||
|
|||
$shouldUpdate = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We check that there is at least one nested dirname call, if not the rule is not applied
Derived from #6794