Passed
Pull Request — master (#464)
by Sergei
11:05
created

ObjectWithPostValidationHook   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getAttributeValue() 0 3 1
A getData() 0 3 1
A hasAttribute() 0 3 1
A getSource() 0 3 1
A processValidationResult() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Tests\Support\Data;
6
7
use Yiisoft\Validator\PostValidationHookInterface;
8
use Yiisoft\Validator\Result;
9
10
final class ObjectWithPostValidationHook implements PostValidationHookInterface
11
{
12
    public static $hookCalled = false;
13
14
    public function getAttributeValue(string $attribute): mixed
15
    {
16
        return null;
17
    }
18
19
    public function getData(): ?array
20
    {
21
        return null;
22
    }
23
24
    public function getSource(): array
25
    {
26
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Yiisoft\Validator\Tests\...tWithPostValidationHook which is incompatible with the type-hinted return array.
Loading history...
27
    }
28
29
    public function hasAttribute(string $attribute): bool
30
    {
31
        return false;
32
    }
33
34
    public function processValidationResult(Result $result): void
35
    {
36
        self::$hookCalled = true;
37
    }
38
}
39