Skip to content
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 RemoveDoubleAssignRector in case of method call #6442

Merged
merged 2 commits into from
Nov 16, 2024

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Nov 16, 2024

No description provided.

@TomasVotruba TomasVotruba changed the title tv double assign mix Fix RemoveDoubleAssignRector in case of method call Nov 16, 2024
@TomasVotruba TomasVotruba enabled auto-merge (squash) November 16, 2024 12:44
@TomasVotruba TomasVotruba enabled auto-merge (squash) November 16, 2024 12:45
@TomasVotruba TomasVotruba merged commit e7800e9 into main Nov 16, 2024
36 checks passed
@TomasVotruba TomasVotruba deleted the tv-double-assign-mix branch November 16, 2024 12:46
@@ -116,6 +103,11 @@ public function refactor(Node $node): ?Node
continue;
}

// next stmts can have side effect as well
if ($nextAssign->expr instanceof MethodCall) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs more specific check, eg:

Suggested change
if ($nextAssign->expr instanceof MethodCall) {
if (($nextAssign->var instanceof PropertyFetch || $nextAssign->var instanceof StaticPropertyFetch) && $nextAssign->expr instanceof MethodCall) {

like in line 111, I will create new PR for it

Copy link
Member

Choose a reason for hiding this comment

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

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