@@ -43,7 +43,7 @@ |
||
43 | 43 | ); |
44 | 44 | } |
45 | 45 | |
46 | - if (! is_numeric($value) && $value !== true && $value !== false) { |
|
46 | + if (!is_numeric($value) && $value !== true && $value !== false) { |
|
47 | 47 | throw new Error( |
48 | 48 | 'Float cannot represent non numeric value: ' . |
49 | 49 | Utils::printSafe($value) |
@@ -63,7 +63,7 @@ |
||
63 | 63 | { |
64 | 64 | $config = new static(); |
65 | 65 | |
66 | - if (! empty($options)) { |
|
66 | + if (!empty($options)) { |
|
67 | 67 | if (isset($options['query'])) { |
68 | 68 | $config->setQuery($options['query']); |
69 | 69 | } |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | public function validateRootTypes() |
65 | 65 | { |
66 | 66 | $queryType = $this->schema->getQueryType(); |
67 | - if (! $queryType) { |
|
67 | + if (!$queryType) { |
|
68 | 68 | $this->reportError( |
69 | 69 | 'Query root type must be provided.', |
70 | 70 | $this->schema->getAstNode() |
71 | 71 | ); |
72 | - } elseif (! $queryType instanceof ObjectType) { |
|
72 | + } elseif (!$queryType instanceof ObjectType) { |
|
73 | 73 | $this->reportError( |
74 | 74 | 'Query root type must be Object type, it cannot be ' . Utils::printSafe($queryType) . '.', |
75 | 75 | $this->getOperationTypeNode($queryType, 'query') |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | $mutationType = $this->schema->getMutationType(); |
80 | - if ($mutationType && ! $mutationType instanceof ObjectType) { |
|
80 | + if ($mutationType && !$mutationType instanceof ObjectType) { |
|
81 | 81 | $this->reportError( |
82 | 82 | 'Mutation root type must be Object type if provided, it cannot be ' . Utils::printSafe($mutationType) . '.', |
83 | 83 | $this->getOperationTypeNode($mutationType, 'mutation') |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | $subscriptionType = $this->schema->getSubscriptionType(); |
88 | - if (! $subscriptionType || $subscriptionType instanceof ObjectType) { |
|
88 | + if (!$subscriptionType || $subscriptionType instanceof ObjectType) { |
|
89 | 89 | return; |
90 | 90 | } |
91 | 91 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $directives = $this->schema->getDirectives(); |
144 | 144 | foreach ($directives as $directive) { |
145 | 145 | // Ensure all directives are in fact GraphQL directives. |
146 | - if (! $directive instanceof Directive) { |
|
146 | + if (!$directive instanceof Directive) { |
|
147 | 147 | $this->reportError( |
148 | 148 | 'Expected directive but got: ' . Utils::printSafe($directive) . '.', |
149 | 149 | is_object($directive) ? $directive->astNode : null |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | { |
199 | 199 | // Ensure names are valid, however introspection types opt out. |
200 | 200 | $error = Utils::isValidNameError($node->name, $node->astNode); |
201 | - if (! $error || Introspection::isIntrospectionType($node)) { |
|
201 | + if (!$error || Introspection::isIntrospectionType($node)) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $typeMap = $this->schema->getTypeMap(); |
243 | 243 | foreach ($typeMap as $typeName => $type) { |
244 | 244 | // Ensure all provided types are in fact GraphQL type. |
245 | - if (! $type instanceof NamedType) { |
|
245 | + if (!$type instanceof NamedType) { |
|
246 | 246 | $this->reportError( |
247 | 247 | 'Expected GraphQL named type but got: ' . Utils::printSafe($type) . '.', |
248 | 248 | is_object($type) ? $type->astNode : null |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $fieldMap = $type->getFields(); |
283 | 283 | |
284 | 284 | // Objects and Interfaces both must define one or more fields. |
285 | - if (! $fieldMap) { |
|
285 | + if (!$fieldMap) { |
|
286 | 286 | $this->reportError( |
287 | 287 | sprintf('Type %s must define one or more fields.', $type->name), |
288 | 288 | $this->getAllObjectOrInterfaceNodes($type) |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | |
306 | 306 | // Ensure the type is an output type |
307 | - if (! Type::isOutputType($field->getType())) { |
|
307 | + if (!Type::isOutputType($field->getType())) { |
|
308 | 308 | $this->reportError( |
309 | 309 | sprintf( |
310 | 310 | 'The type of %s.%s must be Output Type but got: %s.', |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $fieldNodes = []; |
380 | 380 | $astNodes = $this->getAllObjectOrInterfaceNodes($type); |
381 | 381 | foreach ($astNodes as $astNode) { |
382 | - if (! $astNode || ! $astNode->fields) { |
|
382 | + if (!$astNode || !$astNode->fields) { |
|
383 | 383 | continue; |
384 | 384 | } |
385 | 385 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | { |
473 | 473 | $implementedTypeNames = []; |
474 | 474 | foreach ($object->getInterfaces() as $iface) { |
475 | - if (! $iface instanceof InterfaceType) { |
|
475 | + if (!$iface instanceof InterfaceType) { |
|
476 | 476 | $this->reportError( |
477 | 477 | sprintf( |
478 | 478 | 'Type %s must only implement Interface types, it cannot implement %s.', |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | $astNodes = $this->getAllObjectOrInterfaceNodes($type); |
517 | 517 | |
518 | 518 | foreach ($astNodes as $astNode) { |
519 | - if (! $astNode || ! $astNode->interfaces) { |
|
519 | + if (!$astNode || !$astNode->interfaces) { |
|
520 | 520 | continue; |
521 | 521 | } |
522 | 522 | |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | : null; |
548 | 548 | |
549 | 549 | // Assert interface field exists on object. |
550 | - if (! $objectField) { |
|
550 | + if (!$objectField) { |
|
551 | 551 | $this->reportError( |
552 | 552 | sprintf( |
553 | 553 | 'Interface field %s.%s expected but %s does not provide it.', |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | |
563 | 563 | // Assert interface field type is satisfied by object field type, by being |
564 | 564 | // a valid subtype. (covariant) |
565 | - if (! TypeComparators::isTypeSubTypeOf( |
|
565 | + if (!TypeComparators::isTypeSubTypeOf( |
|
566 | 566 | $this->schema, |
567 | 567 | $objectField->getType(), |
568 | 568 | $ifaceField->getType() |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | } |
599 | 599 | |
600 | 600 | // Assert interface field arg exists on object field. |
601 | - if (! $objectArg) { |
|
601 | + if (!$objectArg) { |
|
602 | 602 | $this->reportError( |
603 | 603 | sprintf( |
604 | 604 | 'Interface field argument %s.%s(%s:) expected but %s.%s does not provide it.', |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | // Assert interface field arg type matches object field arg type. |
620 | 620 | // (invariant) |
621 | 621 | // TODO: change to contravariant? |
622 | - if (! TypeComparators::isEqualType($ifaceArg->getType(), $objectArg->getType())) { |
|
622 | + if (!TypeComparators::isEqualType($ifaceArg->getType(), $objectArg->getType())) { |
|
623 | 623 | $this->reportError( |
624 | 624 | sprintf( |
625 | 625 | 'Interface field argument %s.%s(%s:) expects type %s but %s.%s(%s:) is type %s.', |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | } |
654 | 654 | } |
655 | 655 | |
656 | - if ($ifaceArg || ! ($objectArg->getType() instanceof NonNull)) { |
|
656 | + if ($ifaceArg || !($objectArg->getType() instanceof NonNull)) { |
|
657 | 657 | continue; |
658 | 658 | } |
659 | 659 | |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | { |
681 | 681 | $memberTypes = $union->getTypes(); |
682 | 682 | |
683 | - if (! $memberTypes) { |
|
683 | + if (!$memberTypes) { |
|
684 | 684 | $this->reportError( |
685 | 685 | sprintf('Union type %s must define one or more member types.', $union->name), |
686 | 686 | $union->astNode |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | if ($union->astNode && $union->astNode->types) { |
723 | 723 | return array_filter( |
724 | 724 | $union->astNode->types, |
725 | - function (NamedTypeNode $value) use ($typeName) { |
|
725 | + function(NamedTypeNode $value) use ($typeName) { |
|
726 | 726 | return $value->name->value === $typeName; |
727 | 727 | } |
728 | 728 | ); |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | { |
737 | 737 | $enumValues = $enumType->getValues(); |
738 | 738 | |
739 | - if (! $enumValues) { |
|
739 | + if (!$enumValues) { |
|
740 | 740 | $this->reportError( |
741 | 741 | sprintf('Enum type %s must define one or more values.', $enumType->name), |
742 | 742 | $enumType->astNode |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | if ($enum->astNode && $enum->astNode->values) { |
778 | 778 | return array_filter( |
779 | 779 | iterator_to_array($enum->astNode->values), |
780 | - function (EnumValueDefinitionNode $value) use ($valueName) { |
|
780 | + function(EnumValueDefinitionNode $value) use ($valueName) { |
|
781 | 781 | return $value->name->value === $valueName; |
782 | 782 | } |
783 | 783 | ); |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | { |
792 | 792 | $fieldMap = $inputObj->getFields(); |
793 | 793 | |
794 | - if (! $fieldMap) { |
|
794 | + if (!$fieldMap) { |
|
795 | 795 | $this->reportError( |
796 | 796 | sprintf('Input Object type %s must define one or more fields.', $inputObj->name), |
797 | 797 | $inputObj->astNode |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ); |
57 | 57 | $descriptions = $options; |
58 | 58 | } else { |
59 | - $descriptions = ! array_key_exists('descriptions', $options) || $options['descriptions'] === true; |
|
59 | + $descriptions = !array_key_exists('descriptions', $options) || $options['descriptions'] === true; |
|
60 | 60 | } |
61 | 61 | $descriptionField = $descriptions ? 'description' : ''; |
62 | 62 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | public static function _schema() |
182 | 182 | { |
183 | - if (! isset(self::$map['__Schema'])) { |
|
183 | + if (!isset(self::$map['__Schema'])) { |
|
184 | 184 | self::$map['__Schema'] = new ObjectType([ |
185 | 185 | 'name' => '__Schema', |
186 | 186 | 'isIntrospection' => true, |
@@ -193,14 +193,14 @@ discard block |
||
193 | 193 | 'types' => [ |
194 | 194 | 'description' => 'A list of all types supported by this server.', |
195 | 195 | 'type' => new NonNull(new ListOfType(new NonNull(self::_type()))), |
196 | - 'resolve' => function (Schema $schema) { |
|
196 | + 'resolve' => function(Schema $schema) { |
|
197 | 197 | return array_values($schema->getTypeMap()); |
198 | 198 | }, |
199 | 199 | ], |
200 | 200 | 'queryType' => [ |
201 | 201 | 'description' => 'The type that query operations will be rooted at.', |
202 | 202 | 'type' => new NonNull(self::_type()), |
203 | - 'resolve' => function (Schema $schema) { |
|
203 | + 'resolve' => function(Schema $schema) { |
|
204 | 204 | return $schema->getQueryType(); |
205 | 205 | }, |
206 | 206 | ], |
@@ -209,21 +209,21 @@ discard block |
||
209 | 209 | 'If this server supports mutation, the type that ' . |
210 | 210 | 'mutation operations will be rooted at.', |
211 | 211 | 'type' => self::_type(), |
212 | - 'resolve' => function (Schema $schema) { |
|
212 | + 'resolve' => function(Schema $schema) { |
|
213 | 213 | return $schema->getMutationType(); |
214 | 214 | }, |
215 | 215 | ], |
216 | 216 | 'subscriptionType' => [ |
217 | 217 | 'description' => 'If this server support subscription, the type that subscription operations will be rooted at.', |
218 | 218 | 'type' => self::_type(), |
219 | - 'resolve' => function (Schema $schema) { |
|
219 | + 'resolve' => function(Schema $schema) { |
|
220 | 220 | return $schema->getSubscriptionType(); |
221 | 221 | }, |
222 | 222 | ], |
223 | 223 | 'directives' => [ |
224 | 224 | 'description' => 'A list of all directives supported by this server.', |
225 | 225 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_directive()))), |
226 | - 'resolve' => function (Schema $schema) { |
|
226 | + 'resolve' => function(Schema $schema) { |
|
227 | 227 | return $schema->getDirectives(); |
228 | 228 | }, |
229 | 229 | ], |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | public static function _type() |
238 | 238 | { |
239 | - if (! isset(self::$map['__Type'])) { |
|
239 | + if (!isset(self::$map['__Type'])) { |
|
240 | 240 | self::$map['__Type'] = new ObjectType([ |
241 | 241 | 'name' => '__Type', |
242 | 242 | 'isIntrospection' => true, |
@@ -250,11 +250,11 @@ discard block |
||
250 | 250 | 'Object and Interface types provide the fields they describe. Abstract ' . |
251 | 251 | 'types, Union and Interface, provide the Object types possible ' . |
252 | 252 | 'at runtime. List and NonNull types compose other types.', |
253 | - 'fields' => function () { |
|
253 | + 'fields' => function() { |
|
254 | 254 | return [ |
255 | 255 | 'kind' => [ |
256 | 256 | 'type' => Type::nonNull(self::_typeKind()), |
257 | - 'resolve' => function (Type $type) { |
|
257 | + 'resolve' => function(Type $type) { |
|
258 | 258 | switch (true) { |
259 | 259 | case $type instanceof ListOfType: |
260 | 260 | return TypeKind::LIST_KIND; |
@@ -284,15 +284,15 @@ discard block |
||
284 | 284 | 'args' => [ |
285 | 285 | 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false], |
286 | 286 | ], |
287 | - 'resolve' => function (Type $type, $args) { |
|
287 | + 'resolve' => function(Type $type, $args) { |
|
288 | 288 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
289 | 289 | $fields = $type->getFields(); |
290 | 290 | |
291 | 291 | if (empty($args['includeDeprecated'])) { |
292 | 292 | $fields = array_filter( |
293 | 293 | $fields, |
294 | - function (FieldDefinition $field) { |
|
295 | - return ! $field->deprecationReason; |
|
294 | + function(FieldDefinition $field) { |
|
295 | + return !$field->deprecationReason; |
|
296 | 296 | } |
297 | 297 | ); |
298 | 298 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | ], |
306 | 306 | 'interfaces' => [ |
307 | 307 | 'type' => Type::listOf(Type::nonNull(self::_type())), |
308 | - 'resolve' => function ($type) { |
|
308 | + 'resolve' => function($type) { |
|
309 | 309 | if ($type instanceof ObjectType) { |
310 | 310 | return $type->getInterfaces(); |
311 | 311 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | ], |
316 | 316 | 'possibleTypes' => [ |
317 | 317 | 'type' => Type::listOf(Type::nonNull(self::_type())), |
318 | - 'resolve' => function ($type, $args, $context, ResolveInfo $info) { |
|
318 | + 'resolve' => function($type, $args, $context, ResolveInfo $info) { |
|
319 | 319 | if ($type instanceof InterfaceType || $type instanceof UnionType) { |
320 | 320 | return $info->schema->getPossibleTypes($type); |
321 | 321 | } |
@@ -328,15 +328,15 @@ discard block |
||
328 | 328 | 'args' => [ |
329 | 329 | 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false], |
330 | 330 | ], |
331 | - 'resolve' => function ($type, $args) { |
|
331 | + 'resolve' => function($type, $args) { |
|
332 | 332 | if ($type instanceof EnumType) { |
333 | 333 | $values = array_values($type->getValues()); |
334 | 334 | |
335 | 335 | if (empty($args['includeDeprecated'])) { |
336 | 336 | $values = array_filter( |
337 | 337 | $values, |
338 | - function ($value) { |
|
339 | - return ! $value->deprecationReason; |
|
338 | + function($value) { |
|
339 | + return !$value->deprecationReason; |
|
340 | 340 | } |
341 | 341 | ); |
342 | 342 | } |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | ], |
350 | 350 | 'inputFields' => [ |
351 | 351 | 'type' => Type::listOf(Type::nonNull(self::_inputValue())), |
352 | - 'resolve' => function ($type) { |
|
352 | + 'resolve' => function($type) { |
|
353 | 353 | if ($type instanceof InputObjectType) { |
354 | 354 | return array_values($type->getFields()); |
355 | 355 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | ], |
360 | 360 | 'ofType' => [ |
361 | 361 | 'type' => self::_type(), |
362 | - 'resolve' => function ($type) { |
|
362 | + 'resolve' => function($type) { |
|
363 | 363 | if ($type instanceof WrappingType) { |
364 | 364 | return $type->getWrappedType(); |
365 | 365 | } |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | |
378 | 378 | public static function _typeKind() |
379 | 379 | { |
380 | - if (! isset(self::$map['__TypeKind'])) { |
|
380 | + if (!isset(self::$map['__TypeKind'])) { |
|
381 | 381 | self::$map['__TypeKind'] = new EnumType([ |
382 | 382 | 'name' => '__TypeKind', |
383 | 383 | 'isIntrospection' => true, |
@@ -424,33 +424,33 @@ discard block |
||
424 | 424 | |
425 | 425 | public static function _field() |
426 | 426 | { |
427 | - if (! isset(self::$map['__Field'])) { |
|
427 | + if (!isset(self::$map['__Field'])) { |
|
428 | 428 | self::$map['__Field'] = new ObjectType([ |
429 | 429 | 'name' => '__Field', |
430 | 430 | 'isIntrospection' => true, |
431 | 431 | 'description' => |
432 | 432 | 'Object and Interface types are described by a list of Fields, each of ' . |
433 | 433 | 'which has a name, potentially a list of arguments, and a return type.', |
434 | - 'fields' => function () { |
|
434 | + 'fields' => function() { |
|
435 | 435 | return [ |
436 | 436 | 'name' => ['type' => Type::nonNull(Type::string())], |
437 | 437 | 'description' => ['type' => Type::string()], |
438 | 438 | 'args' => [ |
439 | 439 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))), |
440 | - 'resolve' => function (FieldDefinition $field) { |
|
440 | + 'resolve' => function(FieldDefinition $field) { |
|
441 | 441 | return empty($field->args) ? [] : $field->args; |
442 | 442 | }, |
443 | 443 | ], |
444 | 444 | 'type' => [ |
445 | 445 | 'type' => Type::nonNull(self::_type()), |
446 | - 'resolve' => function (FieldDefinition $field) { |
|
446 | + 'resolve' => function(FieldDefinition $field) { |
|
447 | 447 | return $field->getType(); |
448 | 448 | }, |
449 | 449 | ], |
450 | 450 | 'isDeprecated' => [ |
451 | 451 | 'type' => Type::nonNull(Type::boolean()), |
452 | - 'resolve' => function (FieldDefinition $field) { |
|
453 | - return ! ! $field->deprecationReason; |
|
452 | + 'resolve' => function(FieldDefinition $field) { |
|
453 | + return !!$field->deprecationReason; |
|
454 | 454 | }, |
455 | 455 | ], |
456 | 456 | 'deprecationReason' => [ |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | |
467 | 467 | public static function _inputValue() |
468 | 468 | { |
469 | - if (! isset(self::$map['__InputValue'])) { |
|
469 | + if (!isset(self::$map['__InputValue'])) { |
|
470 | 470 | self::$map['__InputValue'] = new ObjectType([ |
471 | 471 | 'name' => '__InputValue', |
472 | 472 | 'isIntrospection' => true, |
@@ -474,13 +474,13 @@ discard block |
||
474 | 474 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
475 | 475 | 'InputObject are represented as Input Values which describe their type ' . |
476 | 476 | 'and optionally a default value.', |
477 | - 'fields' => function () { |
|
477 | + 'fields' => function() { |
|
478 | 478 | return [ |
479 | 479 | 'name' => ['type' => Type::nonNull(Type::string())], |
480 | 480 | 'description' => ['type' => Type::string()], |
481 | 481 | 'type' => [ |
482 | 482 | 'type' => Type::nonNull(self::_type()), |
483 | - 'resolve' => function ($value) { |
|
483 | + 'resolve' => function($value) { |
|
484 | 484 | return method_exists($value, 'getType') ? $value->getType() : $value->type; |
485 | 485 | }, |
486 | 486 | ], |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | 'type' => Type::string(), |
489 | 489 | 'description' => |
490 | 490 | 'A GraphQL-formatted string representing the default value for this input value.', |
491 | - 'resolve' => function ($inputValue) { |
|
491 | + 'resolve' => function($inputValue) { |
|
492 | 492 | /** @var FieldArgument|InputObjectField $inputValue */ |
493 | - return ! $inputValue->defaultValueExists() |
|
493 | + return !$inputValue->defaultValueExists() |
|
494 | 494 | ? null |
495 | 495 | : Printer::doPrint(AST::astFromValue( |
496 | 496 | $inputValue->defaultValue, |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | |
509 | 509 | public static function _enumValue() |
510 | 510 | { |
511 | - if (! isset(self::$map['__EnumValue'])) { |
|
511 | + if (!isset(self::$map['__EnumValue'])) { |
|
512 | 512 | self::$map['__EnumValue'] = new ObjectType([ |
513 | 513 | 'name' => '__EnumValue', |
514 | 514 | 'isIntrospection' => true, |
@@ -521,8 +521,8 @@ discard block |
||
521 | 521 | 'description' => ['type' => Type::string()], |
522 | 522 | 'isDeprecated' => [ |
523 | 523 | 'type' => Type::nonNull(Type::boolean()), |
524 | - 'resolve' => function ($enumValue) { |
|
525 | - return ! ! $enumValue->deprecationReason; |
|
524 | + 'resolve' => function($enumValue) { |
|
525 | + return !!$enumValue->deprecationReason; |
|
526 | 526 | }, |
527 | 527 | ], |
528 | 528 | 'deprecationReason' => [ |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | |
538 | 538 | public static function _directive() |
539 | 539 | { |
540 | - if (! isset(self::$map['__Directive'])) { |
|
540 | + if (!isset(self::$map['__Directive'])) { |
|
541 | 541 | self::$map['__Directive'] = new ObjectType([ |
542 | 542 | 'name' => '__Directive', |
543 | 543 | 'isIntrospection' => true, |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | ], |
558 | 558 | 'args' => [ |
559 | 559 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))), |
560 | - 'resolve' => function (Directive $directive) { |
|
560 | + 'resolve' => function(Directive $directive) { |
|
561 | 561 | return $directive->args ?: []; |
562 | 562 | }, |
563 | 563 | ], |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | 'onOperation' => [ |
568 | 568 | 'deprecationReason' => 'Use `locations`.', |
569 | 569 | 'type' => Type::nonNull(Type::boolean()), |
570 | - 'resolve' => function ($d) { |
|
570 | + 'resolve' => function($d) { |
|
571 | 571 | return in_array(DirectiveLocation::QUERY, $d->locations) || |
572 | 572 | in_array(DirectiveLocation::MUTATION, $d->locations) || |
573 | 573 | in_array(DirectiveLocation::SUBSCRIPTION, $d->locations); |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | 'onFragment' => [ |
577 | 577 | 'deprecationReason' => 'Use `locations`.', |
578 | 578 | 'type' => Type::nonNull(Type::boolean()), |
579 | - 'resolve' => function ($d) { |
|
579 | + 'resolve' => function($d) { |
|
580 | 580 | return in_array(DirectiveLocation::FRAGMENT_SPREAD, $d->locations) || |
581 | 581 | in_array(DirectiveLocation::INLINE_FRAGMENT, $d->locations) || |
582 | 582 | in_array(DirectiveLocation::FRAGMENT_DEFINITION, $d->locations); |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | 'onField' => [ |
586 | 586 | 'deprecationReason' => 'Use `locations`.', |
587 | 587 | 'type' => Type::nonNull(Type::boolean()), |
588 | - 'resolve' => function ($d) { |
|
588 | + 'resolve' => function($d) { |
|
589 | 589 | return in_array(DirectiveLocation::FIELD, $d->locations); |
590 | 590 | }, |
591 | 591 | ], |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | |
599 | 599 | public static function _directiveLocation() |
600 | 600 | { |
601 | - if (! isset(self::$map['__DirectiveLocation'])) { |
|
601 | + if (!isset(self::$map['__DirectiveLocation'])) { |
|
602 | 602 | self::$map['__DirectiveLocation'] = new EnumType([ |
603 | 603 | 'name' => '__DirectiveLocation', |
604 | 604 | 'isIntrospection' => true, |
@@ -688,13 +688,13 @@ discard block |
||
688 | 688 | |
689 | 689 | public static function schemaMetaFieldDef() |
690 | 690 | { |
691 | - if (! isset(self::$map['__schema'])) { |
|
691 | + if (!isset(self::$map['__schema'])) { |
|
692 | 692 | self::$map['__schema'] = FieldDefinition::create([ |
693 | 693 | 'name' => '__schema', |
694 | 694 | 'type' => Type::nonNull(self::_schema()), |
695 | 695 | 'description' => 'Access the current type schema of this server.', |
696 | 696 | 'args' => [], |
697 | - 'resolve' => function ( |
|
697 | + 'resolve' => function( |
|
698 | 698 | $source, |
699 | 699 | $args, |
700 | 700 | $context, |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | |
711 | 711 | public static function typeMetaFieldDef() |
712 | 712 | { |
713 | - if (! isset(self::$map['__type'])) { |
|
713 | + if (!isset(self::$map['__type'])) { |
|
714 | 714 | self::$map['__type'] = FieldDefinition::create([ |
715 | 715 | 'name' => '__type', |
716 | 716 | 'type' => self::_type(), |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | 'args' => [ |
719 | 719 | ['name' => 'name', 'type' => Type::nonNull(Type::string())], |
720 | 720 | ], |
721 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info) { |
|
721 | + 'resolve' => function($source, $args, $context, ResolveInfo $info) { |
|
722 | 722 | return $info->schema->getType($args['name']); |
723 | 723 | }, |
724 | 724 | ]); |
@@ -729,13 +729,13 @@ discard block |
||
729 | 729 | |
730 | 730 | public static function typeNameMetaFieldDef() |
731 | 731 | { |
732 | - if (! isset(self::$map['__typename'])) { |
|
732 | + if (!isset(self::$map['__typename'])) { |
|
733 | 733 | self::$map['__typename'] = FieldDefinition::create([ |
734 | 734 | 'name' => '__typename', |
735 | 735 | 'type' => Type::nonNull(Type::string()), |
736 | 736 | 'description' => 'The name of the current Object type at runtime.', |
737 | 737 | 'args' => [], |
738 | - 'resolve' => function ( |
|
738 | + 'resolve' => function( |
|
739 | 739 | $source, |
740 | 740 | $args, |
741 | 741 | $context, |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | Utils::getVariableType($config) |
102 | 102 | ); |
103 | 103 | Utils::invariant( |
104 | - ! $config->types || is_array($config->types) || is_callable($config->types), |
|
104 | + !$config->types || is_array($config->types) || is_callable($config->types), |
|
105 | 105 | '"types" must be array or callable if provided but got: ' . Utils::getVariableType($config->types) |
106 | 106 | ); |
107 | 107 | Utils::invariant( |
108 | - ! $config->directives || is_array($config->directives), |
|
108 | + !$config->directives || is_array($config->directives), |
|
109 | 109 | '"directives" must be Array if provided but got: ' . Utils::getVariableType($config->directives) |
110 | 110 | ); |
111 | 111 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $types = $types(); |
156 | 156 | } |
157 | 157 | |
158 | - if (! is_array($types) && ! $types instanceof \Traversable) { |
|
158 | + if (!is_array($types) && !$types instanceof \Traversable) { |
|
159 | 159 | throw new InvariantViolation(sprintf( |
160 | 160 | 'Schema types callable must return array or instance of Traversable but got: %s', |
161 | 161 | Utils::getVariableType($types) |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | foreach ($types as $index => $type) { |
166 | - if (! $type instanceof Type) { |
|
166 | + if (!$type instanceof Type) { |
|
167 | 167 | throw new InvariantViolation(sprintf( |
168 | 168 | 'Each entry of schema types must be instance of GraphQL\Type\Definition\Type but entry at %s is %s', |
169 | 169 | $index, |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function getTypeMap() |
187 | 187 | { |
188 | - if (! $this->fullyLoaded) { |
|
188 | + if (!$this->fullyLoaded) { |
|
189 | 189 | $this->resolvedTypes = $this->collectAllTypes(); |
190 | 190 | $this->fullyLoaded = true; |
191 | 191 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $typeMap = TypeInfo::extractTypes($type, $typeMap); |
204 | 204 | } |
205 | 205 | foreach ($this->getDirectives() as $directive) { |
206 | - if (! ($directive instanceof Directive)) { |
|
206 | + if (!($directive instanceof Directive)) { |
|
207 | 207 | continue; |
208 | 208 | } |
209 | 209 | |
@@ -281,9 +281,9 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public function getType($name) |
283 | 283 | { |
284 | - if (! isset($this->resolvedTypes[$name])) { |
|
284 | + if (!isset($this->resolvedTypes[$name])) { |
|
285 | 285 | $type = $this->loadType($name); |
286 | - if (! $type) { |
|
286 | + if (!$type) { |
|
287 | 287 | return null; |
288 | 288 | } |
289 | 289 | $this->resolvedTypes[$name] = $type; |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | { |
301 | 301 | $typeLoader = $this->config->typeLoader; |
302 | 302 | |
303 | - if (! $typeLoader) { |
|
303 | + if (!$typeLoader) { |
|
304 | 304 | return $this->defaultTypeLoader($typeName); |
305 | 305 | } |
306 | 306 | |
307 | 307 | $type = $typeLoader($typeName); |
308 | 308 | |
309 | - if (! $type instanceof Type) { |
|
309 | + if (!$type instanceof Type) { |
|
310 | 310 | throw new InvariantViolation( |
311 | 311 | sprintf( |
312 | 312 | 'Type loader is expected to return valid type "%s", but it returned %s', |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | foreach ($this->getTypeMap() as $type) { |
363 | 363 | if ($type instanceof ObjectType) { |
364 | 364 | foreach ($type->getInterfaces() as $interface) { |
365 | - if (! ($interface instanceof InterfaceType)) { |
|
365 | + if (!($interface instanceof InterfaceType)) { |
|
366 | 366 | continue; |
367 | 367 | } |
368 | 368 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | $type->assertValid(); |
448 | 448 | |
449 | 449 | // Make sure type loader returns the same instance as registered in other places of schema |
450 | - if (! $this->config->typeLoader) { |
|
450 | + if (!$this->config->typeLoader) { |
|
451 | 451 | continue; |
452 | 452 | } |
453 | 453 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | // Keep track of all possible types for abstract types |
40 | 40 | foreach ($this->typeMap as $typeName => $type) { |
41 | - if (! ($type instanceof ObjectType)) { |
|
41 | + if (!($type instanceof ObjectType)) { |
|
42 | 42 | continue; |
43 | 43 | } |
44 | 44 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function resolvePossibleTypes(AbstractType $abstractType) |
63 | 63 | { |
64 | - if (! isset($this->typeMap[$abstractType->name])) { |
|
64 | + if (!isset($this->typeMap[$abstractType->name])) { |
|
65 | 65 | return []; |
66 | 66 | } |
67 | 67 |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function resolvePossibleTypes(AbstractType $type) |
68 | 68 | { |
69 | - if (! isset($this->possibleTypeMap[$type->name])) { |
|
69 | + if (!isset($this->possibleTypeMap[$type->name])) { |
|
70 | 70 | return []; |
71 | 71 | } |
72 | - if (! isset($this->loadedPossibleTypes[$type->name])) { |
|
72 | + if (!isset($this->loadedPossibleTypes[$type->name])) { |
|
73 | 73 | $tmp = []; |
74 | 74 | foreach ($this->possibleTypeMap[$type->name] as $typeName => $true) { |
75 | 75 | $obj = $this->resolveType($typeName); |
76 | - if (! $obj instanceof ObjectType) { |
|
76 | + if (!$obj instanceof ObjectType) { |
|
77 | 77 | throw new InvariantViolation( |
78 | 78 | sprintf( |
79 | 79 | 'Lazy Type Resolution Error: Implementation %s of interface %s is expected to be instance of ObjectType, but got %s', |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function resolveType($name) |
98 | 98 | { |
99 | - if (! isset($this->typeMap[$name])) { |
|
99 | + if (!isset($this->typeMap[$name])) { |
|
100 | 100 | return null; |
101 | 101 | } |
102 | - if (! isset($this->loadedTypes[$name])) { |
|
102 | + if (!isset($this->loadedTypes[$name])) { |
|
103 | 103 | $type = call_user_func($this->typeLoader, $name); |
104 | - if (! $type instanceof Type && $type !== null) { |
|
104 | + if (!$type instanceof Type && $type !== null) { |
|
105 | 105 | throw new InvariantViolation( |
106 | 106 | 'Lazy Type Resolution Error: Expecting GraphQL Type instance, but got ' . |
107 | 107 | Utils::getVariableType($type) |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | if (isset($node->directives) && $node->directives instanceof NodeList) { |
126 | 126 | $directiveNode = Utils::find( |
127 | 127 | $node->directives, |
128 | - function (DirectiveNode $directive) use ($directiveDef) { |
|
128 | + function(DirectiveNode $directive) use ($directiveDef) { |
|
129 | 129 | return $directive->name->value === $directiveDef->name; |
130 | 130 | } |
131 | 131 | ); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | /** @var ArgumentNode[] $argNodeMap */ |
163 | 163 | $argNodeMap = $argNodes ? Utils::keyMap( |
164 | 164 | $argNodes, |
165 | - function (ArgumentNode $arg) { |
|
165 | + function(ArgumentNode $arg) { |
|
166 | 166 | return $arg->name->value; |
167 | 167 | } |
168 | 168 | ) : []; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $argType = $argDef->getType(); |
173 | 173 | $argumentNode = $argNodeMap[$name] ?? null; |
174 | 174 | |
175 | - if (! $argumentNode) { |
|
175 | + if (!$argumentNode) { |
|
176 | 176 | if ($argDef->defaultValueExists()) { |
177 | 177 | $coercedValues[$name] = $argDef->defaultValue; |
178 | 178 | } elseif ($argType instanceof NonNull) { |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | return $errors |
244 | 244 | ? array_map( |
245 | - function (Throwable $error) { |
|
245 | + function(Throwable $error) { |
|
246 | 246 | return $error->getMessage(); |
247 | 247 | }, |
248 | 248 | $errors |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | private function __construct(ExecutionContext $context) |
66 | 66 | { |
67 | - if (! self::$UNDEFINED) { |
|
67 | + if (!self::$UNDEFINED) { |
|
68 | 68 | self::$UNDEFINED = Utils::undefined(); |
69 | 69 | } |
70 | 70 | |
@@ -212,10 +212,10 @@ discard block |
||
212 | 212 | foreach ($documentNode->definitions as $definition) { |
213 | 213 | switch ($definition->kind) { |
214 | 214 | case NodeKind::OPERATION_DEFINITION: |
215 | - if (! $operationName && $operation) { |
|
215 | + if (!$operationName && $operation) { |
|
216 | 216 | $hasMultipleAssumedOperations = true; |
217 | 217 | } |
218 | - if (! $operationName || |
|
218 | + if (!$operationName || |
|
219 | 219 | (isset($definition->name) && $definition->name->value === $operationName)) { |
220 | 220 | $operation = $definition; |
221 | 221 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | - if (! $operation) { |
|
229 | + if (!$operation) { |
|
230 | 230 | if ($operationName) { |
231 | 231 | $errors[] = new Error(sprintf('Unknown operation named "%s".', $operationName)); |
232 | 232 | } else { |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | private function buildResponse($data) |
303 | 303 | { |
304 | 304 | if ($this->isPromise($data)) { |
305 | - return $data->then(function ($resolved) { |
|
305 | + return $data->then(function($resolved) { |
|
306 | 306 | return $this->buildResponse($resolved); |
307 | 307 | }); |
308 | 308 | } |
@@ -332,13 +332,12 @@ discard block |
||
332 | 332 | // Similar to completeValueCatchingError. |
333 | 333 | try { |
334 | 334 | $result = $operation->operation === 'mutation' ? |
335 | - $this->executeFieldsSerially($type, $rootValue, $path, $fields) : |
|
336 | - $this->executeFields($type, $rootValue, $path, $fields); |
|
335 | + $this->executeFieldsSerially($type, $rootValue, $path, $fields) : $this->executeFields($type, $rootValue, $path, $fields); |
|
337 | 336 | |
338 | 337 | if ($this->isPromise($result)) { |
339 | 338 | return $result->then( |
340 | 339 | null, |
341 | - function ($error) { |
|
340 | + function($error) { |
|
342 | 341 | $this->exeContext->addError($error); |
343 | 342 | return $this->exeContext->promises->createFulfilled(null); |
344 | 343 | } |
@@ -363,7 +362,7 @@ discard block |
||
363 | 362 | switch ($operation->operation) { |
364 | 363 | case 'query': |
365 | 364 | $queryType = $schema->getQueryType(); |
366 | - if (! $queryType) { |
|
365 | + if (!$queryType) { |
|
367 | 366 | throw new Error( |
368 | 367 | 'Schema does not define the required query root type.', |
369 | 368 | [$operation] |
@@ -373,7 +372,7 @@ discard block |
||
373 | 372 | return $queryType; |
374 | 373 | case 'mutation': |
375 | 374 | $mutationType = $schema->getMutationType(); |
376 | - if (! $mutationType) { |
|
375 | + if (!$mutationType) { |
|
377 | 376 | throw new Error( |
378 | 377 | 'Schema is not configured for mutations.', |
379 | 378 | [$operation] |
@@ -383,7 +382,7 @@ discard block |
||
383 | 382 | return $mutationType; |
384 | 383 | case 'subscription': |
385 | 384 | $subscriptionType = $schema->getSubscriptionType(); |
386 | - if (! $subscriptionType) { |
|
385 | + if (!$subscriptionType) { |
|
387 | 386 | throw new Error( |
388 | 387 | 'Schema is not configured for subscriptions.', |
389 | 388 | [$operation] |
@@ -422,18 +421,18 @@ discard block |
||
422 | 421 | foreach ($selectionSet->selections as $selection) { |
423 | 422 | switch ($selection->kind) { |
424 | 423 | case NodeKind::FIELD: |
425 | - if (! $this->shouldIncludeNode($selection)) { |
|
424 | + if (!$this->shouldIncludeNode($selection)) { |
|
426 | 425 | break; |
427 | 426 | } |
428 | 427 | $name = self::getFieldEntryKey($selection); |
429 | - if (! isset($fields[$name])) { |
|
428 | + if (!isset($fields[$name])) { |
|
430 | 429 | $fields[$name] = new \ArrayObject(); |
431 | 430 | } |
432 | 431 | $fields[$name][] = $selection; |
433 | 432 | break; |
434 | 433 | case NodeKind::INLINE_FRAGMENT: |
435 | - if (! $this->shouldIncludeNode($selection) || |
|
436 | - ! $this->doesFragmentConditionMatch($selection, $runtimeType) |
|
434 | + if (!$this->shouldIncludeNode($selection) || |
|
435 | + !$this->doesFragmentConditionMatch($selection, $runtimeType) |
|
437 | 436 | ) { |
438 | 437 | break; |
439 | 438 | } |
@@ -446,14 +445,14 @@ discard block |
||
446 | 445 | break; |
447 | 446 | case NodeKind::FRAGMENT_SPREAD: |
448 | 447 | $fragName = $selection->name->value; |
449 | - if (! empty($visitedFragmentNames[$fragName]) || ! $this->shouldIncludeNode($selection)) { |
|
448 | + if (!empty($visitedFragmentNames[$fragName]) || !$this->shouldIncludeNode($selection)) { |
|
450 | 449 | break; |
451 | 450 | } |
452 | 451 | $visitedFragmentNames[$fragName] = true; |
453 | 452 | |
454 | 453 | /** @var FragmentDefinitionNode|null $fragment */ |
455 | 454 | $fragment = $exeContext->fragments[$fragName] ?? null; |
456 | - if (! $fragment || ! $this->doesFragmentConditionMatch($fragment, $runtimeType)) { |
|
455 | + if (!$fragment || !$this->doesFragmentConditionMatch($fragment, $runtimeType)) { |
|
457 | 456 | break; |
458 | 457 | } |
459 | 458 | $this->collectFields( |
@@ -556,7 +555,7 @@ discard block |
||
556 | 555 | { |
557 | 556 | $result = $this->promiseReduce( |
558 | 557 | array_keys($fields->getArrayCopy()), |
559 | - function ($results, $responseName) use ($path, $parentType, $sourceValue, $fields) { |
|
558 | + function($results, $responseName) use ($path, $parentType, $sourceValue, $fields) { |
|
560 | 559 | $fieldNodes = $fields[$responseName]; |
561 | 560 | $fieldPath = $path; |
562 | 561 | $fieldPath[] = $responseName; |
@@ -566,7 +565,7 @@ discard block |
||
566 | 565 | } |
567 | 566 | $promise = $this->getPromise($result); |
568 | 567 | if ($promise) { |
569 | - return $promise->then(function ($resolvedResult) use ($responseName, $results) { |
|
568 | + return $promise->then(function($resolvedResult) use ($responseName, $results) { |
|
570 | 569 | $results[$responseName] = $resolvedResult; |
571 | 570 | return $results; |
572 | 571 | }); |
@@ -577,7 +576,7 @@ discard block |
||
577 | 576 | [] |
578 | 577 | ); |
579 | 578 | if ($this->isPromise($result)) { |
580 | - return $result->then(function ($resolvedResults) { |
|
579 | + return $result->then(function($resolvedResults) { |
|
581 | 580 | return self::fixResultsIfEmptyArray($resolvedResults); |
582 | 581 | }); |
583 | 582 | } |
@@ -604,7 +603,7 @@ discard block |
||
604 | 603 | $fieldName = $fieldNode->name->value; |
605 | 604 | $fieldDef = $this->getFieldDef($exeContext->schema, $parentType, $fieldName); |
606 | 605 | |
607 | - if (! $fieldDef) { |
|
606 | + if (!$fieldDef) { |
|
608 | 607 | return self::$UNDEFINED; |
609 | 608 | } |
610 | 609 | |
@@ -770,7 +769,7 @@ discard block |
||
770 | 769 | if ($promise) { |
771 | 770 | return $promise->then( |
772 | 771 | null, |
773 | - function ($error) use ($exeContext) { |
|
772 | + function($error) use ($exeContext) { |
|
774 | 773 | $exeContext->addError($error); |
775 | 774 | |
776 | 775 | return $this->exeContext->promises->createFulfilled(null); |
@@ -813,11 +812,11 @@ discard block |
||
813 | 812 | $path, |
814 | 813 | $result |
815 | 814 | ); |
816 | - $promise = $this->getPromise($completed); |
|
815 | + $promise = $this->getPromise($completed); |
|
817 | 816 | if ($promise) { |
818 | 817 | return $promise->then( |
819 | 818 | null, |
820 | - function ($error) use ($fieldNodes, $path) { |
|
819 | + function($error) use ($fieldNodes, $path) { |
|
821 | 820 | return $this->exeContext->promises->createRejected(Error::createLocatedError( |
822 | 821 | $error, |
823 | 822 | $fieldNodes, |
@@ -874,7 +873,7 @@ discard block |
||
874 | 873 | |
875 | 874 | // If result is a Promise, apply-lift over completeValue. |
876 | 875 | if ($promise) { |
877 | - return $promise->then(function (&$resolved) use ($returnType, $fieldNodes, $info, $path) { |
|
876 | + return $promise->then(function(&$resolved) use ($returnType, $fieldNodes, $info, $path) { |
|
878 | 877 | return $this->completeValue($returnType, $fieldNodes, $info, $path, $resolved); |
879 | 878 | }); |
880 | 879 | } |
@@ -974,7 +973,7 @@ discard block |
||
974 | 973 | } |
975 | 974 | if ($this->exeContext->promises->isThenable($value)) { |
976 | 975 | $promise = $this->exeContext->promises->convertThenable($value); |
977 | - if (! $promise instanceof Promise) { |
|
976 | + if (!$promise instanceof Promise) { |
|
978 | 977 | throw new InvariantViolation(sprintf( |
979 | 978 | '%s::convertThenable is expected to return instance of GraphQL\Executor\Promise\Promise, got: %s', |
980 | 979 | get_class($this->exeContext->promises), |
@@ -1002,10 +1001,10 @@ discard block |
||
1002 | 1001 | */ |
1003 | 1002 | private function promiseReduce(array $values, \Closure $callback, $initialValue) |
1004 | 1003 | { |
1005 | - return array_reduce($values, function ($previous, $value) use ($callback) { |
|
1004 | + return array_reduce($values, function($previous, $value) use ($callback) { |
|
1006 | 1005 | $promise = $this->getPromise($previous); |
1007 | 1006 | if ($promise) { |
1008 | - return $promise->then(function ($resolved) use ($callback, $value) { |
|
1007 | + return $promise->then(function($resolved) use ($callback, $value) { |
|
1009 | 1008 | return $callback($resolved, $value); |
1010 | 1009 | }); |
1011 | 1010 | } |
@@ -1038,7 +1037,7 @@ discard block |
||
1038 | 1037 | $fieldPath = $path; |
1039 | 1038 | $fieldPath[] = $i++; |
1040 | 1039 | $completedItem = $this->completeValueCatchingError($itemType, $fieldNodes, $info, $fieldPath, $item); |
1041 | - if (! $containsPromise && $this->getPromise($completedItem)) { |
|
1040 | + if (!$containsPromise && $this->getPromise($completedItem)) { |
|
1042 | 1041 | $containsPromise = true; |
1043 | 1042 | } |
1044 | 1043 | $completedItems[] = $completedItem; |
@@ -1094,7 +1093,7 @@ discard block |
||
1094 | 1093 | |
1095 | 1094 | $promise = $this->getPromise($runtimeType); |
1096 | 1095 | if ($promise) { |
1097 | - return $promise->then(function ($resolvedRuntimeType) use ( |
|
1096 | + return $promise->then(function($resolvedRuntimeType) use ( |
|
1098 | 1097 | $returnType, |
1099 | 1098 | $fieldNodes, |
1100 | 1099 | $info, |
@@ -1188,9 +1187,9 @@ discard block |
||
1188 | 1187 | } |
1189 | 1188 | } |
1190 | 1189 | |
1191 | - if (! empty($promisedIsTypeOfResults)) { |
|
1190 | + if (!empty($promisedIsTypeOfResults)) { |
|
1192 | 1191 | return $this->exeContext->promises->all($promisedIsTypeOfResults) |
1193 | - ->then(function ($isTypeOfResults) use ($possibleTypes) { |
|
1192 | + ->then(function($isTypeOfResults) use ($possibleTypes) { |
|
1194 | 1193 | foreach ($isTypeOfResults as $index => $result) { |
1195 | 1194 | if ($result) { |
1196 | 1195 | return $possibleTypes[$index]; |
@@ -1223,14 +1222,14 @@ discard block |
||
1223 | 1222 | if ($isTypeOf !== null) { |
1224 | 1223 | $promise = $this->getPromise($isTypeOf); |
1225 | 1224 | if ($promise) { |
1226 | - return $promise->then(function ($isTypeOfResult) use ( |
|
1225 | + return $promise->then(function($isTypeOfResult) use ( |
|
1227 | 1226 | $returnType, |
1228 | 1227 | $fieldNodes, |
1229 | 1228 | $info, |
1230 | 1229 | $path, |
1231 | 1230 | &$result |
1232 | 1231 | ) { |
1233 | - if (! $isTypeOfResult) { |
|
1232 | + if (!$isTypeOfResult) { |
|
1234 | 1233 | throw $this->invalidReturnTypeError($returnType, $result, $fieldNodes); |
1235 | 1234 | } |
1236 | 1235 | |
@@ -1243,7 +1242,7 @@ discard block |
||
1243 | 1242 | ); |
1244 | 1243 | }); |
1245 | 1244 | } |
1246 | - if (! $isTypeOf) { |
|
1245 | + if (!$isTypeOf) { |
|
1247 | 1246 | throw $this->invalidReturnTypeError($returnType, $result, $fieldNodes); |
1248 | 1247 | } |
1249 | 1248 | } |
@@ -1344,14 +1343,14 @@ discard block |
||
1344 | 1343 | if ($result === self::$UNDEFINED) { |
1345 | 1344 | continue; |
1346 | 1345 | } |
1347 | - if (! $containsPromise && $this->getPromise($result)) { |
|
1346 | + if (!$containsPromise && $this->getPromise($result)) { |
|
1348 | 1347 | $containsPromise = true; |
1349 | 1348 | } |
1350 | 1349 | $finalResults[$responseName] = $result; |
1351 | 1350 | } |
1352 | 1351 | |
1353 | 1352 | // If there are no promises, we can just return the object |
1354 | - if (! $containsPromise) { |
|
1353 | + if (!$containsPromise) { |
|
1355 | 1354 | return self::fixResultsIfEmptyArray($finalResults); |
1356 | 1355 | } |
1357 | 1356 | |
@@ -1394,7 +1393,7 @@ discard block |
||
1394 | 1393 | |
1395 | 1394 | $promise = $this->exeContext->promises->all($valuesAndPromises); |
1396 | 1395 | |
1397 | - return $promise->then(function ($values) use ($keys) { |
|
1396 | + return $promise->then(function($values) use ($keys) { |
|
1398 | 1397 | $resolvedResults = []; |
1399 | 1398 | foreach ($values as $i => $value) { |
1400 | 1399 | $resolvedResults[$keys[$i]] = $value; |
@@ -1417,10 +1416,9 @@ discard block |
||
1417 | 1416 | &$result |
1418 | 1417 | ) { |
1419 | 1418 | $runtimeType = is_string($runtimeTypeOrName) ? |
1420 | - $this->exeContext->schema->getType($runtimeTypeOrName) : |
|
1421 | - $runtimeTypeOrName; |
|
1419 | + $this->exeContext->schema->getType($runtimeTypeOrName) : $runtimeTypeOrName; |
|
1422 | 1420 | |
1423 | - if (! $runtimeType instanceof ObjectType) { |
|
1421 | + if (!$runtimeType instanceof ObjectType) { |
|
1424 | 1422 | throw new InvariantViolation( |
1425 | 1423 | sprintf( |
1426 | 1424 | 'Abstract type %s must resolve to an Object type at ' . |
@@ -1437,7 +1435,7 @@ discard block |
||
1437 | 1435 | ); |
1438 | 1436 | } |
1439 | 1437 | |
1440 | - if (! $this->exeContext->schema->isPossibleType($returnType, $runtimeType)) { |
|
1438 | + if (!$this->exeContext->schema->isPossibleType($returnType, $runtimeType)) { |
|
1441 | 1439 | throw new InvariantViolation( |
1442 | 1440 | sprintf('Runtime Object type "%s" is not a possible type for "%s".', $runtimeType, $returnType) |
1443 | 1441 | ); |