1 | <?php |
||
17 | trait SearchableTrait |
||
18 | { |
||
19 | /** |
||
20 | * Return index of element |
||
21 | * |
||
22 | * @param mixed $element |
||
23 | * @return mixed |
||
24 | */ |
||
25 | 2 | public function indexOf($element) |
|
29 | |||
30 | /** |
||
31 | * Test if element in collection |
||
32 | * |
||
33 | * @param mixed $element |
||
34 | * @return bool |
||
35 | */ |
||
36 | 7 | public function contains($element) |
|
40 | |||
41 | /** |
||
42 | * Test if key exists in collection |
||
43 | * |
||
44 | * @param mixed $key |
||
45 | * @return bool |
||
46 | */ |
||
47 | 2 | public function keyExists($key) |
|
51 | |||
52 | /** |
||
53 | * Return new collection with elements filtered by function |
||
54 | * |
||
55 | * @param Closure $fn |
||
56 | * @return static |
||
57 | */ |
||
58 | 1 | public function filter(Closure $fn) |
|
62 | } |
||
63 |
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.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.