Passed
Push — master ( ce7b1b...4d0c94 )
by
unknown
03:04
created

EachDto::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Tests\TestEnvironments\Support\Data;
6
7
use Yiisoft\Validator\Result;
8
use Yiisoft\Validator\Rule\Callback;
9
use Yiisoft\Validator\Rule\Each;
10
11
#[Each([
12
    new Callback(method: 'validate'),
13
])]
14
final class EachDto
15
{
16
    public function __construct(
17
        public int $a,
18
        public int $b,
19
        public int $c,
20
    ) {
21
    }
22
23
    private function validate(int $value): Result
0 ignored issues
show
Unused Code introduced by
The method validate() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
24
    {
25
        $result = new Result();
26
27
        if ($value !== 0) {
28
            $result->addError('Value must be zero.');
29
        }
30
31
        return $result;
32
    }
33
}
34