1.2.1002. Property Used Above¶
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.1002.1. Suggestions¶
Move the definition of the property to the upper class
Move the usage of the property to the lower class
1.2.1002.2. Specs¶
Short name |
Classes/PropertyUsedAbove |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
|
Time To Fix |
Slow (1 hour) |
Precision |
Medium |
Features |
property, inheritance |
Available in |