Completed
Push — master ( 686b71...786636 )
by Alexandr
03:06
created
Tests/Schema/IntrospectionTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             'description'       => 'latest description',
137 137
             'deprecationReason' => 'for test',
138 138
             'isDeprecated'      => true,
139
-            'resolve'           => function () {
139
+            'resolve'           => function() {
140 140
                 return [
141 141
                     'id'   => 1,
142 142
                     'name' => 'Alex'
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
                                 ['name' => 'String', 'fields' => null],
202 202
                                 ['name' => '__Schema', 'fields' => [['name' => 'queryType', 'args' => []], ['name' => 'mutationType', 'args' => []], ['name' => 'subscriptionType', 'args' => []], ['name' => 'types', 'args' => []], ['name' => 'directives', 'args' => []]]],
203 203
                                 ['name' => '__Type', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'kind', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'ofType', 'args' => []], ['name' => 'inputFields', 'args' => []], ['name' => 'enumValues', 'args' => [['defaultValue' => 'false']]], ['name' => 'fields', 'args' => [['defaultValue' => 'false']]], ['name' => 'interfaces', 'args' => []], ['name' => 'possibleTypes', 'args' => []]]],
204
-                                ['name' => '__InputValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'defaultValue', 'args' => []],]],
204
+                                ['name' => '__InputValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'defaultValue', 'args' => []], ]],
205 205
                                 ['name' => 'Boolean', 'fields' => null],
206
-                                ['name' => '__EnumValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'isDeprecated', 'args' => []],]],
206
+                                ['name' => '__EnumValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ]],
207 207
                                 ['name' => '__Field', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'args', 'args' => []]]],
208 208
                                 ['name' => '__Subscription', 'fields' => [['name' => 'name', 'args' => []]]],
209 209
                                 ['name' => '__Directive', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'args', 'args' => []], ['name' => 'onOperation', 'args' => []], ['name' => 'onFragment', 'args' => []], ['name' => 'onField', 'args' => []]]],
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
                 'id'   => ['type' => new IntType()],
292 292
                 'name' => ['type' => new IntType()],
293 293
             ],
294
-            'resolveType' => function ($type) {
294
+            'resolveType' => function($type) {
295 295
 
296 296
             }
297 297
         ]);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         $unionType = new UnionType([
320 320
             'name'        => 'UnionType',
321 321
             'types'       => [$object1, $object2],
322
-            'resolveType' => function () {
322
+            'resolveType' => function() {
323 323
 
324 324
             }
325 325
         ]);
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             'args'    => [
331 331
                 'id' => ['type' => TypeMap::TYPE_INT]
332 332
             ],
333
-            'resolve' => function () {
333
+            'resolve' => function() {
334 334
                 return [
335 335
                     'id'   => 1,
336 336
                     'name' => 'Alex'
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
                     ]
357 357
                 ])
358 358
             ],
359
-            'resolve' => function () {
359
+            'resolve' => function() {
360 360
                 return null;
361 361
             }
362 362
         ]));
Please login to merge, or discard this patch.
src/Type/Object/AbstractObjectType.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -87,6 +87,9 @@
 block discarded – undo
87 87
         return $this->getConfigValue('interfaces', []);
88 88
     }
89 89
 
90
+    /**
91
+     * @param ObjectType|null $value
92
+     */
90 93
     public function isValidValue($value)
91 94
     {
92 95
         return is_array($value) || is_null($value) || is_object($value);
Please login to merge, or discard this patch.
src/Config/AbstractConfig.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $validator = ConfigValidator::getInstance();
60 60
 
61 61
         if (!$validator->validate($this->data, $this->getContextRules(), $this->extraFieldsAllowed)) {
62
-            throw new ConfigurationException('Config is not valid for ' . ($this->contextObject ? get_class($this->contextObject) : null) . "\n" . implode("\n", $validator->getErrorsArray(false)));
62
+            throw new ConfigurationException('Config is not valid for '.($this->contextObject ? get_class($this->contextObject) : null)."\n".implode("\n", $validator->getErrorsArray(false)));
63 63
         }
64 64
     }
65 65
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         } elseif (substr($method, 0, 2) == 'is') {
152 152
             $propertyName = lcfirst(substr($method, 2));
153 153
         } else {
154
-            throw new \Exception('Call to undefined method ' . $method);
154
+            throw new \Exception('Call to undefined method '.$method);
155 155
         }
156 156
 
