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

ValidatorTestMainModel::getReferences()   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
5
use Yiisoft\Validator\DataSetInterface;
6
7
class ValidatorTestMainModel implements DataSetInterface
8
{
9
    public $testMainVal = 1;
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_main';
21
    }
22
23
    public function getReferences()
24
    {
25
        return $this->hasMany(ValidatorTestRefModel::class, ['ref' => 'id']);
0 ignored issues
show
Bug introduced by
The method hasMany() does not exist on Yiisoft\Validator\Tests\...\ValidatorTestMainModel. ( 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 */ hasMany(ValidatorTestRefModel::class, ['ref' => 'id']);

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