@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | public function hasType(string $type) : bool |
81 | 81 | { |
82 | - return count(array_filter($this->getReferencedTypes(), static function (string $referencedType) use ($type) { |
|
82 | + return count(array_filter($this->getReferencedTypes(), static function(string $referencedType) use ($type) { |
|
83 | 83 | return $type === $referencedType; |
84 | 84 | })) > 0; |
85 | 85 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | public function hasField(string $field) : bool |
96 | 96 | { |
97 | - return count(array_filter($this->getReferencedFields(), static function (string $referencedField) use ($field) { |
|
97 | + return count(array_filter($this->getReferencedFields(), static function(string $referencedField) use ($field) { |
|
98 | 98 | return $field === $referencedField; |
99 | 99 | })) > 0; |
100 | 100 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function subFields(string $typename) : array |
106 | 106 | { |
107 | - if (! array_key_exists($typename, $this->types)) { |
|
107 | + if (!array_key_exists($typename, $this->types)) { |
|
108 | 108 | return []; |
109 | 109 | } |
110 | 110 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $implementors = []; |
121 | 121 | /** @var FieldNode $fieldNode */ |
122 | 122 | foreach ($fieldNodes as $fieldNode) { |
123 | - if (! $fieldNode->selectionSet) { |
|
123 | + if (!$fieldNode->selectionSet) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | private function mergeFields(Type $parentType, Type $type, array $fields, array $subfields, array &$implementors) : array |
230 | 230 | { |
231 | - if ($this->groupImplementorFields && $parentType instanceof AbstractType && ! $type instanceof AbstractType) { |
|
231 | + if ($this->groupImplementorFields && $parentType instanceof AbstractType && !$type instanceof AbstractType) { |
|
232 | 232 | $implementors[$type->name] = [ |
233 | 233 | 'type' => $type, |
234 | 234 | 'fields' => $this->arrayMergeDeep( |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | foreach ($array2 as $key => & $value) { |
270 | 270 | if (is_numeric($key)) { |
271 | - if (! in_array($value, $merged, true)) { |
|
271 | + if (!in_array($value, $merged, true)) { |
|
272 | 272 | $merged[] = $value; |
273 | 273 | } |
274 | 274 | } elseif (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) { |
@@ -41,7 +41,7 @@ |
||
41 | 41 | || is_int($value) |
42 | 42 | || (is_object($value) && method_exists($value, '__toString')); |
43 | 43 | |
44 | - if (! $canCast) { |
|
44 | + if (!$canCast) { |
|
45 | 45 | throw new Error('ID cannot represent value: ' . Utils::printSafe($value)); |
46 | 46 | } |
47 | 47 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function __construct(array $config) |
33 | 33 | { |
34 | - if (! isset($config['name'])) { |
|
34 | + if (!isset($config['name'])) { |
|
35 | 35 | $config['name'] = $this->tryInferName(); |
36 | 36 | } |
37 | 37 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | ? call_user_func($fields) |
74 | 74 | : $fields; |
75 | 75 | |
76 | - if (! is_array($fields)) { |
|
76 | + if (!is_array($fields)) { |
|
77 | 77 | throw new InvariantViolation( |
78 | 78 | sprintf('%s fields must be an array or a callable which returns such an array.', $this->name) |
79 | 79 | ); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | parent::assertValid(); |
103 | 103 | |
104 | 104 | Utils::invariant( |
105 | - ! empty($this->getFields()), |
|
105 | + !empty($this->getFields()), |
|
106 | 106 | sprintf( |
107 | 107 | '%s fields must be an associative array with field names as keys or a callable which returns such an array.', |
108 | 108 | $this->name |
@@ -55,7 +55,7 @@ |
||
55 | 55 | */ |
56 | 56 | public function parseLiteral(Node $valueNode, ?array $variables = null) |
57 | 57 | { |
58 | - if (! $valueNode instanceof BooleanValueNode) { |
|
58 | + if (!$valueNode instanceof BooleanValueNode) { |
|
59 | 59 | // Intentionally without message, as all information already in wrapped Exception |
60 | 60 | throw new Exception(); |
61 | 61 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ); |
62 | 62 | $descriptions = $options; |
63 | 63 | } else { |
64 | - $descriptions = ! array_key_exists('descriptions', $options) || $options['descriptions'] === true; |
|
64 | + $descriptions = !array_key_exists('descriptions', $options) || $options['descriptions'] === true; |
|
65 | 65 | } |
66 | 66 | $descriptionField = $descriptions ? 'description' : ''; |
67 | 67 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | public static function _schema() |
188 | 188 | { |
189 | - if (! isset(self::$map['__Schema'])) { |
|
189 | + if (!isset(self::$map['__Schema'])) { |
|
190 | 190 | self::$map['__Schema'] = new ObjectType([ |
191 | 191 | 'name' => '__Schema', |
192 | 192 | 'isIntrospection' => true, |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | 'types' => [ |
200 | 200 | 'description' => 'A list of all types supported by this server.', |
201 | 201 | 'type' => new NonNull(new ListOfType(new NonNull(self::_type()))), |
202 | - 'resolve' => static function (Schema $schema) { |
|
202 | + 'resolve' => static function(Schema $schema) { |
|
203 | 203 | return array_values($schema->getTypeMap()); |
204 | 204 | }, |
205 | 205 | ], |
206 | 206 | 'queryType' => [ |
207 | 207 | 'description' => 'The type that query operations will be rooted at.', |
208 | 208 | 'type' => new NonNull(self::_type()), |
209 | - 'resolve' => static function (Schema $schema) { |
|
209 | + 'resolve' => static function(Schema $schema) { |
|
210 | 210 | return $schema->getQueryType(); |
211 | 211 | }, |
212 | 212 | ], |
@@ -215,21 +215,21 @@ discard block |
||
215 | 215 | 'If this server supports mutation, the type that ' . |
216 | 216 | 'mutation operations will be rooted at.', |
217 | 217 | 'type' => self::_type(), |
218 | - 'resolve' => static function (Schema $schema) { |
|
218 | + 'resolve' => static function(Schema $schema) { |
|
219 | 219 | return $schema->getMutationType(); |
220 | 220 | }, |
221 | 221 | ], |
222 | 222 | 'subscriptionType' => [ |
223 | 223 | 'description' => 'If this server support subscription, the type that subscription operations will be rooted at.', |
224 | 224 | 'type' => self::_type(), |
225 | - 'resolve' => static function (Schema $schema) { |
|
225 | + 'resolve' => static function(Schema $schema) { |
|
226 | 226 | return $schema->getSubscriptionType(); |
227 | 227 | }, |
228 | 228 | ], |
229 | 229 | 'directives' => [ |
230 | 230 | 'description' => 'A list of all directives supported by this server.', |
231 | 231 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_directive()))), |
232 | - 'resolve' => static function (Schema $schema) { |
|
232 | + 'resolve' => static function(Schema $schema) { |
|
233 | 233 | return $schema->getDirectives(); |
234 | 234 | }, |
235 | 235 | ], |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | public static function _type() |
244 | 244 | { |
245 | - if (! isset(self::$map['__Type'])) { |
|
245 | + if (!isset(self::$map['__Type'])) { |
|
246 | 246 | self::$map['__Type'] = new ObjectType([ |
247 | 247 | 'name' => '__Type', |
248 | 248 | 'isIntrospection' => true, |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | 'Object and Interface types provide the fields they describe. Abstract ' . |
257 | 257 | 'types, Union and Interface, provide the Object types possible ' . |
258 | 258 | 'at runtime. List and NonNull types compose other types.', |
259 | - 'fields' => static function () { |
|
259 | + 'fields' => static function() { |
|
260 | 260 | return [ |
261 | 261 | 'kind' => [ |
262 | 262 | 'type' => Type::nonNull(self::_typeKind()), |
263 | - 'resolve' => static function (Type $type) { |
|
263 | + 'resolve' => static function(Type $type) { |
|
264 | 264 | switch (true) { |
265 | 265 | case $type instanceof ListOfType: |
266 | 266 | return TypeKind::LIST_KIND; |
@@ -285,13 +285,13 @@ discard block |
||
285 | 285 | ], |
286 | 286 | 'name' => [ |
287 | 287 | 'type' => Type::string(), |
288 | - 'resolve' => static function ($obj) { |
|
288 | + 'resolve' => static function($obj) { |
|
289 | 289 | return $obj->name; |
290 | 290 | }, |
291 | 291 | ], |
292 | 292 | 'description' => [ |
293 | 293 | 'type' => Type::string(), |
294 | - 'resolve' => static function ($obj) { |
|
294 | + 'resolve' => static function($obj) { |
|
295 | 295 | return $obj->description; |
296 | 296 | }, |
297 | 297 | ], |
@@ -300,15 +300,15 @@ discard block |
||
300 | 300 | 'args' => [ |
301 | 301 | 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false], |
302 | 302 | ], |
303 | - 'resolve' => static function (Type $type, $args) { |
|
303 | + 'resolve' => static function(Type $type, $args) { |
|
304 | 304 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
305 | 305 | $fields = $type->getFields(); |
306 | 306 | |
307 | 307 | if (empty($args['includeDeprecated'])) { |
308 | 308 | $fields = array_filter( |
309 | 309 | $fields, |
310 | - static function (FieldDefinition $field) { |
|
311 | - return ! $field->deprecationReason; |
|
310 | + static function(FieldDefinition $field) { |
|
311 | + return !$field->deprecationReason; |
|
312 | 312 | } |
313 | 313 | ); |
314 | 314 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | ], |
322 | 322 | 'interfaces' => [ |
323 | 323 | 'type' => Type::listOf(Type::nonNull(self::_type())), |
324 | - 'resolve' => static function ($type) { |
|
324 | + 'resolve' => static function($type) { |
|
325 | 325 | if ($type instanceof ObjectType) { |
326 | 326 | return $type->getInterfaces(); |
327 | 327 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | ], |
332 | 332 | 'possibleTypes' => [ |
333 | 333 | 'type' => Type::listOf(Type::nonNull(self::_type())), |
334 | - 'resolve' => static function ($type, $args, $context, ResolveInfo $info) { |
|
334 | + 'resolve' => static function($type, $args, $context, ResolveInfo $info) { |
|
335 | 335 | if ($type instanceof InterfaceType || $type instanceof UnionType) { |
336 | 336 | return $info->schema->getPossibleTypes($type); |
337 | 337 | } |
@@ -344,15 +344,15 @@ discard block |
||
344 | 344 | 'args' => [ |
345 | 345 | 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false], |
346 | 346 | ], |
347 | - 'resolve' => static function ($type, $args) { |
|
347 | + 'resolve' => static function($type, $args) { |
|
348 | 348 | if ($type instanceof EnumType) { |
349 | 349 | $values = array_values($type->getValues()); |
350 | 350 | |
351 | 351 | if (empty($args['includeDeprecated'])) { |
352 | 352 | $values = array_filter( |
353 | 353 | $values, |
354 | - static function ($value) { |
|
355 | - return ! $value->deprecationReason; |
|
354 | + static function($value) { |
|
355 | + return !$value->deprecationReason; |
|
356 | 356 | } |
357 | 357 | ); |
358 | 358 | } |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | ], |
366 | 366 | 'inputFields' => [ |
367 | 367 | 'type' => Type::listOf(Type::nonNull(self::_inputValue())), |
368 | - 'resolve' => static function ($type) { |
|
368 | + 'resolve' => static function($type) { |
|
369 | 369 | if ($type instanceof InputObjectType) { |
370 | 370 | return array_values($type->getFields()); |
371 | 371 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | ], |
376 | 376 | 'ofType' => [ |
377 | 377 | 'type' => self::_type(), |
378 | - 'resolve' => static function ($type) { |
|
378 | + 'resolve' => static function($type) { |
|
379 | 379 | if ($type instanceof WrappingType) { |
380 | 380 | return $type->getWrappedType(); |
381 | 381 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | |
394 | 394 | public static function _typeKind() |
395 | 395 | { |
396 | - if (! isset(self::$map['__TypeKind'])) { |
|
396 | + if (!isset(self::$map['__TypeKind'])) { |
|
397 | 397 | self::$map['__TypeKind'] = new EnumType([ |
398 | 398 | 'name' => '__TypeKind', |
399 | 399 | 'isIntrospection' => true, |
@@ -440,48 +440,48 @@ discard block |
||
440 | 440 | |
441 | 441 | public static function _field() |
442 | 442 | { |
443 | - if (! isset(self::$map['__Field'])) { |
|
443 | + if (!isset(self::$map['__Field'])) { |
|
444 | 444 | self::$map['__Field'] = new ObjectType([ |
445 | 445 | 'name' => '__Field', |
446 | 446 | 'isIntrospection' => true, |
447 | 447 | 'description' => |
448 | 448 | 'Object and Interface types are described by a list of Fields, each of ' . |
449 | 449 | 'which has a name, potentially a list of arguments, and a return type.', |
450 | - 'fields' => static function () { |
|
450 | + 'fields' => static function() { |
|
451 | 451 | return [ |
452 | 452 | 'name' => [ |
453 | 453 | 'type' => Type::nonNull(Type::string()), |
454 | - 'resolve' => static function (FieldDefinition $field) { |
|
454 | + 'resolve' => static function(FieldDefinition $field) { |
|
455 | 455 | return $field->name; |
456 | 456 | }, |
457 | 457 | ], |
458 | 458 | 'description' => [ |
459 | 459 | 'type' => Type::string(), |
460 | - 'resolve' => static function (FieldDefinition $field) { |
|
460 | + 'resolve' => static function(FieldDefinition $field) { |
|
461 | 461 | return $field->description; |
462 | 462 | }, |
463 | 463 | ], |
464 | 464 | 'args' => [ |
465 | 465 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))), |
466 | - 'resolve' => static function (FieldDefinition $field) { |
|
466 | + 'resolve' => static function(FieldDefinition $field) { |
|
467 | 467 | return empty($field->args) ? [] : $field->args; |
468 | 468 | }, |
469 | 469 | ], |
470 | 470 | 'type' => [ |
471 | 471 | 'type' => Type::nonNull(self::_type()), |
472 | - 'resolve' => static function (FieldDefinition $field) { |
|
472 | + 'resolve' => static function(FieldDefinition $field) { |
|
473 | 473 | return $field->getType(); |
474 | 474 | }, |
475 | 475 | ], |
476 | 476 | 'isDeprecated' => [ |
477 | 477 | 'type' => Type::nonNull(Type::boolean()), |
478 | - 'resolve' => static function (FieldDefinition $field) { |
|
478 | + 'resolve' => static function(FieldDefinition $field) { |
|
479 | 479 | return (bool) $field->deprecationReason; |
480 | 480 | }, |
481 | 481 | ], |
482 | 482 | 'deprecationReason' => [ |
483 | 483 | 'type' => Type::string(), |
484 | - 'resolve' => static function (FieldDefinition $field) { |
|
484 | + 'resolve' => static function(FieldDefinition $field) { |
|
485 | 485 | return $field->deprecationReason; |
486 | 486 | }, |
487 | 487 | ], |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | |
496 | 496 | public static function _inputValue() |
497 | 497 | { |
498 | - if (! isset(self::$map['__InputValue'])) { |
|
498 | + if (!isset(self::$map['__InputValue'])) { |
|
499 | 499 | self::$map['__InputValue'] = new ObjectType([ |
500 | 500 | 'name' => '__InputValue', |
501 | 501 | 'isIntrospection' => true, |
@@ -503,11 +503,11 @@ discard block |
||
503 | 503 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
504 | 504 | 'InputObject are represented as Input Values which describe their type ' . |
505 | 505 | 'and optionally a default value.', |
506 | - 'fields' => static function () { |
|
506 | + 'fields' => static function() { |
|
507 | 507 | return [ |
508 | 508 | 'name' => [ |
509 | 509 | 'type' => Type::nonNull(Type::string()), |
510 | - 'resolve' => static function ($inputValue) { |
|
510 | + 'resolve' => static function($inputValue) { |
|
511 | 511 | /** @var FieldArgument|InputObjectField $inputValue */ |
512 | 512 | $inputValue = $inputValue; |
513 | 513 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | ], |
517 | 517 | 'description' => [ |
518 | 518 | 'type' => Type::string(), |
519 | - 'resolve' => static function ($inputValue) { |
|
519 | + 'resolve' => static function($inputValue) { |
|
520 | 520 | /** @var FieldArgument|InputObjectField $inputValue */ |
521 | 521 | $inputValue = $inputValue; |
522 | 522 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | ], |
526 | 526 | 'type' => [ |
527 | 527 | 'type' => Type::nonNull(self::_type()), |
528 | - 'resolve' => static function ($value) { |
|
528 | + 'resolve' => static function($value) { |
|
529 | 529 | return method_exists($value, 'getType') |
530 | 530 | ? $value->getType() |
531 | 531 | : $value->type; |
@@ -535,11 +535,11 @@ discard block |
||
535 | 535 | 'type' => Type::string(), |
536 | 536 | 'description' => |
537 | 537 | 'A GraphQL-formatted string representing the default value for this input value.', |
538 | - 'resolve' => static function ($inputValue) { |
|
538 | + 'resolve' => static function($inputValue) { |
|
539 | 539 | /** @var FieldArgument|InputObjectField $inputValue */ |
540 | 540 | $inputValue = $inputValue; |
541 | 541 | |
542 | - return ! $inputValue->defaultValueExists() |
|
542 | + return !$inputValue->defaultValueExists() |
|
543 | 543 | ? null |
544 | 544 | : Printer::doPrint(AST::astFromValue( |
545 | 545 | $inputValue->defaultValue, |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | public static function _enumValue() |
559 | 559 | { |
560 | - if (! isset(self::$map['__EnumValue'])) { |
|
560 | + if (!isset(self::$map['__EnumValue'])) { |
|
561 | 561 | self::$map['__EnumValue'] = new ObjectType([ |
562 | 562 | 'name' => '__EnumValue', |
563 | 563 | 'isIntrospection' => true, |
@@ -568,25 +568,25 @@ discard block |
||
568 | 568 | 'fields' => [ |
569 | 569 | 'name' => [ |
570 | 570 | 'type' => Type::nonNull(Type::string()), |
571 | - 'resolve' => static function ($enumValue) { |
|
571 | + 'resolve' => static function($enumValue) { |
|
572 | 572 | return $enumValue->name; |
573 | 573 | }, |
574 | 574 | ], |
575 | 575 | 'description' => [ |
576 | 576 | 'type' => Type::string(), |
577 | - 'resolve' => static function ($enumValue) { |
|
577 | + 'resolve' => static function($enumValue) { |
|
578 | 578 | return $enumValue->description; |
579 | 579 | }, |
580 | 580 | ], |
581 | 581 | 'isDeprecated' => [ |
582 | 582 | 'type' => Type::nonNull(Type::boolean()), |
583 | - 'resolve' => static function ($enumValue) { |
|
583 | + 'resolve' => static function($enumValue) { |
|
584 | 584 | return (bool) $enumValue->deprecationReason; |
585 | 585 | }, |
586 | 586 | ], |
587 | 587 | 'deprecationReason' => [ |
588 | 588 | 'type' => Type::string(), |
589 | - 'resolve' => static function ($enumValue) { |
|
589 | + 'resolve' => static function($enumValue) { |
|
590 | 590 | return $enumValue->deprecationReason; |
591 | 591 | }, |
592 | 592 | ], |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | |
600 | 600 | public static function _directive() |
601 | 601 | { |
602 | - if (! isset(self::$map['__Directive'])) { |
|
602 | + if (!isset(self::$map['__Directive'])) { |
|
603 | 603 | self::$map['__Directive'] = new ObjectType([ |
604 | 604 | 'name' => '__Directive', |
605 | 605 | 'isIntrospection' => true, |
@@ -612,13 +612,13 @@ discard block |
||
612 | 612 | 'fields' => [ |
613 | 613 | 'name' => [ |
614 | 614 | 'type' => Type::nonNull(Type::string()), |
615 | - 'resolve' => static function ($obj) { |
|
615 | + 'resolve' => static function($obj) { |
|
616 | 616 | return $obj->name; |
617 | 617 | }, |
618 | 618 | ], |
619 | 619 | 'description' => [ |
620 | 620 | 'type' => Type::string(), |
621 | - 'resolve' => static function ($obj) { |
|
621 | + 'resolve' => static function($obj) { |
|
622 | 622 | return $obj->description; |
623 | 623 | }, |
624 | 624 | ], |
@@ -626,13 +626,13 @@ discard block |
||
626 | 626 | 'type' => Type::nonNull(Type::listOf(Type::nonNull( |
627 | 627 | self::_directiveLocation() |
628 | 628 | ))), |
629 | - 'resolve' => static function ($obj) { |
|
629 | + 'resolve' => static function($obj) { |
|
630 | 630 | return $obj->locations; |
631 | 631 | }, |
632 | 632 | ], |
633 | 633 | 'args' => [ |
634 | 634 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))), |
635 | - 'resolve' => static function (Directive $directive) { |
|
635 | + 'resolve' => static function(Directive $directive) { |
|
636 | 636 | return $directive->args ?: []; |
637 | 637 | }, |
638 | 638 | ], |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | |
646 | 646 | public static function _directiveLocation() |
647 | 647 | { |
648 | - if (! isset(self::$map['__DirectiveLocation'])) { |
|
648 | + if (!isset(self::$map['__DirectiveLocation'])) { |
|
649 | 649 | self::$map['__DirectiveLocation'] = new EnumType([ |
650 | 650 | 'name' => '__DirectiveLocation', |
651 | 651 | 'isIntrospection' => true, |
@@ -739,13 +739,13 @@ discard block |
||
739 | 739 | |
740 | 740 | public static function schemaMetaFieldDef() : FieldDefinition |
741 | 741 | { |
742 | - if (! isset(self::$map[self::SCHEMA_FIELD_NAME])) { |
|
742 | + if (!isset(self::$map[self::SCHEMA_FIELD_NAME])) { |
|
743 | 743 | self::$map[self::SCHEMA_FIELD_NAME] = FieldDefinition::create([ |
744 | 744 | 'name' => self::SCHEMA_FIELD_NAME, |
745 | 745 | 'type' => Type::nonNull(self::_schema()), |
746 | 746 | 'description' => 'Access the current type schema of this server.', |
747 | 747 | 'args' => [], |
748 | - 'resolve' => static function ( |
|
748 | + 'resolve' => static function( |
|
749 | 749 | $source, |
750 | 750 | $args, |
751 | 751 | $context, |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | |
762 | 762 | public static function typeMetaFieldDef() : FieldDefinition |
763 | 763 | { |
764 | - if (! isset(self::$map[self::TYPE_FIELD_NAME])) { |
|
764 | + if (!isset(self::$map[self::TYPE_FIELD_NAME])) { |
|
765 | 765 | self::$map[self::TYPE_FIELD_NAME] = FieldDefinition::create([ |
766 | 766 | 'name' => self::TYPE_FIELD_NAME, |
767 | 767 | 'type' => self::_type(), |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | 'args' => [ |
770 | 770 | ['name' => 'name', 'type' => Type::nonNull(Type::string())], |
771 | 771 | ], |
772 | - 'resolve' => static function ($source, $args, $context, ResolveInfo $info) { |
|
772 | + 'resolve' => static function($source, $args, $context, ResolveInfo $info) { |
|
773 | 773 | return $info->schema->getType($args['name']); |
774 | 774 | }, |
775 | 775 | ]); |
@@ -780,13 +780,13 @@ discard block |
||
780 | 780 | |
781 | 781 | public static function typeNameMetaFieldDef() : FieldDefinition |
782 | 782 | { |
783 | - if (! isset(self::$map[self::TYPE_NAME_FIELD_NAME])) { |
|
783 | + if (!isset(self::$map[self::TYPE_NAME_FIELD_NAME])) { |
|
784 | 784 | self::$map[self::TYPE_NAME_FIELD_NAME] = FieldDefinition::create([ |
785 | 785 | 'name' => self::TYPE_NAME_FIELD_NAME, |
786 | 786 | 'type' => Type::nonNull(Type::string()), |
787 | 787 | 'description' => 'The name of the current Object type at runtime.', |
788 | 788 | 'args' => [], |
789 | - 'resolve' => static function ( |
|
789 | + 'resolve' => static function( |
|
790 | 790 | $source, |
791 | 791 | $args, |
792 | 792 | $context, |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | public function validateRootTypes() |
75 | 75 | { |
76 | 76 | $queryType = $this->schema->getQueryType(); |
77 | - if (! $queryType) { |
|
77 | + if (!$queryType) { |
|
78 | 78 | $this->reportError( |
79 | 79 | 'Query root type must be provided.', |
80 | 80 | $this->schema->getAstNode() |
81 | 81 | ); |
82 | - } elseif (! $queryType instanceof ObjectType) { |
|
82 | + } elseif (!$queryType instanceof ObjectType) { |
|
83 | 83 | $this->reportError( |
84 | 84 | 'Query root type must be Object type, it cannot be ' . Utils::printSafe($queryType) . '.', |
85 | 85 | $this->getOperationTypeNode($queryType, 'query') |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | $mutationType = $this->schema->getMutationType(); |
90 | - if ($mutationType && ! $mutationType instanceof ObjectType) { |
|
90 | + if ($mutationType && !$mutationType instanceof ObjectType) { |
|
91 | 91 | $this->reportError( |
92 | 92 | 'Mutation root type must be Object type if provided, it cannot be ' . Utils::printSafe($mutationType) . '.', |
93 | 93 | $this->getOperationTypeNode($mutationType, 'mutation') |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | $subscriptionType = $this->schema->getSubscriptionType(); |
98 | - if (! $subscriptionType || $subscriptionType instanceof ObjectType) { |
|
98 | + if (!$subscriptionType || $subscriptionType instanceof ObjectType) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $directives = $this->schema->getDirectives(); |
167 | 167 | foreach ($directives as $directive) { |
168 | 168 | // Ensure all directives are in fact GraphQL directives. |
169 | - if (! $directive instanceof Directive) { |
|
169 | + if (!$directive instanceof Directive) { |
|
170 | 170 | $this->reportError( |
171 | 171 | 'Expected directive but got: ' . Utils::printSafe($directive) . '.', |
172 | 172 | is_object($directive) ? $directive->astNode : null |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | |
223 | 223 | $nodes = Utils::map( |
224 | 224 | $directiveList, |
225 | - static function (Directive $directive) { |
|
225 | + static function(Directive $directive) { |
|
226 | 226 | return $directive->astNode; |
227 | 227 | } |
228 | 228 | ); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | // Ensure names are valid, however introspection types opt out. |
242 | 242 | $error = Utils::isValidNameError($node->name, $node->astNode); |
243 | - if (! $error || Introspection::isIntrospectionType($node)) { |
|
243 | + if (!$error || Introspection::isIntrospectionType($node)) { |
|
244 | 244 | return; |
245 | 245 | } |
246 | 246 | |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | { |
257 | 257 | $subNodes = $this->getAllSubNodes( |
258 | 258 | $directive, |
259 | - static function ($directiveNode) { |
|
259 | + static function($directiveNode) { |
|
260 | 260 | return $directiveNode->arguments; |
261 | 261 | } |
262 | 262 | ); |
263 | 263 | |
264 | 264 | return Utils::filter( |
265 | 265 | $subNodes, |
266 | - static function ($argNode) use ($argName) { |
|
266 | + static function($argNode) use ($argName) { |
|
267 | 267 | return $argNode->name->value === $argName; |
268 | 268 | } |
269 | 269 | ); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $typeMap = $this->schema->getTypeMap(); |
287 | 287 | foreach ($typeMap as $typeName => $type) { |
288 | 288 | // Ensure all provided types are in fact GraphQL type. |
289 | - if (! $type instanceof NamedType) { |
|
289 | + if (!$type instanceof NamedType) { |
|
290 | 290 | $this->reportError( |
291 | 291 | 'Expected GraphQL named type but got: ' . Utils::printSafe($type) . '.', |
292 | 292 | $type instanceof Type ? $type->astNode : null |
@@ -378,11 +378,11 @@ discard block |
||
378 | 378 | } |
379 | 379 | $includes = Utils::some( |
380 | 380 | $schemaDirective->locations, |
381 | - static function ($schemaLocation) use ($location) { |
|
381 | + static function($schemaLocation) use ($location) { |
|
382 | 382 | return $schemaLocation === $location; |
383 | 383 | } |
384 | 384 | ); |
385 | - if (! $includes) { |
|
385 | + if (!$includes) { |
|
386 | 386 | $errorNodes = $schemaDirective->astNode |
387 | 387 | ? [$directive, $schemaDirective->astNode] |
388 | 388 | : [$directive]; |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $fieldMap = $type->getFields(); |
417 | 417 | |
418 | 418 | // Objects and Interfaces both must define one or more fields. |
419 | - if (! $fieldMap) { |
|
419 | + if (!$fieldMap) { |
|
420 | 420 | $this->reportError( |
421 | 421 | sprintf('Type %s must define one or more fields.', $type->name), |
422 | 422 | $this->getAllNodes($type) |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | // Ensure the type is an output type |
441 | - if (! Type::isOutputType($field->getType())) { |
|
441 | + if (!Type::isOutputType($field->getType())) { |
|
442 | 442 | $this->reportError( |
443 | 443 | sprintf( |
444 | 444 | 'The type of %s.%s must be Output Type but got: %s.', |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $argNames[$argName] = true; |
473 | 473 | |
474 | 474 | // Ensure the type is an input type |
475 | - if (! Type::isInputType($arg->getType())) { |
|
475 | + if (!Type::isInputType($arg->getType())) { |
|
476 | 476 | $this->reportError( |
477 | 477 | sprintf( |
478 | 478 | 'The type of %s.%s(%s:) must be Input Type but got: %s.', |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | } |
487 | 487 | |
488 | 488 | // Ensure argument definition directives are valid |
489 | - if (! isset($arg->astNode, $arg->astNode->directives)) { |
|
489 | + if (!isset($arg->astNode, $arg->astNode->directives)) { |
|
490 | 490 | continue; |
491 | 491 | } |
492 | 492 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | } |
498 | 498 | |
499 | 499 | // Ensure any directives are valid |
500 | - if (! isset($field->astNode, $field->astNode->directives)) { |
|
500 | + if (!isset($field->astNode, $field->astNode->directives)) { |
|
501 | 501 | continue; |
502 | 502 | } |
503 | 503 | |
@@ -539,12 +539,12 @@ discard block |
||
539 | 539 | { |
540 | 540 | $result = new NodeList([]); |
541 | 541 | foreach ($this->getAllNodes($obj) as $astNode) { |
542 | - if (! $astNode) { |
|
542 | + if (!$astNode) { |
|
543 | 543 | continue; |
544 | 544 | } |
545 | 545 | |
546 | 546 | $subNodes = $getter($astNode); |
547 | - if (! $subNodes) { |
|
547 | + if (!$subNodes) { |
|
548 | 548 | continue; |
549 | 549 | } |
550 | 550 | |
@@ -562,11 +562,11 @@ discard block |
||
562 | 562 | */ |
563 | 563 | private function getAllFieldNodes($type, $fieldName) |
564 | 564 | { |
565 | - $subNodes = $this->getAllSubNodes($type, static function ($typeNode) { |
|
565 | + $subNodes = $this->getAllSubNodes($type, static function($typeNode) { |
|
566 | 566 | return $typeNode->fields; |
567 | 567 | }); |
568 | 568 | |
569 | - return Utils::filter($subNodes, static function ($fieldNode) use ($fieldName) { |
|
569 | + return Utils::filter($subNodes, static function($fieldNode) use ($fieldName) { |
|
570 | 570 | return $fieldNode->name->value === $fieldName; |
571 | 571 | }); |
572 | 572 | } |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | { |
654 | 654 | $implementedTypeNames = []; |
655 | 655 | foreach ($object->getInterfaces() as $iface) { |
656 | - if (! $iface instanceof InterfaceType) { |
|
656 | + if (!$iface instanceof InterfaceType) { |
|
657 | 657 | $this->reportError( |
658 | 658 | sprintf( |
659 | 659 | 'Type %s must only implement Interface types, it cannot implement %s.', |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | */ |
684 | 684 | private function getDirectives($object) |
685 | 685 | { |
686 | - return $this->getAllSubNodes($object, static function ($node) { |
|
686 | + return $this->getAllSubNodes($object, static function($node) { |
|
687 | 687 | return $node->directives; |
688 | 688 | }); |
689 | 689 | } |
@@ -707,11 +707,11 @@ discard block |
||
707 | 707 | */ |
708 | 708 | private function getAllImplementsInterfaceNodes(ObjectType $type, $iface) |
709 | 709 | { |
710 | - $subNodes = $this->getAllSubNodes($type, static function ($typeNode) { |
|
710 | + $subNodes = $this->getAllSubNodes($type, static function($typeNode) { |
|
711 | 711 | return $typeNode->interfaces; |
712 | 712 | }); |
713 | 713 | |
714 | - return Utils::filter($subNodes, static function ($ifaceNode) use ($iface) { |
|
714 | + return Utils::filter($subNodes, static function($ifaceNode) use ($iface) { |
|
715 | 715 | return $ifaceNode->name->value === $iface->name; |
716 | 716 | }); |
717 | 717 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | : null; |
732 | 732 | |
733 | 733 | // Assert interface field exists on object. |
734 | - if (! $objectField) { |
|
734 | + if (!$objectField) { |
|
735 | 735 | $this->reportError( |
736 | 736 | sprintf( |
737 | 737 | 'Interface field %s.%s expected but %s does not provide it.', |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | |
750 | 750 | // Assert interface field type is satisfied by object field type, by being |
751 | 751 | // a valid subtype. (covariant) |
752 | - if (! TypeComparators::isTypeSubTypeOf( |
|
752 | + if (!TypeComparators::isTypeSubTypeOf( |
|
753 | 753 | $this->schema, |
754 | 754 | $objectField->getType(), |
755 | 755 | $ifaceField->getType() |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | } |
786 | 786 | |
787 | 787 | // Assert interface field arg exists on object field. |
788 | - if (! $objectArg) { |
|
788 | + if (!$objectArg) { |
|
789 | 789 | $this->reportError( |
790 | 790 | sprintf( |
791 | 791 | 'Interface field argument %s.%s(%s:) expected but %s.%s does not provide it.', |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | // Assert interface field arg type matches object field arg type. |
807 | 807 | // (invariant) |
808 | 808 | // TODO: change to contravariant? |
809 | - if (! TypeComparators::isEqualType($ifaceArg->getType(), $objectArg->getType())) { |
|
809 | + if (!TypeComparators::isEqualType($ifaceArg->getType(), $objectArg->getType())) { |
|
810 | 810 | $this->reportError( |
811 | 811 | sprintf( |
812 | 812 | 'Interface field argument %s.%s(%s:) expects type %s but %s.%s(%s:) is type %s.', |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | } |
841 | 841 | } |
842 | 842 | |
843 | - if ($ifaceArg || ! ($objectArg->getType() instanceof NonNull)) { |
|
843 | + if ($ifaceArg || !($objectArg->getType() instanceof NonNull)) { |
|
844 | 844 | continue; |
845 | 845 | } |
846 | 846 | |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | { |
868 | 868 | $memberTypes = $union->getTypes(); |
869 | 869 | |
870 | - if (! $memberTypes) { |
|
870 | + if (!$memberTypes) { |
|
871 | 871 | $this->reportError( |
872 | 872 | sprintf('Union type %s must define one or more member types.', $union->name), |
873 | 873 | $this->getAllNodes($union) |
@@ -907,11 +907,11 @@ discard block |
||
907 | 907 | */ |
908 | 908 | private function getUnionMemberTypeNodes(UnionType $union, $typeName) |
909 | 909 | { |
910 | - $subNodes = $this->getAllSubNodes($union, static function ($unionNode) { |
|
910 | + $subNodes = $this->getAllSubNodes($union, static function($unionNode) { |
|
911 | 911 | return $unionNode->types; |
912 | 912 | }); |
913 | 913 | |
914 | - return Utils::filter($subNodes, static function ($typeNode) use ($typeName) { |
|
914 | + return Utils::filter($subNodes, static function($typeNode) use ($typeName) { |
|
915 | 915 | return $typeNode->name->value === $typeName; |
916 | 916 | }); |
917 | 917 | } |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | { |
921 | 921 | $enumValues = $enumType->getValues(); |
922 | 922 | |
923 | - if (! $enumValues) { |
|
923 | + if (!$enumValues) { |
|
924 | 924 | $this->reportError( |
925 | 925 | sprintf('Enum type %s must define one or more values.', $enumType->name), |
926 | 926 | $this->getAllNodes($enumType) |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | } |
950 | 950 | |
951 | 951 | // Ensure valid directives |
952 | - if (! isset($enumValue->astNode, $enumValue->astNode->directives)) { |
|
952 | + if (!isset($enumValue->astNode, $enumValue->astNode->directives)) { |
|
953 | 953 | continue; |
954 | 954 | } |
955 | 955 | |
@@ -967,11 +967,11 @@ discard block |
||
967 | 967 | */ |
968 | 968 | private function getEnumValueNodes(EnumType $enum, $valueName) |
969 | 969 | { |
970 | - $subNodes = $this->getAllSubNodes($enum, static function ($enumNode) { |
|
970 | + $subNodes = $this->getAllSubNodes($enum, static function($enumNode) { |
|
971 | 971 | return $enumNode->values; |
972 | 972 | }); |
973 | 973 | |
974 | - return Utils::filter($subNodes, static function ($valueNode) use ($valueName) { |
|
974 | + return Utils::filter($subNodes, static function($valueNode) use ($valueName) { |
|
975 | 975 | return $valueNode->name->value === $valueName; |
976 | 976 | }); |
977 | 977 | } |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | { |
981 | 981 | $fieldMap = $inputObj->getFields(); |
982 | 982 | |
983 | - if (! $fieldMap) { |
|
983 | + if (!$fieldMap) { |
|
984 | 984 | $this->reportError( |
985 | 985 | sprintf('Input Object type %s must define one or more fields.', $inputObj->name), |
986 | 986 | $this->getAllNodes($inputObj) |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | // TODO: Ensure they are unique per field. |
996 | 996 | |
997 | 997 | // Ensure the type is an input type |
998 | - if (! Type::isInputType($field->getType())) { |
|
998 | + if (!Type::isInputType($field->getType())) { |
|
999 | 999 | $this->reportError( |
1000 | 1000 | sprintf( |
1001 | 1001 | 'The type of %s.%s must be Input Type but got: %s.', |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | // Ensure valid directives |
1011 | - if (! isset($field->astNode, $field->astNode->directives)) { |
|
1011 | + if (!isset($field->astNode, $field->astNode->directives)) { |
|
1012 | 1012 | continue; |
1013 | 1013 | } |
1014 | 1014 |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | $breakingChanges = []; |
122 | 122 | foreach ($schemaATypeMap as $typeName => $schemaAType) { |
123 | - if (! isset($schemaBTypeMap[$typeName])) { |
|
123 | + if (!isset($schemaBTypeMap[$typeName])) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | $schemaBType = $schemaBTypeMap[$typeName]; |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | $breakingChanges = []; |
191 | 191 | foreach ($oldTypeMap as $typeName => $oldType) { |
192 | 192 | $newType = $newTypeMap[$typeName] ?? null; |
193 | - if (! ($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
194 | - ! ($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
195 | - ! ($newType instanceof $oldType) |
|
193 | + if (!($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
194 | + !($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
195 | + !($newType instanceof $oldType) |
|
196 | 196 | ) { |
197 | 197 | continue; |
198 | 198 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $newTypeFieldsDef = $newType->getFields(); |
202 | 202 | foreach ($oldTypeFieldsDef as $fieldName => $fieldDefinition) { |
203 | 203 | // Check if the field is missing on the type in the new schema. |
204 | - if (! isset($newTypeFieldsDef[$fieldName])) { |
|
204 | + if (!isset($newTypeFieldsDef[$fieldName])) { |
|
205 | 205 | $breakingChanges[] = [ |
206 | 206 | 'type' => self::BREAKING_CHANGE_FIELD_REMOVED, |
207 | 207 | 'description' => "${typeName}.${fieldName} was removed.", |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $oldFieldType, |
214 | 214 | $newFieldType |
215 | 215 | ); |
216 | - if (! $isSafe) { |
|
216 | + if (!$isSafe) { |
|
217 | 217 | $oldFieldTypeString = $oldFieldType instanceof NamedType && $oldFieldType instanceof Type |
218 | 218 | ? $oldFieldType->name |
219 | 219 | : $oldFieldType; |
@@ -283,14 +283,14 @@ discard block |
||
283 | 283 | $dangerousChanges = []; |
284 | 284 | foreach ($oldTypeMap as $typeName => $oldType) { |
285 | 285 | $newType = $newTypeMap[$typeName] ?? null; |
286 | - if (! ($oldType instanceof InputObjectType) || ! ($newType instanceof InputObjectType)) { |
|
286 | + if (!($oldType instanceof InputObjectType) || !($newType instanceof InputObjectType)) { |
|
287 | 287 | continue; |
288 | 288 | } |
289 | 289 | |
290 | 290 | $oldTypeFieldsDef = $oldType->getFields(); |
291 | 291 | $newTypeFieldsDef = $newType->getFields(); |
292 | 292 | foreach (array_keys($oldTypeFieldsDef) as $fieldName) { |
293 | - if (! isset($newTypeFieldsDef[$fieldName])) { |
|
293 | + if (!isset($newTypeFieldsDef[$fieldName])) { |
|
294 | 294 | $breakingChanges[] = [ |
295 | 295 | 'type' => self::BREAKING_CHANGE_FIELD_REMOVED, |
296 | 296 | 'description' => "${typeName}.${fieldName} was removed.", |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $oldFieldType, |
304 | 304 | $newFieldType |
305 | 305 | ); |
306 | - if (! $isSafe) { |
|
306 | + if (!$isSafe) { |
|
307 | 307 | if ($oldFieldType instanceof NamedType) { |
308 | 308 | $oldFieldTypeString = $oldFieldType->name; |
309 | 309 | } else { |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | Type $newType |
357 | 357 | ) { |
358 | 358 | if ($oldType instanceof NamedType) { |
359 | - if (! $newType instanceof NamedType) { |
|
359 | + if (!$newType instanceof NamedType) { |
|
360 | 360 | return false; |
361 | 361 | } |
362 | 362 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | $newType->getWrappedType() |
383 | 383 | )) || |
384 | 384 | // moving from non-null to nullable of the same underlying type is safe |
385 | - ! ($newType instanceof NonNull) && |
|
385 | + !($newType instanceof NonNull) && |
|
386 | 386 | self::isChangeSafeForInputObjectFieldOrFieldArg($oldType->getWrappedType(), $newType); |
387 | 387 | } |
388 | 388 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $typesRemovedFromUnion = []; |
406 | 406 | foreach ($oldTypeMap as $typeName => $oldType) { |
407 | 407 | $newType = $newTypeMap[$typeName] ?? null; |
408 | - if (! ($oldType instanceof UnionType) || ! ($newType instanceof UnionType)) { |
|
408 | + if (!($oldType instanceof UnionType) || !($newType instanceof UnionType)) { |
|
409 | 409 | continue; |
410 | 410 | } |
411 | 411 | $typeNamesInNewUnion = []; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $valuesRemovedFromEnums = []; |
444 | 444 | foreach ($oldTypeMap as $typeName => $oldType) { |
445 | 445 | $newType = $newTypeMap[$typeName] ?? null; |
446 | - if (! ($oldType instanceof EnumType) || ! ($newType instanceof EnumType)) { |
|
446 | + if (!($oldType instanceof EnumType) || !($newType instanceof EnumType)) { |
|
447 | 447 | continue; |
448 | 448 | } |
449 | 449 | $valuesInNewEnum = []; |
@@ -485,9 +485,9 @@ discard block |
||
485 | 485 | |
486 | 486 | foreach ($oldTypeMap as $typeName => $oldType) { |
487 | 487 | $newType = $newTypeMap[$typeName] ?? null; |
488 | - if (! ($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
489 | - ! ($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
490 | - ! ($newType instanceof $oldType) |
|
488 | + if (!($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
489 | + !($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
490 | + !($newType instanceof $oldType) |
|
491 | 491 | ) { |
492 | 492 | continue; |
493 | 493 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | $newTypeFields = $newType->getFields(); |
497 | 497 | |
498 | 498 | foreach ($oldTypeFields as $fieldName => $oldField) { |
499 | - if (! isset($newTypeFields[$fieldName])) { |
|
499 | + if (!isset($newTypeFields[$fieldName])) { |
|
500 | 500 | continue; |
501 | 501 | } |
502 | 502 | |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | $newArgs = $newTypeFields[$fieldName]->args; |
505 | 505 | $newArgDef = Utils::find( |
506 | 506 | $newArgs, |
507 | - static function ($arg) use ($oldArgDef) { |
|
507 | + static function($arg) use ($oldArgDef) { |
|
508 | 508 | return $arg->name === $oldArgDef->name; |
509 | 509 | } |
510 | 510 | ); |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | /** @var ScalarType|EnumType|InputObjectType|ListOfType|NonNull $oldArgType */ |
517 | 517 | $oldArgType = $oldArgDef->getType(); |
518 | 518 | $oldArgName = $oldArgDef->name; |
519 | - if (! $isSafe) { |
|
519 | + if (!$isSafe) { |
|
520 | 520 | $newArgType = $newArgDef->getType(); |
521 | 521 | $breakingChanges[] = [ |
522 | 522 | 'type' => self::BREAKING_CHANGE_ARG_CHANGED_KIND, |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | $oldArgs = $oldTypeFields[$fieldName]->args; |
545 | 545 | $oldArgDef = Utils::find( |
546 | 546 | $oldArgs, |
547 | - static function ($arg) use ($newTypeFieldArgDef) { |
|
547 | + static function($arg) use ($newTypeFieldArgDef) { |
|
548 | 548 | return $arg->name === $newTypeFieldArgDef->name; |
549 | 549 | } |
550 | 550 | ); |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | |
591 | 591 | foreach ($oldTypeMap as $typeName => $oldType) { |
592 | 592 | $newType = $newTypeMap[$typeName] ?? null; |
593 | - if (! ($oldType instanceof ObjectType) || ! ($newType instanceof ObjectType)) { |
|
593 | + if (!($oldType instanceof ObjectType) || !($newType instanceof ObjectType)) { |
|
594 | 594 | continue; |
595 | 595 | } |
596 | 596 | |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | foreach ($oldInterfaces as $oldInterface) { |
600 | 600 | $interface = Utils::find( |
601 | 601 | $newInterfaces, |
602 | - static function (InterfaceType $interface) use ($oldInterface) : bool { |
|
602 | + static function(InterfaceType $interface) use ($oldInterface) : bool { |
|
603 | 603 | return $interface->name === $oldInterface->name; |
604 | 604 | } |
605 | 605 | ); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | { |
644 | 644 | return Utils::keyMap( |
645 | 645 | $schema->getDirectives(), |
646 | - static function ($dir) { |
|
646 | + static function($dir) { |
|
647 | 647 | return $dir->name; |
648 | 648 | } |
649 | 649 | ); |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
656 | 656 | |
657 | 657 | foreach ($newSchema->getDirectives() as $newDirective) { |
658 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
658 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
659 | 659 | continue; |
660 | 660 | } |
661 | 661 | |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | { |
693 | 693 | return Utils::keyMap( |
694 | 694 | $directive->args ?: [], |
695 | - static function ($arg) { |
|
695 | + static function($arg) { |
|
696 | 696 | return $arg->name; |
697 | 697 | } |
698 | 698 | ); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
705 | 705 | |
706 | 706 | foreach ($newSchema->getDirectives() as $newDirective) { |
707 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
707 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
708 | 708 | continue; |
709 | 709 | } |
710 | 710 | |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | $oldSchemaDirectiveMap[$newDirective->name], |
713 | 713 | $newDirective |
714 | 714 | ) as $arg) { |
715 | - if (! $arg->getType() instanceof NonNull) { |
|
715 | + if (!$arg->getType() instanceof NonNull) { |
|
716 | 716 | continue; |
717 | 717 | } |
718 | 718 | $addedNonNullableArgs[] = [ |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
757 | 757 | |
758 | 758 | foreach ($newSchema->getDirectives() as $newDirective) { |
759 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
759 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
760 | 760 | continue; |
761 | 761 | } |
762 | 762 | |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | $valuesAddedToEnums = []; |
823 | 823 | foreach ($oldTypeMap as $typeName => $oldType) { |
824 | 824 | $newType = $newTypeMap[$typeName] ?? null; |
825 | - if (! ($oldType instanceof EnumType) || ! ($newType instanceof EnumType)) { |
|
825 | + if (!($oldType instanceof EnumType) || !($newType instanceof EnumType)) { |
|
826 | 826 | continue; |
827 | 827 | } |
828 | 828 | $valuesInOldEnum = []; |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | |
858 | 858 | foreach ($newTypeMap as $typeName => $newType) { |
859 | 859 | $oldType = $oldTypeMap[$typeName] ?? null; |
860 | - if (! ($oldType instanceof ObjectType) || ! ($newType instanceof ObjectType)) { |
|
860 | + if (!($oldType instanceof ObjectType) || !($newType instanceof ObjectType)) { |
|
861 | 861 | continue; |
862 | 862 | } |
863 | 863 | |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | foreach ($newInterfaces as $newInterface) { |
867 | 867 | $interface = Utils::find( |
868 | 868 | $oldInterfaces, |
869 | - static function (InterfaceType $interface) use ($newInterface) : bool { |
|
869 | + static function(InterfaceType $interface) use ($newInterface) : bool { |
|
870 | 870 | return $interface->name === $newInterface->name; |
871 | 871 | } |
872 | 872 | ); |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | $typesAddedToUnion = []; |
906 | 906 | foreach ($newTypeMap as $typeName => $newType) { |
907 | 907 | $oldType = $oldTypeMap[$typeName] ?? null; |
908 | - if (! ($oldType instanceof UnionType) || ! ($newType instanceof UnionType)) { |
|
908 | + if (!($oldType instanceof UnionType) || !($newType instanceof UnionType)) { |
|
909 | 909 | continue; |
910 | 910 | } |
911 | 911 |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | { |
52 | 52 | return self::printFilteredSchema( |
53 | 53 | $schema, |
54 | - static function ($type) { |
|
55 | - return ! Directive::isSpecifiedDirective($type); |
|
54 | + static function($type) { |
|
55 | + return !Directive::isSpecifiedDirective($type); |
|
56 | 56 | }, |
57 | - static function ($type) { |
|
58 | - return ! Type::isBuiltInType($type); |
|
57 | + static function($type) { |
|
58 | + return !Type::isBuiltInType($type); |
|
59 | 59 | }, |
60 | 60 | $options |
61 | 61 | ); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $directives = array_filter( |
70 | 70 | $schema->getDirectives(), |
71 | - static function ($directive) use ($directiveFilter) { |
|
71 | + static function($directive) use ($directiveFilter) { |
|
72 | 72 | return $directiveFilter($directive); |
73 | 73 | } |
74 | 74 | ); |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | array_merge( |
86 | 86 | [self::printSchemaDefinition($schema)], |
87 | 87 | array_map( |
88 | - static function ($directive) use ($options) { |
|
88 | + static function($directive) use ($options) { |
|
89 | 89 | return self::printDirective($directive, $options); |
90 | 90 | }, |
91 | 91 | $directives |
92 | 92 | ), |
93 | 93 | array_map( |
94 | - static function ($type) use ($options) { |
|
94 | + static function($type) use ($options) { |
|
95 | 95 | return self::printType($type, $options); |
96 | 96 | }, |
97 | 97 | $types |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | $subscriptionType = $schema->getSubscriptionType(); |
156 | 156 | |
157 | - return ! $subscriptionType || $subscriptionType->name === 'Subscription'; |
|
157 | + return !$subscriptionType || $subscriptionType->name === 'Subscription'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | private static function printDirective($directive, $options) : string |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | private static function printDescription($options, $def, $indentation = '', $firstInBlock = true) : string |
168 | 168 | { |
169 | - if (! $def->description) { |
|
169 | + if (!$def->description) { |
|
170 | 170 | return ''; |
171 | 171 | } |
172 | 172 | $lines = self::descriptionLines($def->description, 120 - strlen($indentation)); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | return self::printDescriptionWithComments($lines, $indentation, $firstInBlock); |
175 | 175 | } |
176 | 176 | |
177 | - $description = $indentation && ! $firstInBlock |
|
177 | + $description = $indentation && !$firstInBlock |
|
178 | 178 | ? "\n" . $indentation . '"""' |
179 | 179 | : $indentation . '"""'; |
180 | 180 | |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | substr($lines[0], 0, 1) === ' ' || |
193 | 193 | substr($lines[0], 0, 1) === '\t' |
194 | 194 | ); |
195 | - if (! $hasLeadingSpace) { |
|
195 | + if (!$hasLeadingSpace) { |
|
196 | 196 | $description .= "\n"; |
197 | 197 | } |
198 | 198 | |
199 | 199 | $lineLength = count($lines); |
200 | 200 | for ($i = 0; $i < $lineLength; $i++) { |
201 | - if ($i !== 0 || ! $hasLeadingSpace) { |
|
201 | + if ($i !== 0 || !$hasLeadingSpace) { |
|
202 | 202 | $description .= $indentation; |
203 | 203 | } |
204 | 204 | $description .= self::escapeQuote($lines[$i]) . "\n"; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | private static function printDescriptionWithComments($lines, $indentation, $firstInBlock) : string |
249 | 249 | { |
250 | - $description = $indentation && ! $firstInBlock ? "\n" : ''; |
|
250 | + $description = $indentation && !$firstInBlock ? "\n" : ''; |
|
251 | 251 | foreach ($lines as $line) { |
252 | 252 | if ($line === '') { |
253 | 253 | $description .= $indentation . "#\n"; |
@@ -266,14 +266,14 @@ discard block |
||
266 | 266 | |
267 | 267 | private static function printArgs($options, $args, $indentation = '') : string |
268 | 268 | { |
269 | - if (! $args) { |
|
269 | + if (!$args) { |
|
270 | 270 | return ''; |
271 | 271 | } |
272 | 272 | |
273 | 273 | // If every arg does not have a description, print them on one line. |
274 | 274 | if (Utils::every( |
275 | 275 | $args, |
276 | - static function ($arg) { |
|
276 | + static function($arg) { |
|
277 | 277 | return empty($arg->description); |
278 | 278 | } |
279 | 279 | )) { |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | implode( |
286 | 286 | "\n", |
287 | 287 | array_map( |
288 | - static function ($arg, $i) use ($indentation, $options) { |
|
289 | - return self::printDescription($options, $arg, ' ' . $indentation, ! $i) . ' ' . $indentation . |
|
288 | + static function($arg, $i) use ($indentation, $options) { |
|
289 | + return self::printDescription($options, $arg, ' ' . $indentation, !$i) . ' ' . $indentation . |
|
290 | 290 | self::printInputValue($arg); |
291 | 291 | }, |
292 | 292 | $args, |
@@ -353,11 +353,11 @@ discard block |
||
353 | 353 | private static function printObject(ObjectType $type, array $options) : string |
354 | 354 | { |
355 | 355 | $interfaces = $type->getInterfaces(); |
356 | - $implementedInterfaces = ! empty($interfaces) |
|
356 | + $implementedInterfaces = !empty($interfaces) |
|
357 | 357 | ? ' implements ' . implode( |
358 | 358 | ' & ', |
359 | 359 | array_map( |
360 | - static function ($i) { |
|
360 | + static function($i) { |
|
361 | 361 | return $i->name; |
362 | 362 | }, |
363 | 363 | $interfaces |
@@ -379,8 +379,8 @@ discard block |
||
379 | 379 | return implode( |
380 | 380 | "\n", |
381 | 381 | array_map( |
382 | - static function ($f, $i) use ($options) { |
|
383 | - return self::printDescription($options, $f, ' ', ! $i) . ' ' . |
|
382 | + static function($f, $i) use ($options) { |
|
383 | + return self::printDescription($options, $f, ' ', !$i) . ' ' . |
|
384 | 384 | $f->name . self::printArgs($options, $f->args, ' ') . ': ' . |
385 | 385 | (string) $f->getType() . self::printDeprecated($f); |
386 | 386 | }, |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | return implode( |
440 | 440 | "\n", |
441 | 441 | array_map( |
442 | - static function ($value, $i) use ($options) { |
|
443 | - return self::printDescription($options, $value, ' ', ! $i) . ' ' . |
|
442 | + static function($value, $i) use ($options) { |
|
443 | + return self::printDescription($options, $value, ' ', !$i) . ' ' . |
|
444 | 444 | $value->name . self::printDeprecated($value); |
445 | 445 | }, |
446 | 446 | $values, |
@@ -463,8 +463,8 @@ discard block |
||
463 | 463 | implode( |
464 | 464 | "\n", |
465 | 465 | array_map( |
466 | - static function ($f, $i) use ($options) { |
|
467 | - return self::printDescription($options, $f, ' ', ! $i) . ' ' . self::printInputValue($f); |
|
466 | + static function($f, $i) use ($options) { |
|
467 | + return self::printDescription($options, $f, ' ', !$i) . ' ' . self::printInputValue($f); |
|
468 | 468 | }, |
469 | 469 | $fields, |
470 | 470 | array_keys($fields) |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public static function fromArray(array $node) : Node |
90 | 90 | { |
91 | - if (! isset($node['kind']) || ! isset(NodeKind::$classMap[$node['kind']])) { |
|
91 | + if (!isset($node['kind']) || !isset(NodeKind::$classMap[$node['kind']])) { |
|
92 | 92 | throw new InvariantViolation('Unexpected node structure: ' . Utils::printSafeJson($node)); |
93 | 93 | } |
94 | 94 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $valuesNodes = []; |
177 | 177 | foreach ($value as $item) { |
178 | 178 | $itemNode = self::astFromValue($item, $itemType); |
179 | - if (! $itemNode) { |
|
179 | + if (!$itemNode) { |
|
180 | 180 | continue; |
181 | 181 | } |
182 | 182 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | if ($type instanceof InputObjectType) { |
195 | 195 | $isArray = is_array($value); |
196 | 196 | $isArrayLike = $isArray || $value instanceof ArrayAccess; |
197 | - if ($value === null || (! $isArrayLike && ! is_object($value))) { |
|
197 | + if ($value === null || (!$isArrayLike && !is_object($value))) { |
|
198 | 198 | return null; |
199 | 199 | } |
200 | 200 | $fields = $type->getFields(); |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | $fieldExists = property_exists($value, $fieldName); |
219 | 219 | } |
220 | 220 | |
221 | - if (! $fieldExists) { |
|
221 | + if (!$fieldExists) { |
|
222 | 222 | continue; |
223 | 223 | } |
224 | 224 | |
225 | 225 | $fieldNode = self::astFromValue($fieldValue, $field->getType()); |
226 | 226 | |
227 | - if (! $fieldNode) { |
|
227 | + if (!$fieldNode) { |
|
228 | 228 | continue; |
229 | 229 | } |
230 | 230 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | if ($valueNode instanceof VariableNode) { |
344 | 344 | $variableName = $valueNode->name->value; |
345 | 345 | |
346 | - if (! $variables || ! array_key_exists($variableName, $variables)) { |
|
346 | + if (!$variables || !array_key_exists($variableName, $variables)) { |
|
347 | 347 | // No valid return value. |
348 | 348 | return $undefined; |
349 | 349 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | } |
397 | 397 | |
398 | 398 | if ($type instanceof InputObjectType) { |
399 | - if (! $valueNode instanceof ObjectValueNode) { |
|
399 | + if (!$valueNode instanceof ObjectValueNode) { |
|
400 | 400 | // Invalid: intentionally return no value. |
401 | 401 | return $undefined; |
402 | 402 | } |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $fields = $type->getFields(); |
406 | 406 | $fieldNodes = Utils::keyMap( |
407 | 407 | $valueNode->fields, |
408 | - static function ($field) { |
|
408 | + static function($field) { |
|
409 | 409 | return $field->name->value; |
410 | 410 | } |
411 | 411 | ); |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | } |
442 | 442 | |
443 | 443 | if ($type instanceof EnumType) { |
444 | - if (! $valueNode instanceof EnumValueNode) { |
|
444 | + if (!$valueNode instanceof EnumValueNode) { |
|
445 | 445 | return $undefined; |
446 | 446 | } |
447 | 447 | $enumValue = $type->getValue($valueNode->value); |
448 | - if (! $enumValue) { |
|
448 | + if (!$enumValue) { |
|
449 | 449 | return $undefined; |
450 | 450 | } |
451 | 451 | |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | private static function isMissingVariable(ValueNode $valueNode, $variables) |
479 | 479 | { |
480 | 480 | return $valueNode instanceof VariableNode && |
481 | - (count($variables) === 0 || ! array_key_exists($valueNode->name->value, $variables)); |
|
481 | + (count($variables) === 0 || !array_key_exists($valueNode->name->value, $variables)); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | /** |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | return $valueNode->value; |
522 | 522 | case $valueNode instanceof ListValueNode: |
523 | 523 | return array_map( |
524 | - static function ($node) use ($variables) { |
|
524 | + static function($node) use ($variables) { |
|
525 | 525 | return self::valueFromASTUntyped($node, $variables); |
526 | 526 | }, |
527 | 527 | iterator_to_array($valueNode->values) |
@@ -529,13 +529,13 @@ discard block |
||
529 | 529 | case $valueNode instanceof ObjectValueNode: |
530 | 530 | return array_combine( |
531 | 531 | array_map( |
532 | - static function ($field) { |
|
532 | + static function($field) { |
|
533 | 533 | return $field->name->value; |
534 | 534 | }, |
535 | 535 | iterator_to_array($valueNode->fields) |
536 | 536 | ), |
537 | 537 | array_map( |
538 | - static function ($field) use ($variables) { |
|
538 | + static function($field) use ($variables) { |
|
539 | 539 | return self::valueFromASTUntyped($field->value, $variables); |
540 | 540 | }, |
541 | 541 | iterator_to_array($valueNode->fields) |
@@ -595,11 +595,11 @@ discard block |
||
595 | 595 | { |
596 | 596 | if ($document->definitions) { |
597 | 597 | foreach ($document->definitions as $def) { |
598 | - if (! ($def instanceof OperationDefinitionNode)) { |
|
598 | + if (!($def instanceof OperationDefinitionNode)) { |
|
599 | 599 | continue; |
600 | 600 | } |
601 | 601 | |
602 | - if (! $operationName || (isset($def->name->value) && $def->name->value === $operationName)) { |
|
602 | + if (!$operationName || (isset($def->name->value) && $def->name->value === $operationName)) { |
|
603 | 603 | return $def->operation; |
604 | 604 | } |
605 | 605 | } |