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.
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);
}
}
class OrderProcessor {
public function process(Order $order): void {
$this->validateOrder($order);
}
private function validateOrder(Order $order): void {
// ...
}
}
private.$this->methodName()) within the class.public or protected (as they might be called externally).E0013 has no configuration options and is enabled by default.
If a private helper method is no longer used after a refactor, delete it! Don’t leave dead code lingering in your classes.