1 | <?php |
||
2 | |||
3 | namespace Cocur\Chain\Link; |
||
4 | |||
5 | /** |
||
6 | * Fill. |
||
7 | * |
||
8 | * @author Florian Eckerstorfer |
||
9 | * @copyright 2015-2018 Florian Eckerstorfer |
||
10 | */ |
||
11 | trait Fill |
||
12 | { |
||
13 | /** |
||
14 | * Create a new Chain and fill with values. |
||
15 | * |
||
16 | * Creates a new Chain and fills the array with `num` entries of the value of `value` parameters, keys starting |
||
17 | * at the `startIndex` parameter. |
||
18 | * |
||
19 | * @param int $startIndex The first index of the array. If `startIndex` is negative, the first index of the |
||
20 | * returned array will be `startIndex` and the following indices will start from zero. |
||
21 | * @param int $num Number of elements to insert. Must be greater than or equal to zero. |
||
22 | * @param mixed $value value to use for filling |
||
23 | * |
||
24 | * @return self |
||
25 | */ |
||
26 | 1 | public static function fill(int $startIndex, int $num, $value = null): self |
|
27 | { |
||
28 | 1 | return new self(array_fill($startIndex, $num, $value)); |
|
0 ignored issues
–
show
|
|||
29 | } |
||
30 | } |
||
31 |
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.