1.2.1014. Public Reach To Private Methods¶
This rule reports the ways to reach private and protected methods, by using only public methods.
Each internal is reported here, with the origin and destination. When connecting the calls from methods to method, it is possible to draw the path from public methods to private methods.
This class map is useful to prepare tests and improve coverage by targeting public methods that may use restricted methods.
Note that conditions will apply (pun intended) : a link between two methods only means that one may call the other, given the right conditions.
<?php
class A {
// This method be reached publicly, and it triggers a call to bar()
public function foo() {
$this->bar();
}
// This method cannot be reached publicly
private function bar() {
// doSomething()
}
}
?>
1.2.1014.1. Connex PHP features¶
1.2.1014.1.1. Specs¶
Short name |
Dump/PublicReach |
Rulesets |
|
Exakat since |
2.3.6 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |