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

ChangeSwitchToMatchRector eating comment #8702

Closed
jorgsowa opened this issue Jun 28, 2024 · 0 comments · Fixed by rectorphp/rector-src#6394
Closed

ChangeSwitchToMatchRector eating comment #8702

jorgsowa opened this issue Jun 28, 2024 · 0 comments · Fixed by rectorphp/rector-src#6394
Labels

Comments

@jorgsowa
Copy link

Bug Report

Subject Details
Rector version last dev-main
Installed as composer dependency

Minimal PHP Code Causing Issue

See https://getrector.com/demo/71ea7a79-61c4-44d3-a655-69b385710524

<?php

final class DemoFile
{
    public function run(bool $permission): bool
    {
        switch ($permission) {
            case 'VIEW':
                return false;
            case 'EDIT':
                return true;
        }

        // Comment
        return true;
    }
}

Responsible rules

  • ChangeSwitchToMatchRector

Expected Behavior

<?php

final class DemoFile
{
    public function run(bool $permission): bool
    {
        return match ($permission) {
            'VIEW' => false,
            'EDIT' => true,
       	 // Comment
            default => true,
        };
     }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant