Conditions | 10 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 2 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
77 | protected function compileMatches($c, $a, $b, $i, $j, &$matches) |
||
78 | { |
||
79 | if ($i > 0 && $j > 0 && $this->matchStrategy->isMatch($a[$i - 1], $b[$j - 1])) { |
||
80 | $this->compileMatches($c, $a, $b, $i - 1, $j - 1, $matches); |
||
81 | $matches[$i] = $j; |
||
82 | } elseif ($j > 0 && ($i === 0 || $c[$i][$j - 1] >= $c[$i - 1][$j])) { |
||
83 | $this->compileMatches($c, $a, $b, $i, $j - 1, $matches); |
||
84 | } elseif ($i > 0 && ($j === 0 || $c[$i][$j - 1] < $c[$i - 1][$j])) { |
||
85 | $this->compileMatches($c, $a, $b, $i - 1, $j, $matches); |
||
86 | } |
||
87 | } |
||
88 | } |
||
89 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.