phanalist

E0013: Private Method Not Being Called

In plain English: This rule finds private methods inside your classes that are never actually called anywhere in that class.

Why it matters: Dead code clutters your codebase, confuses other developers reading the class, and leaves behind abandoned helper logic that is tested or maintained for no reason.

❌ The Bad Example

class OrderProcessor {
    public function process(Order $order): void {
        $this->validateOrder($order);
    }

    private function validateOrder(Order $order): void {
        // ...
    }

    // Unused private method left over from refactoring
    private function oldFormattingHelper(string $data): string {
        return strtoupper($data);
    }
}

✅ The Good Example

class OrderProcessor {
    public function process(Order $order): void {
        $this->validateOrder($order);
    }

    private function validateOrder(Order $order): void {
        // ...
    }
}

What the rule checks

When it does not report

How to fix

Configuration

E0013 has no configuration options and is enabled by default.

Junior Engineer’s Rule of Thumb:

If a private helper method is no longer used after a refactor, delete it! Don’t leave dead code lingering in your classes.