GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 51efb0...4d5462 )
by Marco
01:21
created

IsIterable::__construct()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 1
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Marcosh\PhpValidationDSL\Basic;
6
7
use Marcosh\PhpValidationDSL\Translator\Translator;
8
use Marcosh\PhpValidationDSL\Validation;
9
use function is_callable;
10
11
final class IsIterable extends ComposingAssertion implements Validation
12
{
13
    public const NOT_AN_ITERABLE = 'is-iterable.not-an-iterable';
14
15
    public function __construct(?callable $errorFormatter = null)
16
    {
17
        $this->isAsAsserted = IsAsAsserted::withAssertionAndErrorFormatter(
18
            'is_iterable',
19
            is_callable($errorFormatter) ?
0 ignored issues
show
Bug introduced by
It seems like is_callable($errorFormat...tion(...) { /* ... */ } can also be of type null; however, parameter $errorFormatter of Marcosh\PhpValidationDSL...tionAndErrorFormatter() does only seem to accept callable, maybe add an additional type check? ( Ignorable by Annotation )

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

19
            /** @scrutinizer ignore-type */ is_callable($errorFormatter) ?
Loading history...
20
                $errorFormatter :
21
                function ($data) {
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

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

21
                function (/** @scrutinizer ignore-unused */ $data) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
                    return [self::NOT_AN_ITERABLE];
23
                }
24
        );
25
    }
26
27
    public static function withTranslator(Translator $translator): self
28
    {
29
        return new self(function ($data) use ($translator) {
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

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

29
        return new self(function (/** @scrutinizer ignore-unused */ $data) use ($translator) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
            return [$translator->translate(self::NOT_AN_ITERABLE)];
31
        });
32
    }
33
}
34