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] Handle consecutive equal case stmts on RemoveDuplicatedCaseInSwitchRector #6392

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

samsonasik
Copy link
Member

@samsonasik
Copy link
Member Author

Fixed 🎉 /cc @dionis-svk

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit a130d2b into main Oct 21, 2024
36 checks passed
@samsonasik samsonasik deleted the handle-consecutive-equals branch October 21, 2024 12:07
@samsonasik
Copy link
Member Author

It seems still have issue with multiple equal case consecutive but jump different stmts result:

class ConsecutiveEqualCaseStmts3
{
    public function run()
    {
      $item = 'a';
      switch ($item) {
        case 'a':
        case 'b':
          return 'val1';
        case 'c':
          return 'val2';
        case 'd':
        case 'e':
          return 'val5';
        case 'f':
        case 'g':
          return 'val2';
        case 'h':
          return 'val2';
        case 'i':
          return 'val3';
      }
      return $item;
    }
}

i will check if it resolvable or just skip it as too complex to handle :)

@samsonasik
Copy link
Member Author

#6393

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.

Incorrect behavior of RemoveDuplicatedCaseInSwitchRector
1 participant