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
Push — 2.0 ( 7d4223 )
by Henrique
05:27
created

StandardResult::getChildren()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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
/**
15
 * Class to handle validation.
16
 *
17
 * @author Henrique Moody <[email protected]>
18
 */
19
final class StandardResult implements Result
20
{
21
    /**
22
     * @var bool
23
     */
24
    private $isValid;
25
26
    /**
27
     * @var mixed
28
     */
29
    private $input;
30
31
    /**
32
     * @var Rule
33
     */
34
    private $rule;
35
36
    /**
37
     * @var Rule[]
38
     */
39
    private $children;
40
41
    /**
42
     * @var array
43
     */
44
    private $properties;
45
46
    /**
47
     * @param bool   $isValid
48
     * @param mixed  $input
49
     * @param Rule   $rule
50
     * @param array  $properties
51
     * @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...
52
     */
53 10
    public function __construct($isValid, $input, Rule $rule, array $properties = [], Result ...$children)
54
    {
55 10
        $this->isValid = $isValid;
56 10
        $this->input = $input;
57 10
        $this->rule = $rule;
58 10
        $this->properties = $properties;
59 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...
60 10
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65 8
    public function isValid(): bool
66
    {
67 8
        return $this->isValid;
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73 8
    public function getInput()
74
    {
75 8
        return $this->input;
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81 8
    public function getRule(): Rule
82
    {
83 8
        return $this->rule;
84
    }
85
86
    /**
87
     * {@inheritdoc}
88
     */
89 8
    public function getChildren(): array
90
    {
91 8
        return $this->children;
92
    }
93
94
    /**
95
     * {@inheritdoc}
96
     */
97 8
    public function getProperties(): array
98
    {
99 8
        return $this->properties;
100
    }
101
102
    /**
103
     * {@inheritdoc}
104
     */
105 7
    public function with($isValid, array $properties = []): Result
106
    {
107 7
        return new self(
108
            $isValid,
109 7
            $this->getInput(),
110 7
            $this->getRule(),
111 7
            $properties + $this->getProperties(),
112 7
            ...$this->getChildren()
113
        );
114
    }
115
}
116