Completed
Push — master ( 7f89eb...d01340 )
by Portey
05:11
created

AbstractInterfaceType::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
nc 1
cc 1
eloc 2
nop 0
crap 2
1
<?php
2
/*
3
* This file is a part of GraphQL project.
4
*
5
* @author Alexandr Viniychuk <[email protected]>
6
* created: 12/5/15 12:12 AM
7
*/
8
9
namespace Youshido\GraphQL\Type\Object;
10
11
12
use Youshido\GraphQL\Type\AbstractType;
13
use Youshido\GraphQL\Type\Config\Object\InterfaceTypeConfig;
14
use Youshido\GraphQL\Type\TypeMap;
15
16
abstract class AbstractInterfaceType extends AbstractType
17
{
18
19
20
    /**
21
     * ObjectType constructor.
22
     * @param $config
23
     */
24 1
    public function __construct($config = [])
25
    {
26 1
        if (empty($config)) {
27 1
            $config['name'] = $this->getName();
28 1
        }
29
30 1
        $this->config = new InterfaceTypeConfig($config, $this);
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Youshido\GraphQL\Ty...eConfig($config, $this) of type object<Youshido\GraphQL\...ct\InterfaceTypeConfig> is incompatible with the declared type object<Youshido\GraphQL\...\InputObjectTypeConfig> of property $config.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
31 1
    }
32
33
    public function getPossibleTypes()
34
    {
35
36
    }
37
38
    abstract  protected function build(InterfaceTypeConfig $config);
39
40 1
    public function checkBuild()
41
    {
42 1
        if (!$this->isBuild) {
43 1
            $this->isBuild = true;
44 1
            $this->build($this->config);
0 ignored issues
show
Documentation introduced by
$this->config is of type object<Youshido\GraphQL\...\InputObjectTypeConfig>, but the function expects a object<Youshido\GraphQL\...ct\InterfaceTypeConfig>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
45 1
        }
46 1
    }
47
48
    public function isPossibleType()
49
    {
50
51
    }
52
53
    public function getObjectType()
54
    {
55
56
    }
57
58
    public function getName()
59
    {
60
        return $this->getConfig()->get('name', 'InterfaceType');
61
    }
62
63 1
    public function getKind()
64
    {
65 1
        return TypeMap::KIND_INTERFACE;
66
    }
67
68
    public function isValidValue($value)
69
    {
70
        return true;
71
    }
72
73
}