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

[DeadCode] Fix remove dead stmt Rector #65

Merged
merged 7 commits into from
May 17, 2021
Merged

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented May 17, 2021

@TomasVotruba TomasVotruba changed the title issue 6420 failing test [DeadCode] Fix remove dead stmt Rector May 17, 2021
@@ -58,6 +58,10 @@ public function refactor(Node $node)
return $this->removeNodeAndKeepComments($node);
}

if ($livingCode === [$node->expr]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

That´s it? I don´t get it.

Copy link
Member Author

Choose a reason for hiding this comment

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

It means that the code that should be kept alive (not removed) is the same as current node.
Nothing to be removed, just return null

Copy link
Member Author

Choose a reason for hiding this comment

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

This rule would deserve more refactoring to improve readability and logic behind it, but we have more important things to do 👍

@TomasVotruba TomasVotruba force-pushed the issue-6420-failing-test branch 2 times, most recently from 82c4e5b to e504331 Compare May 17, 2021 21:54
@TomasVotruba TomasVotruba enabled auto-merge (squash) May 17, 2021 21:54
@TomasVotruba TomasVotruba merged commit 92358f7 into main May 17, 2021
@TomasVotruba TomasVotruba deleted the issue-6420-failing-test branch May 17, 2021 23:40
samsonasik pushed a commit that referenced this pull request May 18, 2021
Co-authored-by: Sebastian Schreiber <me@schreibersebastian.de>
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
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.

SetList::DEAD_CODE with SetList::SAFE_07 causes PHP Fatal error
2 participants