1.2.1009. Property Used Above¶
Property used in the parent classes. If the definition of the property is in the child class, then the parent should not know about it and make usage of it.
It may also be used in the current class, or its children, though this is not reported by this analyzer.
<?php
class A {
public function foo() {
$this->pb++;
}
}
class B extends A {
protected $pb = 0; // property used above
protected $pb2 = 0; // property NOT used above
}
?>
See also Property Used Below.
1.2.1009.1. Connex PHP features¶
1.2.1009.1.1. Suggestions¶
Move the definition of the property to the upper class
Move the usage of the property to the lower class
1.2.1009.1.2. Specs¶
Short name |
Classes/PropertyUsedAbove |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
|
Time To Fix |
Slow (1 hour) |
Precision |
Medium |
Available in |