Completed
Push — master ( b96c3f...17a0ce )
by Florian
15s queued 11s
created

src/Link/Fill.php (1 issue)

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
The call to Cocur\Chain\Link\Fill::__construct() has too many arguments starting with array_fill($startIndex, $num, $value). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        return /** @scrutinizer ignore-call */ new self(array_fill($startIndex, $num, $value));

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.

Loading history...
29
    }
30
}
31