157 157
         return $this->get($propertyName);
Please login to merge, or discard this patch.
src/Execution/Container/Container.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
         if (isset($this->values[$id])) {
48 48
             unset($this->values[$id]);
49 49
         }
50
-        $this->keyset[$id]   = true;
50
+        $this->keyset[$id] = true;
51 51
     }
52 52
 
53 53
     public function remove($id)
Please login to merge, or discard this patch.
Tests/StarWars/Schema/StarWarsQueryType.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
                 'args'    => [
37 37
                     'episode' => ['type' => new EpisodeEnum()]
38 38
                 ],
39
-                'resolve' => function ($root, $args) {
39
+                'resolve' => function($root, $args) {
40 40
                     return StarWarsData::getHero(isset($args['episode']) ? $args['episode'] : null);
41 41
                 },
42 42
             ])
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                 'args'    => [
47 47
                     'id' => new IdType()
48 48
                 ],
49
-                'resolve' => function ($value = null, $args = []) {
49
+                'resolve' => function($value = null, $args = []) {
50 50
                     $humans = StarWarsData::humans();
51 51
 
52 52
                     return isset($humans[$args['id']]) ? $humans[$args['id']] : null;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                 'args'    => [
59 59
                     'id' => new IdType()
60 60
                 ],
61
-                'resolve' => function ($value = null, $args = []) {
61
+                'resolve' => function($value = null, $args = []) {
62 62
                     $droids = StarWarsData::droids();
63 63
 
64 64
                     return isset($droids[$args['id']]) ? $droids[$args['id']] : null;
Please login to merge, or discard this patch.
src/Field/AbstractInputField.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,6 @@
 block discarded – undo
9 9
 
10 10
 
11 11
 use Youshido\GraphQL\Config\Field\InputFieldConfig;
12
-use Youshido\GraphQL\Config\Traits\ResolvableObjectTrait;
13
-use Youshido\GraphQL\Type\InputObject\AbstractInputObjectType;
14 12
 use Youshido\GraphQL\Type\InputTypeInterface;
15 13
 use Youshido\GraphQL\Type\Traits\AutoNameTrait;
16 14
 use Youshido\GraphQL\Type\Traits\FieldsArgumentsAwareObjectTrait;
Please login to merge, or discard this patch.
src/Schema/AbstractSchema.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -10,9 +10,7 @@
 block discarded – undo
10 10
 
11 11
 
12 12
 use Youshido\GraphQL\Config\Schema\SchemaConfig;
13
-use Youshido\GraphQL\Type\Object\ObjectType;
14 13
 use Youshido\GraphQL\Type\SchemaTypesList;
15
-use Youshido\GraphQL\Type\TypeInterface;
16 14
 
17 15
 abstract class AbstractSchema
18 16
 {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
     public function __construct($config = [])
24 24
     {
25 25
         if (!array_key_exists('query', $config)) {
26
-            $config['query'] = new InternalSchemaQueryObject(['name' => $this->getName() . 'Query']);
26
+            $config['query'] = new InternalSchemaQueryObject(['name' => $this->getName().'Query']);
27 27
         }
28 28
         if (!array_key_exists('mutation', $config)) {
29
-            $config['mutation'] = new InternalSchemaMutationObject(['name' => $this->getName() . 'Mutation']);
29
+            $config['mutation'] = new InternalSchemaMutationObject(['name' => $this->getName().'Mutation']);
30 30
         }
31 31
         if (!array_key_exists('types', $config)) {
32 32
           $config['types'] = [];
Please login to merge, or discard this patch.
src/Relay/Connection/Connection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         $edgeFields = !empty($config['edgeFields']) ? $config['edgeFields'] : [];
53 53
 
54 54
         $edgeType = new ObjectType([
55
-            'name'        => $name . 'Edge',
55
+            'name'        => $name.'Edge',
56 56
             'description' => 'An edge in a connection.',
57 57
             'fields'      => array_merge([
58 58
                 'node'   => [
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $connectionFields = !empty($config['connectionFields']) ? $config['connectionFields'] : [];
85 85
 
86 86
         $connectionType = new ObjectType([
87
-            'name'        => $name . 'Connection',
87
+            'name'        => $name.'Connection',
88 88
             'description' => 'A connection to a list of items.',
89 89
             'fields'      => array_merge([
90 90
                 'pageInfo' => [
Please login to merge, or discard this patch.
src/Type/SchemaTypesList.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.