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

NestedWithCallbackAttribute   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validateB() 0 3 1
A validateA() 0 3 1
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\Nested;
10
11
#[Nested([
12
    'a' => new Callback(method: 'validateA'),
13
])]
14
final class NestedWithCallbackAttribute
15
{
16
    private int $a = 7;
0 ignored issues
show
introduced by
The private property $a is not used, and could be removed.
Loading history...
17
18
    #[Nested([
19
        'x' => new Callback(method: 'validateB'),
20
    ])]
21
    private array $b = [
0 ignored issues
show
introduced by
The private property $b is not used, and could be removed.
Loading history...
22
        'x' => 5,
23
    ];
24
25
    private function validateA(): Result
0 ignored issues
show
Unused Code introduced by
The method validateA() 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...
26
    {
27
        return (new Result())->addError('Invalid A.');
28
    }
29
30
    private function validateB(): Result
0 ignored issues
show
Unused Code introduced by
The method validateB() 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...
31
    {
32
        return (new Result())->addError('Invalid B.');
33
    }
34
}
35