Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
34 | private function findTexts(string $pattern, string $content, int $textPosition): array |
||
35 | 14 | { |
|
36 | $texts = []; |
||
37 | 14 | preg_match_all($pattern, $content, $matches); |
|
38 | $matchesCount = count($matches[0]); |
||
39 | for ($i = 0; $i < $matchesCount; ++$i) { |
||
40 | 16 | $text = trim($matches[$textPosition][$i]); |
|
41 | if ($text === '') { |
||
42 | continue; |
||
43 | } |
||
44 | $texts[trim($matches[0][$i])] = $text; |
||
45 | } |
||
46 | return $texts; |
||
47 | } |
||
49 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.