Skip to content

SingularSwitchToIfRector does not work with multiple break statements #9903

Description

@raphaelincert

Bug Report

Subject Details
Rector version 2.6.7

Hi,
the rule SingularSwitchToIfRector does not work with multiple break statements.
If a switch has only one case but one case uses multiple break statements the rule will only remove the last break statement and leave the others.
Change results in:
Fatal error: 'break' not in the 'loop' or 'switch' context in

Best regards

Minimal PHP Code Causing Issue

https://getrector.com/demo/536962e6-04c9-4406-9bc4-09c8b38810a8

Expected Behaviour

No change

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions