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
04:08
created

StandardResult   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 97
ccs 25
cts 25
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A isValid() 0 4 1
A getInput() 0 4 1
A getRule() 0 4 1
A getChildren() 0 4 1
A getProperties() 0 4 1
A with() 0 10 1
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;
13
14
use Respect\Validation\Exceptions\ComponentException;
15
16
/**
17
 * Class to handle validation.
18
 *
19
 * @author Henrique Moody <[email protected]>
20
 */
21
final class StandardResult implements Result
22
{
23
    /**
24
     * @var bool
25
     */
26
    private $isValid;
27
28
    /**
29
     * @var mixed
30
     */
31
    private $input;
32
33
    /**
34
     * @var Rule
35
     */
36
    private $rule;
37
38
    /**
39
     * @var Rule[]
40
     */
41
    private $children;
42
43
    /**
44
     * @var array
45
     */
46
    private $properties;
47
48
    /**
49
     * @param bool   $isValid
50
     * @param mixed  $input
51
     * @param Rule   $rule
52
     * @param array  $properties
53
     * @param Result $children...
0 ignored issues
show
Documentation introduced by
There is no parameter named $children.... Did you maybe mean $children?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

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

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

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

Loading history...
54
     */
55 10
    public function __construct($isValid, $input, Rule $rule, array $properties = [], Result ...$children)
56
    {
57 10
        $this->isValid = $isValid;
58 10
        $this->input = $input;
59 10
        $this->rule = $rule;
60 10
        $this->properties = $properties;
61 10
        $this->children = $children;
0 ignored issues
show
Documentation Bug introduced by
It seems like $children of type array<integer,object<Respect\Validation\Result>> is incompatible with the declared type array<integer,object<Respect\Validation\Rule>> of property $children.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
62 10
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67 8
    public function isValid()
68
    {
69 8
        return $this->isValid;
70
    }
71
72
    /**
73
     * {@inheritdoc}
74
     */
75 8
    public function getInput()
76
    {
77 8
        return $this->input;
78
    }
79
80
    /**
81
     * {@inheritdoc}
82
     */
83 8
    public function getRule()
84
    {
85 8
        return $this->rule;
86
    }
87
88
    /**
89
     * {@inheritdoc}
90
     */
91 8
    public function getChildren()
92
    {
93 8
        return $this->children;
94
    }
95
96
    /**
97
     * {@inheritdoc}
98
     */
99 8
    public function getProperties()
100
    {
101 8
        return $this->properties;
102
    }
103
104
    /**
105
     * {@inheritdoc}
106
     */
107 7
    public function with($isValid, array $properties = [])
108
    {
109 7
        return new self(
110 7
            $isValid,
111 7
            $this->getInput(),
112 7
            $this->getRule(),
113 7
            $properties + $this->getProperties(),
114 7
            ...$this->getChildren()
115 7
        );
116
    }
117
}
118