1.2.106. Cancel Common Method

A parent method’s is too little used in children.

The parent class has a method, which is customised in children classes, though most of the time, those are empty : hence, cancelled. A threshold of cancelThreshold % of the children methods have to be cancelled to report the parent class. By default, it is 75 (or 3 out of 4).

<?php

class x {
    abstract function foo();
    abstract function bar();
}

class y1 extends x {
    function foo() { doSomething(); }
    function bar() { doSomething(); };
}

class y2 extends x {
    // foo is cancelled : it must be written, but has no use.
    function foo() {  }
    function bar() { doSomething(); };
}

?>

Name

Default

Type

Description

cancelThreshold

75

integer

Minimal number of cancelled methods to suggest the cancellation of the parent.

1.2.106.1. Suggestions

  • Drop the common method, and the cancelled methods in the children

  • Fill the children’s methods with actual code

1.2.106.2. Specs

Short name

Classes/CancelCommonMethod

Rulesets

All, Changed Behavior, Class Review, Suggestions

Exakat since

2.1.8

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Features

class

Available in

Entreprise Edition, Exakat Cloud