Completed
Push — master ( 461e07...b4459a )
by Alexandr
03:37
created

AbstractUnionType::resolveType()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 1 Features 1
Metric Value
c 4
b 1
f 1
dl 0
loc 1
ccs 0
cts 0
cp 0
nc 1
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\UnionTypeConfig;
14
use Youshido\GraphQL\Type\Config\Traits\ConfigCallTrait;
15
use Youshido\GraphQL\Type\Config\TypeConfigInterface;
16
use Youshido\GraphQL\Type\Traits\AutoNameTrait;
17
use Youshido\GraphQL\Type\TypeMap;
18
19
abstract class AbstractUnionType extends AbstractType
20
{
21
    use ConfigCallTrait, AutoNameTrait;
22
23
    /**
24
     * ObjectType constructor.
25
     * @param $config
26
     */
27 4
    public function __construct($config = [])
28
    {
29 4
        if (empty($config)) {
30 4
            $config['name']  = $this->getName();
31 4
            $config['types'] = $this->getTypes();
32
        }
33
34 4
        $this->config = new UnionTypeConfig($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\...Object\UnionTypeConfig> 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...
35 4
    }
36
37
    abstract public function getTypes();
38
39
    abstract public function resolveType($object);
40
41
    public function build($config) {}
42
43
    public function resolve($value = null, $args = [])
44
    {
45
46
    }
47
48 4
    public function getKind()
49
    {
50 4
        return TypeMap::KIND_UNION;
51
    }
52
53
    public function getNamedType()
54
    {
55
        return $this;
56
    }
57
58
    public function isValidValue($value)
59
    {
60
        return true;
61
    }
62
63
}
64