1.2.493. Functions In Loop Calls¶
The following functions call each-other in a loop fashion : A -> B -> A.
When those functions have no other interaction, the code is useless and should be dropped.
Loops of size 2, 3 and 4 function are supported by this analyzer.
<?php
function foo1($a) {
if ($a < 1000) {
return foo2($a + 1);
}
return $a;
}
function foo2($a) {
if ($a < 1000) {
return foo1($a + 1);
}
return $a;
}
// if foo1 nor foo2 are called, then this is dead code.
// if foo1 or foo2 are called, this recursive call should be investigated.
?>
1.2.493.1. Connex PHP features¶
1.2.493.1.1. Suggestions¶
Drop all the functions in the loop, as they are dead code
1.2.493.1.2. Specs¶
Short name |
Functions/LoopCalling |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Slow (1 hour) |
Precision |
Very high |
Available in |