Passed
Pull Request — master (#75)
by
unknown
11:58 queued 10:50
created

CallbackRuleException::getSolution()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 11
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 1
cp 0
crap 2
rs 9.9
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Exception;
6
7
use Yiisoft\FriendlyException\FriendlyExceptionInterface;
8
9
class CallbackRuleException extends \Exception implements FriendlyExceptionInterface
10
{
11
    public function getName(): string
12
    {
13
        return 'Invalid callable return value';
14
    }
15
16
    public function getSolution(): ?string
17
    {
18
        return <<<SOLUTION
19
            The callback must return an instance of \\Yiisoft\\Validator\\Result. An example of a valid callback:
20
                static function (): \\Yiisoft\\Validator\\Result
21
                {
22
                    \$result = new \\Yiisoft\\Validator\\Result();
23
24
                    ...
25
26
                    return \$result;
27
                }
28
        SOLUTION;
29
    }
30
}
31