-
-
Notifications
You must be signed in to change notification settings - Fork 351
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
Conversation
TomasVotruba
commented
May 17, 2021
•
edited
Loading
edited
- Fixes [TASK] Add failing test #64
- Fixes SetList::DEAD_CODE with SetList::SAFE_07 causes PHP Fatal error rector#6420
@@ -58,6 +58,10 @@ public function refactor(Node $node) | |||
return $this->removeNodeAndKeepComments($node); | |||
} | |||
|
|||
if ($livingCode === [$node->expr]) { |
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.
That´s it? I don´t get it.
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.
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
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.
This rule would deserve more refactoring to improve readability and logic behind it, but we have more important things to do 👍
82c4e5b
to
e504331
Compare
b254f67
to
57098c3
Compare
25df75b
to
e6453a2
Compare
Co-authored-by: Sebastian Schreiber <me@schreibersebastian.de> Co-authored-by: kaizen-ci <info@kaizen-ci.org>