@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | if (isset($this->resolvedTypes[$type->name])) { |
125 | 125 | Utils::invariant( |
126 | 126 | $type === $this->resolvedTypes[$type->name], |
127 | - "Schema must contain unique named types but contains multiple types named \"$type\" ". |
|
127 | + "Schema must contain unique named types but contains multiple types named \"$type\" " . |
|
128 | 128 | "(see http://webonyx.github.io/graphql-php/type-system/#type-registry)." |
129 | 129 | ); |
130 | 130 | } |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $internalTypes = Type::getInternalTypes() + Introspection::getTypes(); |
444 | 444 | foreach ($this->getTypeMap() as $name => $type) { |
445 | 445 | if (isset($internalTypes[$name])) { |
446 | - continue ; |
|
446 | + continue; |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | $type->assertValid(); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | if ($this->config->typeLoader) { |
453 | 453 | Utils::invariant( |
454 | 454 | $this->loadType($name) === $type, |
455 | - "Type loader returns different instance for {$name} than field/argument definitions. ". |
|
455 | + "Type loader returns different instance for {$name} than field/argument definitions. " . |
|
456 | 456 | 'Make sure you always return the same instance for the same type name.' |
457 | 457 | ); |
458 | 458 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | { |
179 | 179 | $commentReplies = isset(self::$commentReplies[$commentId]) ? self::$commentReplies[$commentId] : []; |
180 | 180 | |
181 | - $start = isset($after) ? (int) array_search($afterId, $commentReplies) + 1: 0; |
|
181 | + $start = isset($after) ? (int) array_search($afterId, $commentReplies) + 1 : 0; |
|
182 | 182 | $commentReplies = array_slice($commentReplies, $start, $limit); |
183 | 183 | |
184 | 184 | return array_map( |
@@ -201,6 +201,6 @@ discard block |
||
201 | 201 | |
202 | 202 | public static function findStoryMentions($storyId) |
203 | 203 | { |
204 | - return isset(self::$storyMentions[$storyId]) ? self::$storyMentions[$storyId] :[]; |
|
204 | + return isset(self::$storyMentions[$storyId]) ? self::$storyMentions[$storyId] : []; |
|
205 | 205 | } |
206 | 206 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | 'args' => [ |
20 | 20 | 'message' => ['type' => Type::string()], |
21 | 21 | ], |
22 | - 'resolve' => function ($root, $args) { |
|
22 | + 'resolve' => function($root, $args) { |
|
23 | 23 | return $root['prefix'] . $args['message']; |
24 | 24 | } |
25 | 25 | ], |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | 'x' => ['type' => Type::int()], |
36 | 36 | 'y' => ['type' => Type::int()], |
37 | 37 | ], |
38 | - 'resolve' => function ($root, $args) { |
|
38 | + 'resolve' => function($root, $args) { |
|
39 | 39 | return $args['x'] + $args['y']; |
40 | 40 | }, |
41 | 41 | ], |
@@ -16,7 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | public function resolve($root, $args, $context) |
18 | 18 | { |
19 | - return $root['prefix'].$args['message']; |
|
19 | + return $root['prefix'] . $args['message']; |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use GraphQL\Utils\Utils; |
5 | 5 | |
6 | -$outputFile = __DIR__ . '/../docs/reference.md'; |
|
6 | +$outputFile = __DIR__ . '/../docs/reference.md'; |
|
7 | 7 | |
8 | 8 | $entries = [ |
9 | 9 | \GraphQL\GraphQL::class, |
@@ -56,7 +56,7 @@ |
||
56 | 56 | { |
57 | 57 | if ($this->typeIndex > $this->config['totalTypes']) { |
58 | 58 | throw new \Exception( |
59 | - "Cannot create new type: there are already {$this->typeIndex} ". |
|
59 | + "Cannot create new type: there are already {$this->typeIndex} " . |
|
60 | 60 | "which exceeds allowed number of {$this->config['totalTypes']} types total" |
61 | 61 | ); |
62 | 62 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | 'args' => [ |
20 | 20 | 'message' => ['type' => Type::string()], |
21 | 21 | ], |
22 | - 'resolve' => function ($root, $args) { |
|
22 | + 'resolve' => function($root, $args) { |
|
23 | 23 | return $root['prefix'] . $args['message']; |
24 | 24 | } |
25 | 25 | ], |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | 'x' => ['type' => Type::int()], |
36 | 36 | 'y' => ['type' => Type::int()], |
37 | 37 | ], |
38 | - 'resolve' => function ($root, $args) { |
|
38 | + 'resolve' => function($root, $args) { |
|
39 | 39 | return $args['x'] + $args['y']; |
40 | 40 | }, |
41 | 41 | ], |
@@ -86,7 +86,7 @@ |
||
86 | 86 | if (self::$warningHandler) { |
87 | 87 | $fn = self::$warningHandler; |
88 | 88 | $fn($errorMessage, $warningId); |
89 | - } elseif ((self::$enableWarnings & $warningId) > 0 && ! isset(self::$warned[$warningId])) { |
|
89 | + } elseif ((self::$enableWarnings & $warningId) > 0 && !isset(self::$warned[$warningId])) { |
|
90 | 90 | self::$warned[$warningId] = true; |
91 | 91 | trigger_error($errorMessage, $messageLevel ?: E_USER_WARNING); |
92 | 92 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | if ($astNode instanceof SchemaDefinitionNode) { |
101 | 101 | $operationTypeNode = null; |
102 | 102 | |
103 | - foreach($astNode->operationTypes as $operationType) { |
|
103 | + foreach ($astNode->operationTypes as $operationType) { |
|
104 | 104 | if ($operationType->operation === $operation) { |
105 | 105 | $operationTypeNode = $operationType; |
106 | 106 | break; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | public function validateDirectives() |
115 | 115 | { |
116 | 116 | $directives = $this->schema->getDirectives(); |
117 | - foreach($directives as $directive) { |
|
117 | + foreach ($directives as $directive) { |
|
118 | 118 | // Ensure all directives are in fact GraphQL directives. |
119 | 119 | if (!$directive instanceof Directive) { |
120 | 120 | $this->reportError( |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function validateTypes() |
174 | 174 | { |
175 | 175 | $typeMap = $this->schema->getTypeMap(); |
176 | - foreach($typeMap as $typeName => $type) { |
|
176 | + foreach ($typeMap as $typeName => $type) { |
|
177 | 177 | // Ensure all provided types are in fact GraphQL type. |
178 | 178 | if (!$type instanceof NamedType) { |
179 | 179 | $this->reportError( |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | // Ensure the arguments are valid |
249 | 249 | $argNames = []; |
250 | - foreach($field->args as $arg) { |
|
250 | + foreach ($field->args as $arg) { |
|
251 | 251 | $argName = $arg->name; |
252 | 252 | |
253 | 253 | // Ensure they are named correctly. |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | if (!Type::isInputType($arg->getType())) { |
267 | 267 | $this->reportError( |
268 | 268 | "The type of {$type->name}.{$fieldName}({$argName}:) must be Input " . |
269 | - 'Type but got: '. Utils::printSafe($arg->getType()) . '.', |
|
269 | + 'Type but got: ' . Utils::printSafe($arg->getType()) . '.', |
|
270 | 270 | $this->getFieldArgTypeNode($type, $fieldName, $argName) |
271 | 271 | ); |
272 | 272 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | private function validateObjectInterfaces(ObjectType $object) |
278 | 278 | { |
279 | 279 | $implementedTypeNames = []; |
280 | - foreach($object->getInterfaces() as $iface) { |
|
280 | + foreach ($object->getInterfaces() as $iface) { |
|
281 | 281 | if (isset($implementedTypeNames[$iface->name])) { |
282 | 282 | $this->reportError( |
283 | 283 | "Type {$object->name} can only implement {$iface->name} once.", |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | if (!$iface instanceof InterfaceType) { |
300 | 300 | $this->reportError( |
301 | 301 | "Type {$object->name} must only implement Interface types, " . |
302 | - "it cannot implement ". Utils::printSafe($iface) . ".", |
|
302 | + "it cannot implement " . Utils::printSafe($iface) . ".", |
|
303 | 303 | $this->getImplementsInterfaceNode($object, $iface) |
304 | 304 | ); |
305 | 305 | return; |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | ) |
335 | 335 | ) { |
336 | 336 | $this->reportError( |
337 | - "Interface field {$iface->name}.{$fieldName} expects type ". |
|
337 | + "Interface field {$iface->name}.{$fieldName} expects type " . |
|
338 | 338 | "{$ifaceField->getType()} but {$object->name}.{$fieldName} " . |
339 | 339 | "is type " . Utils::printSafe($objectField->getType()) . ".", |
340 | 340 | [ |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | } |
346 | 346 | |
347 | 347 | // Assert each interface field arg is implemented. |
348 | - foreach($ifaceField->args as $ifaceArg) { |
|
348 | + foreach ($ifaceField->args as $ifaceArg) { |
|
349 | 349 | $argName = $ifaceArg->name; |
350 | 350 | $objectArg = null; |
351 | 351 | |
352 | - foreach($objectField->args as $arg) { |
|
352 | + foreach ($objectField->args as $arg) { |
|
353 | 353 | if ($arg->name === $argName) { |
354 | 354 | $objectArg = $arg; |
355 | 355 | break; |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | // TODO: change to contravariant? |
375 | 375 | if (!TypeComparators::isEqualType($ifaceArg->getType(), $objectArg->getType())) { |
376 | 376 | $this->reportError( |
377 | - "Interface field argument {$iface->name}.{$fieldName}({$argName}:) ". |
|
377 | + "Interface field argument {$iface->name}.{$fieldName}({$argName}:) " . |
|
378 | 378 | "expects type " . Utils::printSafe($ifaceArg->getType()) . " but " . |
379 | 379 | "{$object->name}.{$fieldName}({$argName}:) is type " . |
380 | 380 | Utils::printSafe($objectArg->getType()) . ".", |
@@ -389,11 +389,11 @@ discard block |
||
389 | 389 | } |
390 | 390 | |
391 | 391 | // Assert additional arguments must not be required. |
392 | - foreach($objectField->args as $objectArg) { |
|
392 | + foreach ($objectField->args as $objectArg) { |
|
393 | 393 | $argName = $objectArg->name; |
394 | 394 | $ifaceArg = null; |
395 | 395 | |
396 | - foreach($ifaceField->args as $arg) { |
|
396 | + foreach ($ifaceField->args as $arg) { |
|
397 | 397 | if ($arg->name === $argName) { |
398 | 398 | $ifaceArg = $arg; |
399 | 399 | break; |
@@ -428,10 +428,10 @@ discard block |
||
428 | 428 | |
429 | 429 | $includedTypeNames = []; |
430 | 430 | |
431 | - foreach($memberTypes as $memberType) { |
|
431 | + foreach ($memberTypes as $memberType) { |
|
432 | 432 | if (isset($includedTypeNames[$memberType->name])) { |
433 | 433 | $this->reportError( |
434 | - "Union type {$union->name} can only include type ". |
|
434 | + "Union type {$union->name} can only include type " . |
|
435 | 435 | "{$memberType->name} once.", |
436 | 436 | $this->getUnionMemberTypeNodes($union, $memberType->name) |
437 | 437 | ); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | $includedTypeNames[$memberType->name] = true; |
441 | 441 | if (!$memberType instanceof ObjectType) { |
442 | 442 | $this->reportError( |
443 | - "Union type {$union->name} can only include Object types, ". |
|
443 | + "Union type {$union->name} can only include Object types, " . |
|
444 | 444 | "it cannot include " . Utils::printSafe($memberType) . ".", |
445 | 445 | $this->getUnionMemberTypeNodes($union, Utils::printSafe($memberType)) |
446 | 446 | ); |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | ); |
460 | 460 | } |
461 | 461 | |
462 | - foreach($enumValues as $enumValue) { |
|
462 | + foreach ($enumValues as $enumValue) { |
|
463 | 463 | $valueName = $enumValue->name; |
464 | 464 | |
465 | 465 | // Ensure no duplicates |
@@ -545,9 +545,9 @@ discard block |
||
545 | 545 | $implementsNodes = []; |
546 | 546 | $astNodes = $this->getAllObjectOrInterfaceNodes($type); |
547 | 547 | |
548 | - foreach($astNodes as $astNode) { |
|
548 | + foreach ($astNodes as $astNode) { |
|
549 | 549 | if ($astNode && $astNode->interfaces) { |
550 | - foreach($astNode->interfaces as $node) { |
|
550 | + foreach ($astNode->interfaces as $node) { |
|
551 | 551 | if ($node->name->value === $iface->name) { |
552 | 552 | $implementsNodes[] = $node; |
553 | 553 | } |
@@ -578,9 +578,9 @@ discard block |
||
578 | 578 | { |
579 | 579 | $fieldNodes = []; |
580 | 580 | $astNodes = $this->getAllObjectOrInterfaceNodes($type); |
581 | - foreach($astNodes as $astNode) { |
|
581 | + foreach ($astNodes as $astNode) { |
|
582 | 582 | if ($astNode && $astNode->fields) { |
583 | - foreach($astNode->fields as $node) { |
|
583 | + foreach ($astNode->fields as $node) { |
|
584 | 584 | if ($node->name->value === $fieldName) { |
585 | 585 | $fieldNodes[] = $node; |
586 | 586 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | $argNodes = []; |
656 | 656 | $directiveNode = $directive->astNode; |
657 | 657 | if ($directiveNode && $directiveNode->arguments) { |
658 | - foreach($directiveNode->arguments as $node) { |
|
658 | + foreach ($directiveNode->arguments as $node) { |
|
659 | 659 | if ($node->name->value === $argName) { |
660 | 660 | $argNodes[] = $node; |
661 | 661 | } |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | if ($union->astNode && $union->astNode->types) { |
687 | 687 | return array_filter( |
688 | 688 | $union->astNode->types, |
689 | - function (NamedTypeNode $value) use ($typeName) { |
|
689 | + function(NamedTypeNode $value) use ($typeName) { |
|
690 | 690 | return $value->name->value === $typeName; |
691 | 691 | } |
692 | 692 | ); |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | if ($enum->astNode && $enum->astNode->values) { |
706 | 706 | return array_filter( |
707 | 707 | iterator_to_array($enum->astNode->values), |
708 | - function (EnumValueDefinitionNode $value) use ($valueName) { |
|
708 | + function(EnumValueDefinitionNode $value) use ($valueName) { |
|
709 | 709 | return $value->name->value === $valueName; |
710 | 710 | } |
711 | 711 | ); |