Passed
Push — master ( dbf0a8...b29633 )
by
unknown
02:35
created

Foo::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Tests\Support\Data\EachNestedObjects;
6
7
use Yiisoft\Validator\Rule\Each;
8
use Yiisoft\Validator\Rule\Nested;
9
use Yiisoft\Validator\Rule\Required;
10
use Yiisoft\Validator\RulesProviderInterface;
11
12
final class Foo implements RulesProviderInterface
13
{
14
    public ?string $name = null;
15
16
    public array $bars;
17
18
    public function __construct()
19
    {
20
        $this->bars = [
21
            new Bar(),
22
        ];
23
    }
24
25
    public function getRules(): iterable
26
    {
27
        yield from [
28
            'name' => new Required(),
29
            'bars' => new Each([new Nested(Bar::class)]),
30
        ];
31
    }
32
}
33