8000 Replace `continue;` by `break;` in a switch body · Issue #5646 · rectorphp/rector · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Replace continue; by break; in a switch body #5646
Closed
@roxblnfk

Description

@roxblnfk

Feature Request

Diff

continue 1; (or continue;) in a switch body always works like break;.

$value = 1;
$suffix = 'M';
switch ($suffix) {
    case 'M':
        $value *= 1024 * 1024;
-       continue;
+       break;
    case 'K':
        $value *= 1024;
}

Using of continue 1 also throws warning (php >= 7.3):
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

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

      0