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

Incorrect behavior of RemoveUnusedPrivateMethodRector, RemoveAlwaysElseRector #6670

Closed
Bl00D4NGEL opened this issue Aug 31, 2021 · 0 comments · Fixed by rectorphp/rector-src#807
Labels

Comments

@Bl00D4NGEL
Copy link
Contributor

Bug Report

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

Minimal PHP Code Causing Issue

See https://getrector.org/demo/1ec0a727-cd6b-633e-9617-33d1d4395dd3

<?php

declare(strict_types=1);

namespace App;

final class Client
{
    public function doRequest(): int
    {
        if (401 === 200) {
            return -1;
        } else {
            return $this->notUnused();
        }
    }

    private function notUnused(): int
    {
        // This is some code that is very important
    }
}

Responsible rules

  • RemoveUnusedPrivateMethodRector

  • RemoveAlwaysElseRector

Expected Behavior

<?php

declare(strict_types=1);

namespace App;

final class Client
{
    public function doRequest(): int
    {
        if (401 === 200) {
            return -1;
        }

        return $this->notUnused();
    }

    private function notUnused(): int
    {
        // This is some code that is very important
    }
}
?>

Test fixture will be supplied in a following MR in a bit :)

@Bl00D4NGEL Bl00D4NGEL added the bug label Aug 31, 2021
samsonasik added a commit to rectorphp/rector-src that referenced this issue Sep 1, 2021
TomasVotruba pushed a commit to rectorphp/rector-src that referenced this issue Sep 1, 2021
…veAlwaysElseRector (#807)

* added failing test fixture

* update

* update

* Closes #801 Fixes rectorphp/rector#6670

Co-authored-by: Bl00D4NGEL <kuhlesdominik@gmx.de>
TomasVotruba added a commit that referenced this issue Jan 16, 2025
rectorphp/rector-src@6085713 [BetterPhpDocParser] Check for closing brace in text content (#8977) (#6670)
TomasVotruba added a commit that referenced this issue Jan 16, 2025
rectorphp/rector-src@6085713 [BetterPhpDocParser] Check for closing brace in text content (#8977) (#6670)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant