Completed
Pull Request — master (#281)
by Sam
04:03
created
src/Execution/ValuesHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             return $coercedValues;
58 58
         }
59 59
 
60
-        $argumentNodeMap = keyMap($argumentNodes, function (ArgumentNode $value) {
60
+        $argumentNodeMap = keyMap($argumentNodes, function(ArgumentNode $value) {
61 61
             return $value->getNameValue();
62 62
         });
63 63
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         array $variableValues = []
131 131
     ): ?array {
132 132
         $directiveNode = $node->hasDirectives()
133
-            ? find($node->getDirectives(), function (NameAwareInterface $value) use ($directive) {
133
+            ? find($node->getDirectives(), function(NameAwareInterface $value) use ($directive) {
134 134
                 return $value->getNameValue() === $directive->getName();
135 135
             }) : null;
136 136
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
                 ]);
331 331
             }
332 332
             return new CoercedValue($parseResult, null);
333
-        } catch (InvalidTypeException|CoercingException $ex) {
333
+        } catch (InvalidTypeException | CoercingException $ex) {
334 334
             return new CoercedValue(null, [
335 335
                 $this->buildCoerceException(
336 336
                     sprintf('Expected type %s', (string)$type),
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
             return new CoercedValue($enumValue, null);
362 362
         }
363 363
 
364
-        $suggestions = suggestionList((string)$value, \array_map(function (EnumValue $enumValue) {
364
+        $suggestions = suggestionList((string)$value, \array_map(function(EnumValue $enumValue) {
365 365
             return $enumValue->getName();
366 366
         }, $type->getValues()));
367 367
 
Please login to merge, or discard this patch.
src/Language/Node/SchemaExtensionNode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      */
42 42
     public function getOperationTypesAST(): array
43 43
     {
44
-        return \array_map(function (OperationTypeDefinitionNode $node) {
44
+        return \array_map(function(OperationTypeDefinitionNode $node) {
45 45
             return $node->toAST();
46 46
         }, $this->operationTypes);
47 47
     }
Please login to merge, or discard this patch.
src/Language/Parser.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
         /**
323 323
          * @return TypeNodeInterface
324 324
          */
325
-        $parseType = function (): TypeNodeInterface {
325
+        $parseType = function(): TypeNodeInterface {
326 326
             $this->expect(TokenKindEnum::COLON);
327 327
             return $this->lexType();
328 328
         };
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         /**
434 434
          * @return ArgumentNode
435 435
          */
436
-        $parseFunction = function () use ($isConst): ArgumentNode {
436
+        $parseFunction = function() use ($isConst) : ArgumentNode {
437 437
             return $this->lexArgument($isConst);
438 438
         };
439 439
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
         /**
461 461
          * @return NodeInterface|TypeNodeInterface|ValueNodeInterface
462 462
          */
463
-        $parseValue = function () use ($isConst): NodeInterface {
463
+        $parseValue = function() use ($isConst): NodeInterface {
464 464
             $this->expect(TokenKindEnum::COLON);
465 465
             return $this->lexValue($isConst);
466 466
         };
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 
530 530
         $this->expectKeyword(KeywordEnum::FRAGMENT);
531 531
 
532
-        $parseTypeCondition = function () {
532
+        $parseTypeCondition = function() {
533 533
             $this->expectKeyword(KeywordEnum::ON);
534 534
             return $this->lexNamedType();
535 535
         };
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
     {
660 660
         $start = $this->lexer->getToken();
661 661
 
662
-        $parseFunction = function () use ($isConst) {
662
+        $parseFunction = function() use ($isConst) {
663 663
             return $this->lexValue($isConst);
664 664
         };
665 665
 
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
          * @param bool $isConst
713 713
          * @return NodeInterface|TypeNodeInterface|ValueNodeInterface
714 714
          */
715
-        $parseValue = function (bool $isConst): NodeInterface {
715
+        $parseValue = function(bool $isConst): NodeInterface {
716 716
             $this->expect(TokenKindEnum::COLON);
717 717
             return $this->lexValue($isConst);
718 718
         };
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
      */
1054 1054
     protected function lexArgumentsDefinition(): array
1055 1055
     {
1056
-        $parseFunction = function (): InputValueDefinitionNode {
1056
+        $parseFunction = function(): InputValueDefinitionNode {
1057 1057
             return $this->lexInputValueDefinition();
1058 1058
         };
1059 1059
 
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
      */
1260 1260
     protected function lexInputFieldsDefinition(): array
1261 1261
     {
1262
-        $parseFunction = function (): InputValueDefinitionNode {
1262
+        $parseFunction = function(): InputValueDefinitionNode {
1263 1263
             return $this->lexInputValueDefinition();
1264 1264
         };
1265 1265
 
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
 
1328 1328
         $directives = $this->lexDirectives(true);
1329 1329
 
1330
-        $parseFunction = function (): OperationTypeDefinitionNode {
1330
+        $parseFunction = function(): OperationTypeDefinitionNode {
1331 1331
             return $this->lexOperationTypeDefinition();
1332 1332
         };
1333 1333
 
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
 
1602 1602
         $name = $this->lexName();
1603 1603
 
1604
-        if (arraySome(DirectiveLocationEnum::values(), function ($value) use ($name) {
1604
+        if (arraySome(DirectiveLocationEnum::values(), function($value) use ($name) {
1605 1605
             return $name->getValue() === $value;
1606 1606
         })) {
1607 1607
             return $name;
Please login to merge, or discard this patch.
src/Schema/DefinitionBuilder.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function buildTypes(array $nodes): array
109 109
     {
110
-        return \array_map(function (NamedTypeNodeInterface $node) {
110
+        return \array_map(function(NamedTypeNodeInterface $node) {
111 111
             return $this->buildType($node);
112 112
         }, $nodes);
113 113
     }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $directive = newDirective([
154 154
             'name'        => $node->getNameValue(),
155 155
             'description' => $node->getDescriptionValue(),
156
-            'locations'   => \array_map(function (NameNode $node) {
156
+            'locations'   => \array_map(function(NameNode $node) {
157 157
                 return $node->getValue();
158 158
             }, $node->getLocations()),
159 159
             'args'        => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [],
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     {
222 222
         $typesMap = keyMap(
223 223
             \array_merge($customTypes, specifiedScalarTypes(), introspectionTypes()),
224
-            function (NamedTypeInterface $type) {
224
+            function(NamedTypeInterface $type) {
225 225
                 return $type->getName();
226 226
             }
227 227
         );
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     {
239 239
         $directivesMap = keyMap(
240 240
             \array_merge($customDirectives, specifiedDirectives()),
241
-            function (Directive $directive) {
241
+            function(Directive $directive) {
242 242
                 return $directive->getName();
243 243
             }
244 244
         );
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
     {
258 258
         return keyValueMap(
259 259
             $nodes,
260
-            function (InputValueDefinitionNode $value) {
260
+            function(InputValueDefinitionNode $value) {
261 261
                 return $value->getNameValue();
262 262
             },
263
-            function (InputValueDefinitionNode $value): array {
263
+            function(InputValueDefinitionNode $value): array {
264 264
                 $type         = $this->buildWrappedType($value->getType());
265 265
                 $defaultValue = $value->getDefaultValue();
266 266
                 return [
@@ -314,14 +314,14 @@  discard block
 block discarded – undo
314 314
         return newObjectType([
315 315
             'name'        => $node->getNameValue(),
316 316
             'description' => $node->getDescriptionValue(),
317
-            'fields'      => $node->hasFields() ? function () use ($node) {
317
+            'fields'      => $node->hasFields() ? function() use ($node) {
318 318
                 return $this->buildFields($node);
319 319
             } : [],
320 320
             // Note: While this could make early assertions to get the correctly
321 321
             // typed values, that would throw immediately while type system
322 322
             // validation with validateSchema() will produce more actionable results.
323
-            'interfaces'  => function () use ($node) {
324
-                return $node->hasInterfaces() ? \array_map(function (NamedTypeNodeInterface $interface) {
323
+            'interfaces'  => function() use ($node) {
324
+                return $node->hasInterfaces() ? \array_map(function(NamedTypeNodeInterface $interface) {
325 325
                     return $this->buildType($interface);
326 326
                 }, $node->getInterfaces()) : [];
327 327
             },
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
     {
338 338
         return keyValueMap(
339 339
             $node->getFields(),
340
-            function ($value) {
340
+            function($value) {
341 341
                 /** @var FieldDefinitionNode|InputValueDefinitionNode $value */
342 342
                 return $value->getNameValue();
343 343
             },
344
-            function ($value) use ($node) {
344
+            function($value) use ($node) {
345 345
                 /** @var FieldDefinitionNode|InputValueDefinitionNode $value */
346 346
                 return $this->buildField($value,
347 347
                     $this->getFieldResolver($node->getNameValue(), $value->getNameValue()));
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         return newInterfaceType([
372 372
             'name'        => $node->getNameValue(),
373 373
             'description' => $node->getDescriptionValue(),
374
-            'fields'      => $node->hasFields() ? function () use ($node): array {
374
+            'fields'      => $node->hasFields() ? function() use ($node) : array {
375 375
                 return $this->buildFields($node);
376 376
             } : [],
377 377
             'resolveType' => $this->getTypeResolver($node->getNameValue()),
@@ -391,10 +391,10 @@  discard block
 block discarded – undo
391 391
             'description' => $node->getDescriptionValue(),
392 392
             'values'      => $node->hasValues() ? keyValueMap(
393 393
                 $node->getValues(),
394
-                function (EnumValueDefinitionNode $value): ?string {
394
+                function(EnumValueDefinitionNode $value): ?string {
395 395
                     return $value->getNameValue();
396 396
                 },
397
-                function (EnumValueDefinitionNode $value): array {
397
+                function(EnumValueDefinitionNode $value): array {
398 398
                     return [
399 399
                         'description'       => $value->getDescriptionValue(),
400 400
                         'deprecationReason' => $this->getDeprecationReason($value),
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
         return newUnionType([
417 417
             'name'        => $node->getNameValue(),
418 418
             'description' => $node->getDescriptionValue(),
419
-            'types'       => $node->hasTypes() ? \array_map(function (NamedTypeNodeInterface $type) {
419
+            'types'       => $node->hasTypes() ? \array_map(function(NamedTypeNodeInterface $type) {
420 420
                 return $this->buildType($type);
421 421
             }, $node->getTypes()) : [],
422 422
             'resolveType' => $this->getTypeResolver($node->getNameValue()),
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         return newScalarType([
446 446
             'name'        => $node->getNameValue(),
447 447
             'description' => $node->getDescriptionValue(),
448
-            'serialize'   => function ($value) {
448
+            'serialize'   => function($value) {
449 449
                 return $value;
450 450
             },
451 451
             'astNode'     => $node,
@@ -462,13 +462,13 @@  discard block
 block discarded – undo
462 462
         return newInputObjectType([
463 463
             'name'        => $node->getNameValue(),
464 464
             'description' => $node->getDescriptionValue(),
465
-            'fields'      => $node->hasFields() ? function () use ($node) {
465
+            'fields'      => $node->hasFields() ? function() use ($node) {
466 466
                 return keyValueMap(
467 467
                     $node->getFields(),
468
-                    function (InputValueDefinitionNode $value): ?string {
468
+                    function(InputValueDefinitionNode $value): ?string {
469 469
                         return $value->getNameValue();
470 470
                     },
471
-                    function (InputValueDefinitionNode $value): array {
471
+                    function(InputValueDefinitionNode $value): array {
472 472
                         $type         = $this->buildWrappedType($value->getType());
473 473
                         $defaultValue = $value->getDefaultValue();
474 474
                         return [
Please login to merge, or discard this patch.
src/Schema/Building/BuildingContext.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function buildTypes(): array
79 79
     {
80
-        return \array_map(function (NamedTypeNodeInterface $definition) {
80
+        return \array_map(function(NamedTypeNodeInterface $definition) {
81 81
             return $this->definitionBuilder->buildType($definition);
82 82
         }, \array_values($this->info->getTypeDefinitionMap()));
83 83
     }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function buildDirectives(): array
89 89
     {
90
-        $directives = \array_map(function (DirectiveDefinitionNode $definition) {
90
+        $directives = \array_map(function(DirectiveDefinitionNode $definition) {
91 91
             return $this->definitionBuilder->buildDirective($definition);
92 92
         }, $this->info->getDirectiveDefinitions());
93 93
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         ];
99 99
 
100 100
         foreach ($specifiedDirectivesMap as $name => $directive) {
101
-            if (!arraySome($directives, function (Directive $directive) use ($name) {
101
+            if (!arraySome($directives, function(Directive $directive) use ($name) {
102 102
                 return $directive->getName() === $name;
103 103
             })) {
104 104
                 $directives[] = $directive;
Please login to merge, or discard this patch.
src/Execution/Executor.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
         $promise = new FulfilledPromise([]);
172 172
 
173
-        $resolve = function ($results, $fieldName, $path, $objectType, $rootValue, $fieldNodes) {
173
+        $resolve = function($results, $fieldName, $path, $objectType, $rootValue, $fieldNodes) {
174 174
             $fieldPath   = $path;
175 175
             $fieldPath[] = $fieldName;
176 176
             try {
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
             if ($this->isPromise($result)) {
183 183
                 /** @var ExtendedPromiseInterface $result */
184
-                return $result->then(function ($resolvedResult) use ($fieldName, $results) {
184
+                return $result->then(function($resolvedResult) use ($fieldName, $results) {
185 185
                     $results[$fieldName] = $resolvedResult;
186 186
                     return $results;
187 187
                 });
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         };
194 194
 
195 195
         foreach ($fields as $fieldName => $fieldNodes) {
196
-            $promise = $promise->then(function ($resolvedResults) use (
196
+            $promise = $promise->then(function($resolvedResults) use (
197 197
                 $resolve,
198 198
                 $fieldName,
199 199
                 $path,
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
             });
206 206
         }
207 207
 
208
-        $promise->then(function ($resolvedResults) use (&$finalResults) {
208
+        $promise->then(function($resolvedResults) use (&$finalResults) {
209 209
             $finalResults = $resolvedResults ?? [];
210
-        })->otherwise(function ($ex) {
210
+        })->otherwise(function($ex) {
211 211
             $this->context->addError($ex);
212 212
         });
213 213
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
             if ($this->isPromise($completed)) {
285 285
                 $context = $this->context;
286 286
                 /** @var ExtendedPromiseInterface $completed */
287
-                return $completed->then(null, function ($error) use ($context, $fieldNodes, $path) {
287
+                return $completed->then(null, function($error) use ($context, $fieldNodes, $path) {
288 288
                     //@TODO Handle $error better
289 289
                     if ($error instanceof \Exception) {
290 290
                         $context->addError($this->buildLocatedError($error, $fieldNodes, $path));
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
             $keys    = \array_keys($finalResults);
379 379
             $promise = promiseAll(\array_values($finalResults));
380 380
 
381
-            $promise->then(function ($values) use ($keys, &$finalResults) {
381
+            $promise->then(function($values) use ($keys, &$finalResults) {
382 382
                 /** @noinspection ForeachSourceInspection */
383 383
                 foreach ($values as $i => $value) {
384 384
                     $finalResults[$keys[$i]] = $value;
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
     ) {
477 477
         if ($this->isPromise($result)) {
478 478
             /** @var ExtendedPromiseInterface $result */
479
-            return $result->then(function (&$value) use ($returnType, $fieldNodes, $info, $path) {
479
+            return $result->then(function(&$value) use ($returnType, $fieldNodes, $info, $path) {
480 480
                 return $this->completeValue($returnType, $fieldNodes, $info, $path, $value);
481 481
             });
482 482
         }
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 
565 565
         if ($this->isPromise($runtimeType)) {
566 566
             /** @var ExtendedPromiseInterface $runtimeType */
567
-            return $runtimeType->then(function ($resolvedRuntimeType) use (
567
+            return $runtimeType->then(function($resolvedRuntimeType) use (
568 568
                 $returnType,
569 569
                 $fieldNodes,
570 570
                 $info,
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 
693 693
         if (!empty($promisedIsTypeOfResults)) {
694 694
             return promiseAll($promisedIsTypeOfResults)
695
-                ->then(function ($isTypeOfResults) use ($possibleTypes) {
695
+                ->then(function($isTypeOfResults) use ($possibleTypes) {
696 696
                     /** @noinspection ForeachSourceInspection */
697 697
                     foreach ($isTypeOfResults as $index => $result) {
698 698
                         if ($result) {
Please login to merge, or discard this patch.
src/Validation/Rule/LoneAnonymousOperationRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
      */
28 28
     protected function enterDocument(DocumentNode $node): EnterReturnValue
29 29
     {
30
-        $this->operationCount = \count(\array_filter($node->getDefinitions(), function ($definition) {
30
+        $this->operationCount = \count(\array_filter($node->getDefinitions(), function($definition) {
31 31
             return $definition instanceof OperationDefinitionNode;
32 32
         }));
33 33
 
Please login to merge, or discard this patch.
src/Validation/Rule/FragmentsOnCompositeTypesRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     protected function enterFragmentDefinition(FragmentDefinitionNode $node): EnterReturnValue
28 28
     {
29
-        $this->validateFragementNode($node, function (FragmentDefinitionNode $node) {
29
+        $this->validateFragementNode($node, function(FragmentDefinitionNode $node) {
30 30
             return fragmentOnNonCompositeMessage((string)$node, (string)$node->getTypeCondition());
31 31
         });
32 32
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     protected function enterInlineFragment(InlineFragmentNode $node): EnterReturnValue
40 40
     {
41
-        $this->validateFragementNode($node, function (InlineFragmentNode $node) {
41
+        $this->validateFragementNode($node, function(InlineFragmentNode $node) {
42 42
             return inlineFragmentOnNonCompositeMessage((string)$node->getTypeCondition());
43 43
         });
44 44
 
Please login to merge, or discard this patch.
src/Validation/ValidationContext.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     public function getFragment(string $name): ?FragmentDefinitionNode
169 169
     {
170 170
         if (empty($this->fragments)) {
171
-            $this->fragments = array_reduce($this->document->getDefinitions(), function ($fragments, $definition) {
171
+            $this->fragments = array_reduce($this->document->getDefinitions(), function($fragments, $definition) {
172 172
                 if ($definition instanceof FragmentDefinitionNode) {
173 173
                     $fragments[$definition->getNameValue()] = $definition;
174 174
                 }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
             $usages   = [];
245 245
             $typeInfo = new TypeInfo($this->schema);
246 246
 
247
-            $enterCallback = function (NodeInterface $node) use (&$usages, $typeInfo): EnterReturnValue {
247
+            $enterCallback = function(NodeInterface $node) use (&$usages, $typeInfo): EnterReturnValue {
248 248
                 if ($node instanceof VariableDefinitionNode) {
249 249
                     return new EnterReturnValue(null);
250 250
                 }
Please login to merge, or discard this patch.