Completed
Pull Request — master (#36)
by Sebastian
03:39
created
src/Execution/Processor.php 1 patch
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -13,8 +13,6 @@  discard block
 block discarded – undo
13 13
 use Youshido\GraphQL\Execution\Visitor\AbstractQueryVisitor;
14 14
 use Youshido\GraphQL\Field\AbstractField;
15 15
 use Youshido\GraphQL\Field\Field;
16
-use Youshido\GraphQL\Introspection\Field\SchemaField;
17
-use Youshido\GraphQL\Introspection\Field\TypeDefinitionField;
18 16
 use Youshido\GraphQL\Parser\Ast\Field as FieldAst;
19 17
 use Youshido\GraphQL\Parser\Ast\Fragment;
20 18
 use Youshido\GraphQL\Parser\Ast\FragmentInterface;
@@ -34,7 +32,6 @@  discard block
 block discarded – undo
34 32
 use Youshido\GraphQL\Validator\Exception\ResolveException;
35 33
 use Youshido\GraphQL\Validator\ResolveValidator\ResolveValidator;
36 34
 use Youshido\GraphQL\Validator\ResolveValidator\ResolveValidatorInterface;
37
-use Youshido\GraphQL\Validator\SchemaValidator\SchemaValidator;
38 35
 
39 36
 class Processor
40 37
 {
Please login to merge, or discard this patch.
Tests/Schema/ProcessorTest.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,6 @@
 block discarded – undo
21 21
 use Youshido\GraphQL\Type\Scalar\IntType;
22 22
 use Youshido\GraphQL\Type\Scalar\StringType;
23 23
 use Youshido\GraphQL\Type\Union\UnionType;
24
-use Youshido\Tests\DataProvider\TestEmptySchema;
25 24
 use Youshido\Tests\DataProvider\TestEnumType;
26 25
 use Youshido\Tests\DataProvider\TestInterfaceType;
27 26
 use Youshido\Tests\DataProvider\TestObjectType;
Please login to merge, or discard this patch.
Tests/Schema/IntrospectionTest.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -151,84 +151,84 @@  discard block
 block discarded – undo
151 151
         $this->assertEquals($expectedResponse, $responseData);
152 152
     }
153 153
 
154
-  public function testCombinedFields()
155
-  {
154
+    public function testCombinedFields()
155
+    {
156 156
     $schema = new TestEmptySchema();
157 157
 
158 158
     $interface = new InterfaceType([
159
-      'name'        => 'TestInterface',
160
-      'fields'      => [
159
+        'name'        => 'TestInterface',
160
+        'fields'      => [
161 161
         'id'   => ['type' => new IntType()],
162 162
         'name' => ['type' => new IntType()],
163
-      ],
164
-      'resolveType' => function ($type) {
163
+        ],
164
+        'resolveType' => function ($type) {
165 165
 
166
-      }
166
+        }
167 167
     ]);
168 168
 
169 169
     $object1 = new ObjectType([
170
-      'name'       => 'Test1',
171
-      'fields'     => [
170
+        'name'       => 'Test1',
171
+        'fields'     => [
172 172
         'id'       => ['type' => new IntType()],
173 173
         'name'     => ['type' => new IntType()],
174 174
         'lastName' => ['type' => new IntType()],
175
-      ],
176
-      'interfaces' => [$interface]
175
+        ],
176
+        'interfaces' => [$interface]
177 177
     ]);
178 178
 
179 179
     $object2 = new ObjectType([
180
-      'name'       => 'Test2',
181
-      'fields'     => [
180
+        'name'       => 'Test2',
181
+        'fields'     => [
182 182
         'id'        => ['type' => new IntType()],
183 183
         'name'      => ['type' => new IntType()],
184 184
         'thirdName' => ['type' => new IntType()],
185
-      ],
186
-      'interfaces' => [$interface]
185
+        ],
186
+        'interfaces' => [$interface]
187 187
     ]);
188 188
 
189 189
     $unionType = new UnionType([
190
-      'name'        => 'UnionType',
191
-      'types'       => [$object1, $object2],
192
-      'resolveType' => function () {
190
+        'name'        => 'UnionType',
191
+        'types'       => [$object1, $object2],
192
+        'resolveType' => function () {
193 193
 
194
-      }
194
+        }
195 195
     ]);
196 196
 
197 197
     $schema->addQueryField(new Field([
198
-      'name'    => 'union',
199
-      'type'    => $unionType,
200
-      'args'    => [
198
+        'name'    => 'union',
199
+        'type'    => $unionType,
200
+        'args'    => [
201 201
         'id' => ['type' => TypeMap::TYPE_INT]
202
-      ],
203
-      'resolve' => function () {
202
+        ],
203
+        'resolve' => function () {
204 204
         return [
205
-          'id'   => 1,
206
-          'name' => 'Alex'
205
+            'id'   => 1,
206
+            'name' => 'Alex'
207 207
         ];
208
-      }
208
+        }
209 209
     ]));
210 210
 
211 211
     $schema->addMutationField(new Field([
212
-      'name'    => 'mutation',
213
-      'type'    => $unionType,
214
-      'args'    => [
212
+        'name'    => 'mutation',
213
+        'type'    => $unionType,
214
+        'args'    => [
215 215
         'type' => new EnumType([
216
-          'name'   => 'MutationType',
217
-          'values' => [
216
+            'name'   => 'MutationType',
217
+            'values' => [
218 218
             [
219
-              'name'  => 'Type1',
220
-              'value' => 'type_1'
219
+                'name'  => 'Type1',
220
+                'value' => 'type_1'
221 221
             ],
222 222
             [
223
-              'name'  => 'Type2',
224
-              'value' => 'type_2'
223
+                'name'  => 'Type2',
224
+                'value' => 'type_2'
225
+            ]
225 226
             ]
226
-          ]
227 227
         ])
228
-      ],
229
-      'resolve' => function () {
228
+        ],
229
+        'resolve' => function () {
230 230
         return null;
231
-      }
231
+        }
232 232
     ]));
233 233
 
234 234
     $processor = new Processor($schema);
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 
239 239
     /** strange that this test got broken after I fixed the field resolve behavior */
240 240
     $this->assertArrayNotHasKey('errors', $responseData);
241
-  }
241
+    }
242 242
 
243
-  public function predefinedSchemaProvider()
243
+    public function predefinedSchemaProvider()
244 244
     {
245 245
         return [
246 246
             [
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             'description'       => 'latest description',
136 136
             'deprecationReason' => 'for test',
137 137
             'isDeprecated'      => true,
138
-            'resolve'           => function () {
138
+            'resolve'           => function() {
139 139
                 return [
140 140
                     'id'   => 1,
141 141
                     'name' => 'Alex'
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         'id'   => ['type' => new IntType()],
162 162
         'name' => ['type' => new IntType()],
163 163
       ],
164
-      'resolveType' => function ($type) {
164
+      'resolveType' => function($type) {
165 165
 
166 166
       }
167 167
     ]);
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     $unionType = new UnionType([
190 190
       'name'        => 'UnionType',
191 191
       'types'       => [$object1, $object2],
192
-      'resolveType' => function () {
192
+      'resolveType' => function() {
193 193
 
194 194
       }
195 195
     ]);
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
       'args'    => [
201 201
         'id' => ['type' => TypeMap::TYPE_INT]
202 202
       ],
203
-      'resolve' => function () {
203
+      'resolve' => function() {
204 204
         return [
205 205
           'id'   => 1,
206 206
           'name' => 'Alex'
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
           ]
227 227
         ])
228 228
       ],
229
-      'resolve' => function () {
229
+      'resolve' => function() {
230 230
         return null;
231 231
       }
232 232
     ]));
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
                                 ['name' => '__Schema', 'fields' => [['name' => 'queryType'], ['name' => 'mutationType'], ['name' => 'subscriptionType'], ['name' => 'types'], ['name' => 'directives']]],
285 285
                                 ['name' => '__Type', 'fields' => [['name' => 'name'], ['name' => 'kind'], ['name' => 'description'], ['name' => 'ofType'], ['name' => 'inputFields'], ['name' => 'enumValues'], ['name' => 'fields'], ['name' => 'interfaces'], ['name' => 'possibleTypes']]],
286 286
                                 ['name' => 'String', 'fields' => null],
287
-                                ['name' => '__InputValue', 'fields' => [['name' => 'name'], ['name' => 'description'], ['name' => 'type'], ['name' => 'defaultValue'],]],
288
-                                ['name' => '__EnumValue', 'fields' => [['name' => 'name'], ['name' => 'description'], ['name' => 'deprecationReason'], ['name' => 'isDeprecated'],]],
287
+                                ['name' => '__InputValue', 'fields' => [['name' => 'name'], ['name' => 'description'], ['name' => 'type'], ['name' => 'defaultValue'], ]],
288
+                                ['name' => '__EnumValue', 'fields' => [['name' => 'name'], ['name' => 'description'], ['name' => 'deprecationReason'], ['name' => 'isDeprecated'], ]],
289 289
                                 ['name' => 'Boolean', 'fields' => null],
290 290
                                 ['name' => '__Field', 'fields' => [['name' => 'name'], ['name' => 'description'], ['name' => 'isDeprecated'], ['name' => 'deprecationReason'], ['name' => 'type'], ['name' => 'args']]],
291 291
                                 ['name' => '__Subscription', 'fields' => [['name' => 'name']]],
Please login to merge, or discard this patch.
src/Schema/AbstractSchema.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@
 block discarded – undo
35 35
 
36 36
     public function build(SchemaConfig $config)
37 37
     {
38
-      $this->addQueryField(new SchemaField());
39
-      $this->addQueryField(new TypeDefinitionField());
38
+        $this->addQueryField(new SchemaField());
39
+        $this->addQueryField(new TypeDefinitionField());
40 40
     }
41 41
 
42 42
     public function addQueryField($field, $fieldInfo = null)
Please login to merge, or discard this patch.