@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ); |
63 | 63 | $descriptions = $options; |
64 | 64 | } else { |
65 | - $descriptions = ! array_key_exists('descriptions', $options) || $options['descriptions'] === true; |
|
65 | + $descriptions = !array_key_exists('descriptions', $options) || $options['descriptions'] === true; |
|
66 | 66 | } |
67 | 67 | $descriptionField = $descriptions ? 'description' : ''; |
68 | 68 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | public static function _schema() |
217 | 217 | { |
218 | - if (! isset(self::$map['__Schema'])) { |
|
218 | + if (!isset(self::$map['__Schema'])) { |
|
219 | 219 | self::$map['__Schema'] = new ObjectType([ |
220 | 220 | 'name' => '__Schema', |
221 | 221 | 'isIntrospection' => true, |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | 'types' => [ |
229 | 229 | 'description' => 'A list of all types supported by this server.', |
230 | 230 | 'type' => new NonNull(new ListOfType(new NonNull(self::_type()))), |
231 | - 'resolve' => static function (Schema $schema) { |
|
231 | + 'resolve' => static function(Schema $schema) { |
|
232 | 232 | return array_values($schema->getTypeMap()); |
233 | 233 | }, |
234 | 234 | ], |
235 | 235 | 'queryType' => [ |
236 | 236 | 'description' => 'The type that query operations will be rooted at.', |
237 | 237 | 'type' => new NonNull(self::_type()), |
238 | - 'resolve' => static function (Schema $schema) { |
|
238 | + 'resolve' => static function(Schema $schema) { |
|
239 | 239 | return $schema->getQueryType(); |
240 | 240 | }, |
241 | 241 | ], |
@@ -244,21 +244,21 @@ discard block |
||
244 | 244 | 'If this server supports mutation, the type that ' . |
245 | 245 | 'mutation operations will be rooted at.', |
246 | 246 | 'type' => self::_type(), |
247 | - 'resolve' => static function (Schema $schema) { |
|
247 | + 'resolve' => static function(Schema $schema) { |
|
248 | 248 | return $schema->getMutationType(); |
249 | 249 | }, |
250 | 250 | ], |
251 | 251 | 'subscriptionType' => [ |
252 | 252 | 'description' => 'If this server support subscription, the type that subscription operations will be rooted at.', |
253 | 253 | 'type' => self::_type(), |
254 | - 'resolve' => static function (Schema $schema) { |
|
254 | + 'resolve' => static function(Schema $schema) { |
|
255 | 255 | return $schema->getSubscriptionType(); |
256 | 256 | }, |
257 | 257 | ], |
258 | 258 | 'directives' => [ |
259 | 259 | 'description' => 'A list of all directives supported by this server.', |
260 | 260 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_directive()))), |
261 | - 'resolve' => static function (Schema $schema) { |
|
261 | + 'resolve' => static function(Schema $schema) { |
|
262 | 262 | return $schema->getDirectives(); |
263 | 263 | }, |
264 | 264 | ], |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | |
272 | 272 | public static function _type() |
273 | 273 | { |
274 | - if (! isset(self::$map['__Type'])) { |
|
274 | + if (!isset(self::$map['__Type'])) { |
|
275 | 275 | self::$map['__Type'] = new ObjectType([ |
276 | 276 | 'name' => '__Type', |
277 | 277 | 'isIntrospection' => true, |
@@ -285,11 +285,11 @@ discard block |
||
285 | 285 | 'Object and Interface types provide the fields they describe. Abstract ' . |
286 | 286 | 'types, Union and Interface, provide the Object types possible ' . |
287 | 287 | 'at runtime. List and NonNull types compose other types.', |
288 | - 'fields' => static function () { |
|
288 | + 'fields' => static function() { |
|
289 | 289 | return [ |
290 | 290 | 'kind' => [ |
291 | 291 | 'type' => Type::nonNull(self::_typeKind()), |
292 | - 'resolve' => static function (Type $type) { |
|
292 | + 'resolve' => static function(Type $type) { |
|
293 | 293 | switch (true) { |
294 | 294 | case $type instanceof ListOfType: |
295 | 295 | return TypeKind::LIST; |
@@ -314,13 +314,13 @@ discard block |
||
314 | 314 | ], |
315 | 315 | 'name' => [ |
316 | 316 | 'type' => Type::string(), |
317 | - 'resolve' => static function ($obj) { |
|
317 | + 'resolve' => static function($obj) { |
|
318 | 318 | return $obj->name; |
319 | 319 | }, |
320 | 320 | ], |
321 | 321 | 'description' => [ |
322 | 322 | 'type' => Type::string(), |
323 | - 'resolve' => static function ($obj) { |
|
323 | + 'resolve' => static function($obj) { |
|
324 | 324 | return $obj->description; |
325 | 325 | }, |
326 | 326 | ], |
@@ -329,15 +329,15 @@ discard block |
||
329 | 329 | 'args' => [ |
330 | 330 | 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false], |
331 | 331 | ], |
332 | - 'resolve' => static function (Type $type, $args) { |
|
332 | + 'resolve' => static function(Type $type, $args) { |
|
333 | 333 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
334 | 334 | $fields = $type->getFields(); |
335 | 335 | |
336 | 336 | if (empty($args['includeDeprecated'])) { |
337 | 337 | $fields = array_filter( |
338 | 338 | $fields, |
339 | - static function (FieldDefinition $field) { |
|
340 | - return ! $field->deprecationReason; |
|
339 | + static function(FieldDefinition $field) { |
|
340 | + return !$field->deprecationReason; |
|
341 | 341 | } |
342 | 342 | ); |
343 | 343 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | ], |
351 | 351 | 'interfaces' => [ |
352 | 352 | 'type' => Type::listOf(Type::nonNull(self::_type())), |
353 | - 'resolve' => static function ($type) { |
|
353 | + 'resolve' => static function($type) { |
|
354 | 354 | if ($type instanceof ObjectType) { |
355 | 355 | return $type->getInterfaces(); |
356 | 356 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | ], |
361 | 361 | 'possibleTypes' => [ |
362 | 362 | 'type' => Type::listOf(Type::nonNull(self::_type())), |
363 | - 'resolve' => static function ($type, $args, $context, ResolveInfo $info) { |
|
363 | + 'resolve' => static function($type, $args, $context, ResolveInfo $info) { |
|
364 | 364 | if ($type instanceof InterfaceType || $type instanceof UnionType) { |
365 | 365 | return $info->schema->getPossibleTypes($type); |
366 | 366 | } |
@@ -373,15 +373,15 @@ discard block |
||
373 | 373 | 'args' => [ |
374 | 374 | 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false], |
375 | 375 | ], |
376 | - 'resolve' => static function ($type, $args) { |
|
376 | + 'resolve' => static function($type, $args) { |
|
377 | 377 | if ($type instanceof EnumType) { |
378 | 378 | $values = array_values($type->getValues()); |
379 | 379 | |
380 | 380 | if (empty($args['includeDeprecated'])) { |
381 | 381 | $values = array_filter( |
382 | 382 | $values, |
383 | - static function ($value) { |
|
384 | - return ! $value->deprecationReason; |
|
383 | + static function($value) { |
|
384 | + return !$value->deprecationReason; |
|
385 | 385 | } |
386 | 386 | ); |
387 | 387 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | ], |
395 | 395 | 'inputFields' => [ |
396 | 396 | 'type' => Type::listOf(Type::nonNull(self::_inputValue())), |
397 | - 'resolve' => static function ($type) { |
|
397 | + 'resolve' => static function($type) { |
|
398 | 398 | if ($type instanceof InputObjectType) { |
399 | 399 | return array_values($type->getFields()); |
400 | 400 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | ], |
405 | 405 | 'ofType' => [ |
406 | 406 | 'type' => self::_type(), |
407 | - 'resolve' => static function ($type) { |
|
407 | + 'resolve' => static function($type) { |
|
408 | 408 | if ($type instanceof WrappingType) { |
409 | 409 | return $type->getWrappedType(); |
410 | 410 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | |
423 | 423 | public static function _typeKind() |
424 | 424 | { |
425 | - if (! isset(self::$map['__TypeKind'])) { |
|
425 | + if (!isset(self::$map['__TypeKind'])) { |
|
426 | 426 | self::$map['__TypeKind'] = new EnumType([ |
427 | 427 | 'name' => '__TypeKind', |
428 | 428 | 'isIntrospection' => true, |
@@ -469,48 +469,48 @@ discard block |
||
469 | 469 | |
470 | 470 | public static function _field() |
471 | 471 | { |
472 | - if (! isset(self::$map['__Field'])) { |
|
472 | + if (!isset(self::$map['__Field'])) { |
|
473 | 473 | self::$map['__Field'] = new ObjectType([ |
474 | 474 | 'name' => '__Field', |
475 | 475 | 'isIntrospection' => true, |
476 | 476 | 'description' => |
477 | 477 | 'Object and Interface types are described by a list of Fields, each of ' . |
478 | 478 | 'which has a name, potentially a list of arguments, and a return type.', |
479 | - 'fields' => static function () { |
|
479 | + 'fields' => static function() { |
|
480 | 480 | return [ |
481 | 481 | 'name' => [ |
482 | 482 | 'type' => Type::nonNull(Type::string()), |
483 | - 'resolve' => static function (FieldDefinition $field) { |
|
483 | + 'resolve' => static function(FieldDefinition $field) { |
|
484 | 484 | return $field->name; |
485 | 485 | }, |
486 | 486 | ], |
487 | 487 | 'description' => [ |
488 | 488 | 'type' => Type::string(), |
489 | - 'resolve' => static function (FieldDefinition $field) { |
|
489 | + 'resolve' => static function(FieldDefinition $field) { |
|
490 | 490 | return $field->description; |
491 | 491 | }, |
492 | 492 | ], |
493 | 493 | 'args' => [ |
494 | 494 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))), |
495 | - 'resolve' => static function (FieldDefinition $field) { |
|
495 | + 'resolve' => static function(FieldDefinition $field) { |
|
496 | 496 | return empty($field->args) ? [] : $field->args; |
497 | 497 | }, |
498 | 498 | ], |
499 | 499 | 'type' => [ |
500 | 500 | 'type' => Type::nonNull(self::_type()), |
501 | - 'resolve' => static function (FieldDefinition $field) { |
|
501 | + 'resolve' => static function(FieldDefinition $field) { |
|
502 | 502 | return $field->getType(); |
503 | 503 | }, |
504 | 504 | ], |
505 | 505 | 'isDeprecated' => [ |
506 | 506 | 'type' => Type::nonNull(Type::boolean()), |
507 | - 'resolve' => static function (FieldDefinition $field) { |
|
507 | + 'resolve' => static function(FieldDefinition $field) { |
|
508 | 508 | return (bool) $field->deprecationReason; |
509 | 509 | }, |
510 | 510 | ], |
511 | 511 | 'deprecationReason' => [ |
512 | 512 | 'type' => Type::string(), |
513 | - 'resolve' => static function (FieldDefinition $field) { |
|
513 | + 'resolve' => static function(FieldDefinition $field) { |
|
514 | 514 | return $field->deprecationReason; |
515 | 515 | }, |
516 | 516 | ], |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | |
525 | 525 | public static function _inputValue() |
526 | 526 | { |
527 | - if (! isset(self::$map['__InputValue'])) { |
|
527 | + if (!isset(self::$map['__InputValue'])) { |
|
528 | 528 | self::$map['__InputValue'] = new ObjectType([ |
529 | 529 | 'name' => '__InputValue', |
530 | 530 | 'isIntrospection' => true, |
@@ -532,11 +532,11 @@ discard block |
||
532 | 532 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
533 | 533 | 'InputObject are represented as Input Values which describe their type ' . |
534 | 534 | 'and optionally a default value.', |
535 | - 'fields' => static function () { |
|
535 | + 'fields' => static function() { |
|
536 | 536 | return [ |
537 | 537 | 'name' => [ |
538 | 538 | 'type' => Type::nonNull(Type::string()), |
539 | - 'resolve' => static function ($inputValue) { |
|
539 | + 'resolve' => static function($inputValue) { |
|
540 | 540 | /** @var FieldArgument|InputObjectField $inputValue */ |
541 | 541 | $inputValue = $inputValue; |
542 | 542 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | ], |
546 | 546 | 'description' => [ |
547 | 547 | 'type' => Type::string(), |
548 | - 'resolve' => static function ($inputValue) { |
|
548 | + 'resolve' => static function($inputValue) { |
|
549 | 549 | /** @var FieldArgument|InputObjectField $inputValue */ |
550 | 550 | $inputValue = $inputValue; |
551 | 551 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | ], |
555 | 555 | 'type' => [ |
556 | 556 | 'type' => Type::nonNull(self::_type()), |
557 | - 'resolve' => static function ($value) { |
|
557 | + 'resolve' => static function($value) { |
|
558 | 558 | return method_exists($value, 'getType') |
559 | 559 | ? $value->getType() |
560 | 560 | : $value->type; |
@@ -564,11 +564,11 @@ discard block |
||
564 | 564 | 'type' => Type::string(), |
565 | 565 | 'description' => |
566 | 566 | 'A GraphQL-formatted string representing the default value for this input value.', |
567 | - 'resolve' => static function ($inputValue) { |
|
567 | + 'resolve' => static function($inputValue) { |
|
568 | 568 | /** @var FieldArgument|InputObjectField $inputValue */ |
569 | 569 | $inputValue = $inputValue; |
570 | 570 | |
571 | - return ! $inputValue->defaultValueExists() |
|
571 | + return !$inputValue->defaultValueExists() |
|
572 | 572 | ? null |
573 | 573 | : Printer::doPrint(AST::astFromValue( |
574 | 574 | $inputValue->defaultValue, |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | |
587 | 587 | public static function _enumValue() |
588 | 588 | { |
589 | - if (! isset(self::$map['__EnumValue'])) { |
|
589 | + if (!isset(self::$map['__EnumValue'])) { |
|
590 | 590 | self::$map['__EnumValue'] = new ObjectType([ |
591 | 591 | 'name' => '__EnumValue', |
592 | 592 | 'isIntrospection' => true, |
@@ -597,25 +597,25 @@ discard block |
||
597 | 597 | 'fields' => [ |
598 | 598 | 'name' => [ |
599 | 599 | 'type' => Type::nonNull(Type::string()), |
600 | - 'resolve' => static function ($enumValue) { |
|
600 | + 'resolve' => static function($enumValue) { |
|
601 | 601 | return $enumValue->name; |
602 | 602 | }, |
603 | 603 | ], |
604 | 604 | 'description' => [ |
605 | 605 | 'type' => Type::string(), |
606 | - 'resolve' => static function ($enumValue) { |
|
606 | + 'resolve' => static function($enumValue) { |
|
607 | 607 | return $enumValue->description; |
608 | 608 | }, |
609 | 609 | ], |
610 | 610 | 'isDeprecated' => [ |
611 | 611 | 'type' => Type::nonNull(Type::boolean()), |
612 | - 'resolve' => static function ($enumValue) { |
|
612 | + 'resolve' => static function($enumValue) { |
|
613 | 613 | return (bool) $enumValue->deprecationReason; |
614 | 614 | }, |
615 | 615 | ], |
616 | 616 | 'deprecationReason' => [ |
617 | 617 | 'type' => Type::string(), |
618 | - 'resolve' => static function ($enumValue) { |
|
618 | + 'resolve' => static function($enumValue) { |
|
619 | 619 | return $enumValue->deprecationReason; |
620 | 620 | }, |
621 | 621 | ], |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | public static function _directive() |
630 | 630 | { |
631 | - if (! isset(self::$map['__Directive'])) { |
|
631 | + if (!isset(self::$map['__Directive'])) { |
|
632 | 632 | self::$map['__Directive'] = new ObjectType([ |
633 | 633 | 'name' => '__Directive', |
634 | 634 | 'isIntrospection' => true, |
@@ -641,13 +641,13 @@ discard block |
||
641 | 641 | 'fields' => [ |
642 | 642 | 'name' => [ |
643 | 643 | 'type' => Type::nonNull(Type::string()), |
644 | - 'resolve' => static function ($obj) { |
|
644 | + 'resolve' => static function($obj) { |
|
645 | 645 | return $obj->name; |
646 | 646 | }, |
647 | 647 | ], |
648 | 648 | 'description' => [ |
649 | 649 | 'type' => Type::string(), |
650 | - 'resolve' => static function ($obj) { |
|
650 | + 'resolve' => static function($obj) { |
|
651 | 651 | return $obj->description; |
652 | 652 | }, |
653 | 653 | ], |
@@ -655,13 +655,13 @@ discard block |
||
655 | 655 | 'type' => Type::nonNull(Type::listOf(Type::nonNull( |
656 | 656 | self::_directiveLocation() |
657 | 657 | ))), |
658 | - 'resolve' => static function ($obj) { |
|
658 | + 'resolve' => static function($obj) { |
|
659 | 659 | return $obj->locations; |
660 | 660 | }, |
661 | 661 | ], |
662 | 662 | 'args' => [ |
663 | 663 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))), |
664 | - 'resolve' => static function (Directive $directive) { |
|
664 | + 'resolve' => static function(Directive $directive) { |
|
665 | 665 | return $directive->args ?: []; |
666 | 666 | }, |
667 | 667 | ], |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | |
675 | 675 | public static function _directiveLocation() |
676 | 676 | { |
677 | - if (! isset(self::$map['__DirectiveLocation'])) { |
|
677 | + if (!isset(self::$map['__DirectiveLocation'])) { |
|
678 | 678 | self::$map['__DirectiveLocation'] = new EnumType([ |
679 | 679 | 'name' => '__DirectiveLocation', |
680 | 680 | 'isIntrospection' => true, |
@@ -768,13 +768,13 @@ discard block |
||
768 | 768 | |
769 | 769 | public static function schemaMetaFieldDef() : FieldDefinition |
770 | 770 | { |
771 | - if (! isset(self::$map[self::SCHEMA_FIELD_NAME])) { |
|
771 | + if (!isset(self::$map[self::SCHEMA_FIELD_NAME])) { |
|
772 | 772 | self::$map[self::SCHEMA_FIELD_NAME] = FieldDefinition::create([ |
773 | 773 | 'name' => self::SCHEMA_FIELD_NAME, |
774 | 774 | 'type' => Type::nonNull(self::_schema()), |
775 | 775 | 'description' => 'Access the current type schema of this server.', |
776 | 776 | 'args' => [], |
777 | - 'resolve' => static function ( |
|
777 | + 'resolve' => static function( |
|
778 | 778 | $source, |
779 | 779 | $args, |
780 | 780 | $context, |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | |
791 | 791 | public static function typeMetaFieldDef() : FieldDefinition |
792 | 792 | { |
793 | - if (! isset(self::$map[self::TYPE_FIELD_NAME])) { |
|
793 | + if (!isset(self::$map[self::TYPE_FIELD_NAME])) { |
|
794 | 794 | self::$map[self::TYPE_FIELD_NAME] = FieldDefinition::create([ |
795 | 795 | 'name' => self::TYPE_FIELD_NAME, |
796 | 796 | 'type' => self::_type(), |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | 'args' => [ |
799 | 799 | ['name' => 'name', 'type' => Type::nonNull(Type::string())], |
800 | 800 | ], |
801 | - 'resolve' => static function ($source, $args, $context, ResolveInfo $info) { |
|
801 | + 'resolve' => static function($source, $args, $context, ResolveInfo $info) { |
|
802 | 802 | return $info->schema->getType($args['name']); |
803 | 803 | }, |
804 | 804 | ]); |
@@ -809,13 +809,13 @@ discard block |
||
809 | 809 | |
810 | 810 | public static function typeNameMetaFieldDef() : FieldDefinition |
811 | 811 | { |
812 | - if (! isset(self::$map[self::TYPE_NAME_FIELD_NAME])) { |
|
812 | + if (!isset(self::$map[self::TYPE_NAME_FIELD_NAME])) { |
|
813 | 813 | self::$map[self::TYPE_NAME_FIELD_NAME] = FieldDefinition::create([ |
814 | 814 | 'name' => self::TYPE_NAME_FIELD_NAME, |
815 | 815 | 'type' => Type::nonNull(Type::string()), |
816 | 816 | 'description' => 'The name of the current Object type at runtime.', |
817 | 817 | 'args' => [], |
818 | - 'resolve' => static function ( |
|
818 | + 'resolve' => static function( |
|
819 | 819 | $source, |
820 | 820 | $args, |
821 | 821 | $context, |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | public function buildSchema() : Schema |
88 | 88 | { |
89 | - if (! array_key_exists('__schema', $this->introspection)) { |
|
89 | + if (!array_key_exists('__schema', $this->introspection)) { |
|
90 | 90 | throw new InvariantViolation('Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ' . json_encode($this->introspection) . '.'); |
91 | 91 | } |
92 | 92 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | |
95 | 95 | $this->typeMap = Utils::keyValMap( |
96 | 96 | $schemaIntrospection['types'], |
97 | - static function (array $typeIntrospection) { |
|
97 | + static function(array $typeIntrospection) { |
|
98 | 98 | return $typeIntrospection['name']; |
99 | 99 | }, |
100 | - function (array $typeIntrospection) { |
|
100 | + function(array $typeIntrospection) { |
|
101 | 101 | return $this->buildType($typeIntrospection); |
102 | 102 | } |
103 | 103 | ); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | Introspection::getTypes() |
108 | 108 | ); |
109 | 109 | foreach ($builtInTypes as $name => $type) { |
110 | - if (! isset($this->typeMap[$name])) { |
|
110 | + if (!isset($this->typeMap[$name])) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | if (isset($typeRef['kind'])) { |
157 | 157 | if ($typeRef['kind'] === TypeKind::LIST) { |
158 | - if (! isset($typeRef['ofType'])) { |
|
158 | + if (!isset($typeRef['ofType'])) { |
|
159 | 159 | throw new InvariantViolation('Decorated type deeper than introspection query.'); |
160 | 160 | } |
161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | if ($typeRef['kind'] === TypeKind::NON_NULL) { |
166 | - if (! isset($typeRef['ofType'])) { |
|
166 | + if (!isset($typeRef['ofType'])) { |
|
167 | 167 | throw new InvariantViolation('Decorated type deeper than introspection query.'); |
168 | 168 | } |
169 | 169 | /** @var NullableType $nullableType */ |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | - if (! isset($typeRef['name'])) { |
|
176 | + if (!isset($typeRef['name'])) { |
|
177 | 177 | throw new InvariantViolation('Unknown type reference: ' . json_encode($typeRef) . '.'); |
178 | 178 | } |
179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | private function getNamedType(string $typeName) : NamedType |
187 | 187 | { |
188 | - if (! isset($this->typeMap[$typeName])) { |
|
188 | + if (!isset($this->typeMap[$typeName])) { |
|
189 | 189 | throw new InvariantViolation( |
190 | 190 | "Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema." |
191 | 191 | ); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | return new CustomScalarType([ |
278 | 278 | 'name' => $scalar['name'], |
279 | 279 | 'description' => $scalar['description'], |
280 | - 'serialize' => static function ($value) : string { |
|
280 | + 'serialize' => static function($value) : string { |
|
281 | 281 | return (string) $value; |
282 | 282 | }, |
283 | 283 | ]); |
@@ -288,21 +288,21 @@ discard block |
||
288 | 288 | */ |
289 | 289 | private function buildObjectDef(array $object) : ObjectType |
290 | 290 | { |
291 | - if (! array_key_exists('interfaces', $object)) { |
|
291 | + if (!array_key_exists('interfaces', $object)) { |
|
292 | 292 | throw new InvariantViolation('Introspection result missing interfaces: ' . json_encode($object) . '.'); |
293 | 293 | } |
294 | 294 | |
295 | 295 | return new ObjectType([ |
296 | 296 | 'name' => $object['name'], |
297 | 297 | 'description' => $object['description'], |
298 | - 'interfaces' => function () use ($object) { |
|
298 | + 'interfaces' => function() use ($object) { |
|
299 | 299 | return array_map( |
300 | 300 | [$this, 'getInterfaceType'], |
301 | 301 | // Legacy support for interfaces with null as interfaces field |
302 | 302 | $object['interfaces'] ?? [] |
303 | 303 | ); |
304 | 304 | }, |
305 | - 'fields' => function () use ($object) { |
|
305 | + 'fields' => function() use ($object) { |
|
306 | 306 | return $this->buildFieldDefMap($object); |
307 | 307 | }, |
308 | 308 | ]); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | return new InterfaceType([ |
317 | 317 | 'name' => $interface['name'], |
318 | 318 | 'description' => $interface['description'], |
319 | - 'fields' => function () use ($interface) { |
|
319 | + 'fields' => function() use ($interface) { |
|
320 | 320 | return $this->buildFieldDefMap($interface); |
321 | 321 | }, |
322 | 322 | ]); |
@@ -327,14 +327,14 @@ discard block |
||
327 | 327 | */ |
328 | 328 | private function buildUnionDef(array $union) : UnionType |
329 | 329 | { |
330 | - if (! array_key_exists('possibleTypes', $union)) { |
|
330 | + if (!array_key_exists('possibleTypes', $union)) { |
|
331 | 331 | throw new InvariantViolation('Introspection result missing possibleTypes: ' . json_encode($union) . '.'); |
332 | 332 | } |
333 | 333 | |
334 | 334 | return new UnionType([ |
335 | 335 | 'name' => $union['name'], |
336 | 336 | 'description' => $union['description'], |
337 | - 'types' => function () use ($union) { |
|
337 | + 'types' => function() use ($union) { |
|
338 | 338 | return array_map( |
339 | 339 | [$this, 'getObjectType'], |
340 | 340 | $union['possibleTypes'] |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | private function buildEnumDef(array $enum) : EnumType |
350 | 350 | { |
351 | - if (! array_key_exists('enumValues', $enum)) { |
|
351 | + if (!array_key_exists('enumValues', $enum)) { |
|
352 | 352 | throw new InvariantViolation('Introspection result missing enumValues: ' . json_encode($enum) . '.'); |
353 | 353 | } |
354 | 354 | |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | 'description' => $enum['description'], |
358 | 358 | 'values' => Utils::keyValMap( |
359 | 359 | $enum['enumValues'], |
360 | - static function (array $enumValue) : string { |
|
360 | + static function(array $enumValue) : string { |
|
361 | 361 | return $enumValue['name']; |
362 | 362 | }, |
363 | - static function (array $enumValue) { |
|
363 | + static function(array $enumValue) { |
|
364 | 364 | return [ |
365 | 365 | 'description' => $enumValue['description'], |
366 | 366 | 'deprecationReason' => $enumValue['deprecationReason'], |
@@ -375,14 +375,14 @@ discard block |
||
375 | 375 | */ |
376 | 376 | private function buildInputObjectDef(array $inputObject) : InputObjectType |
377 | 377 | { |
378 | - if (! array_key_exists('inputFields', $inputObject)) { |
|
378 | + if (!array_key_exists('inputFields', $inputObject)) { |
|
379 | 379 | throw new InvariantViolation('Introspection result missing inputFields: ' . json_encode($inputObject) . '.'); |
380 | 380 | } |
381 | 381 | |
382 | 382 | return new InputObjectType([ |
383 | 383 | 'name' => $inputObject['name'], |
384 | 384 | 'description' => $inputObject['description'], |
385 | - 'fields' => function () use ($inputObject) { |
|
385 | + 'fields' => function() use ($inputObject) { |
|
386 | 386 | return $this->buildInputValueDefMap($inputObject['inputFields']); |
387 | 387 | }, |
388 | 388 | ]); |
@@ -393,17 +393,17 @@ discard block |
||
393 | 393 | */ |
394 | 394 | private function buildFieldDefMap(array $typeIntrospection) |
395 | 395 | { |
396 | - if (! array_key_exists('fields', $typeIntrospection)) { |
|
396 | + if (!array_key_exists('fields', $typeIntrospection)) { |
|
397 | 397 | throw new InvariantViolation('Introspection result missing fields: ' . json_encode($typeIntrospection) . '.'); |
398 | 398 | } |
399 | 399 | |
400 | 400 | return Utils::keyValMap( |
401 | 401 | $typeIntrospection['fields'], |
402 | - static function (array $fieldIntrospection) : string { |
|
402 | + static function(array $fieldIntrospection) : string { |
|
403 | 403 | return $fieldIntrospection['name']; |
404 | 404 | }, |
405 | - function (array $fieldIntrospection) { |
|
406 | - if (! array_key_exists('args', $fieldIntrospection)) { |
|
405 | + function(array $fieldIntrospection) { |
|
406 | + if (!array_key_exists('args', $fieldIntrospection)) { |
|
407 | 407 | throw new InvariantViolation('Introspection result missing field args: ' . json_encode($fieldIntrospection) . '.'); |
408 | 408 | } |
409 | 409 | |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | { |
427 | 427 | return Utils::keyValMap( |
428 | 428 | $inputValueIntrospections, |
429 | - static function (array $inputValue) : string { |
|
429 | + static function(array $inputValue) : string { |
|
430 | 430 | return $inputValue['name']; |
431 | 431 | }, |
432 | 432 | [$this, 'buildInputValue'] |
@@ -462,10 +462,10 @@ discard block |
||
462 | 462 | */ |
463 | 463 | public function buildDirective(array $directive) : Directive |
464 | 464 | { |
465 | - if (! array_key_exists('args', $directive)) { |
|
465 | + if (!array_key_exists('args', $directive)) { |
|
466 | 466 | throw new InvariantViolation('Introspection result missing directive args: ' . json_encode($directive) . '.'); |
467 | 467 | } |
468 | - if (! array_key_exists('locations', $directive)) { |
|
468 | + if (!array_key_exists('locations', $directive)) { |
|
469 | 469 | throw new InvariantViolation('Introspection result missing directive locations: ' . json_encode($directive) . '.'); |
470 | 470 | } |
471 | 471 |