Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — master (#678)
by Henrique
03:41
created

NoneOf::assert()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
c 0
b 0
f 0
ccs 7
cts 7
cp 1
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of Respect/Validation.
5
 *
6
 * (c) Alexandre Gomes Gaigalas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the "LICENSE.md"
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Respect\Validation\Rules;
13
14
use Respect\Validation\Result;
15
use Respect\Validation\Rule;
16
17
/**
18
 * Validates if none of the given validators validate.
19
 *
20
 * @author Alexandre Gomes Gaigalas <[email protected]>
21
 * @author Henrique Moody <[email protected]>
22
 *
23
 * @since 0.3.9
24
 */
25
final class NoneOf implements Rule
26
{
27
    /**
28
     * @var Rule[]
29
     */
30
    private $rules = [];
31
32
    /**
33
     * Initializes the rule.
34
     *
35
     * @param Result $child
0 ignored issues
show
Bug introduced by
There is no parameter named $child. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
36
     * @param Result ...$child2
37
     */
38 1
    public function __construct(Rule ...$rule)
39
    {
40 1
        $this->rules = $rule;
41 1
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 19
    public function validate($input): Result
47
    {
48 19
        $isValid = true;
49 19
        $childrenResults = [];
50 19
        foreach ($this->rules as $rule) {
51
            $childResult = $rule
52 19
                ->validate($input)
53 19
                ->invert();
54
55 19
            $isValid = $isValid && $childResult->isValid();
56 19
            $childrenResults[] = $childResult;
57
        }
58
59 19
        return new Result($isValid, $input, $this, [], ...$childrenResults);
60
    }
61
}
62