Skip to content

RemoveUnusedPrivateMethodRector removes used method #9611

@jlherren

Description

@jlherren

Bug Report

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

Minimal PHP Code Causing Issue

See https://getrector.com/demo/07d5cff5-af68-474a-b118-69b15b6f1d6f

<?php

declare(strict_types=1);

namespace Bug;

final class Bug {
    public function getString(): string {
        return $this->getNull() ?? 'Hey';
    }

    private function getNull(): ?string {
        return null;
    }
}

Responsible rules

  • RemoveUnusedPrivateMethodRector

Expected Behavior

The method should not be removed, as it is actually used.

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