Passed
Pull Request — master (#25)
by Alexander
14:50
created

ValidatorTestRefModel::getMain()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
namespace Yiisoft\Validator\Tests\data;
3
4
use Yiisoft\Validator\DataSetInterface;
5
6
class ValidatorTestRefModel implements DataSetInterface
7
{
8
    public $test_val = 2;
9
    public $test_val_fail = 99;
10
11
    public function getValue(string $key)
12
    {
13
        if (property_exists(self::class, $key)) {
14
            return $this->$key;
15
        }
16
    }
17
18
    public static function tableName()
19
    {
20
        return 'validator_ref';
21
    }
22
23
    public function getMain()
24
    {
25
        return $this->hasOne(ValidatorTestMainModel::class, ['id' => 'ref']);
0 ignored issues
show
Bug introduced by
The method hasOne() does not exist on Yiisoft\Validator\Tests\data\ValidatorTestRefModel. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
        return $this->/** @scrutinizer ignore-call */ hasOne(ValidatorTestMainModel::class, ['id' => 'ref']);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
    }
27
}
28