@@ -10,8 +10,6 @@ |
||
10 | 10 | |
11 | 11 | |
12 | 12 | use Youshido\GraphQL\Config\Schema\SchemaConfig; |
13 | -use Youshido\GraphQL\Type\Object\ObjectType; |
|
14 | -use Youshido\GraphQL\Type\TypeInterface; |
|
15 | 13 | |
16 | 14 | abstract class AbstractSchema |
17 | 15 | { |
@@ -28,7 +28,7 @@ |
||
28 | 28 | $config['mutation'] = new InternalSchemaMutationObject(['name' => $this->getName() . 'Mutation']); |
29 | 29 | } |
30 | 30 | if (!array_key_exists('types', $config)) { |
31 | - $config['types'] = []; |
|
31 | + $config['types'] = []; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $this->config = new SchemaConfig($config, $this); |
@@ -45,7 +45,7 @@ |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | foreach ($value->getTypes() as $type) { |
48 | - $this->collectTypes($type); |
|
48 | + $this->collectTypes($type); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return array_values($this->types); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | if (!is_array($types)) { |
25 | 25 | throw new \Exception('addTypes accept only array of types'); |
26 | 26 | } |
27 | - foreach($types as $type) { |
|
27 | + foreach ($types as $type) { |
|
28 | 28 | $this->addType($type); |
29 | 29 | } |
30 | 30 | return $this; |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | public function addType(TypeInterface $type) |
43 | 43 | { |
44 | 44 | $typeName = $this->getTypeName($type); |
45 | - if ($this->isTypeNameRegistered($typeName)) return $this; |
|
45 | + if ($this->isTypeNameRegistered($typeName)) { |
|
46 | + return $this; |
|
47 | + } |
|
46 | 48 | |
47 | 49 | $this->typesList[$typeName] = $type; |
48 | 50 | return $this; |
@@ -54,7 +56,9 @@ discard block |
||
54 | 56 | } |
55 | 57 | |
56 | 58 | private function getTypeName($type) { |
57 | - if (is_string($type)) return $type; |
|
59 | + if (is_string($type)) { |
|
60 | + return $type; |
|
61 | + } |
|
58 | 62 | if (is_object($type) && $type instanceof AbstractType) { |
59 | 63 | return $type->getName(); |
60 | 64 | } |