GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Branch src-scrutinizer (86c383)
by Šimon
09:51
created
src/Language/Printer.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
             $ast,
100 100
             [
101 101
                 'leave' => [
102
-                    NodeKind::NAME => static function (NameNode $node) {
102
+                    NodeKind::NAME => static function(NameNode $node) {
103 103
                         return '' . $node->value;
104 104
                     },
105 105
 
106
-                    NodeKind::VARIABLE => static function (VariableNode $node) {
106
+                    NodeKind::VARIABLE => static function(VariableNode $node) {
107 107
                         return '$' . $node->name;
108 108
                     },
109 109
 
110
-                    NodeKind::DOCUMENT => function (DocumentNode $node) {
110
+                    NodeKind::DOCUMENT => function(DocumentNode $node) {
111 111
                         return $this->join($node->definitions, "\n\n") . "\n";
112 112
                     },
113 113
 
114
-                    NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) {
114
+                    NodeKind::OPERATION_DEFINITION => function(OperationDefinitionNode $node) {
115 115
                         $op           = $node->operation;
116 116
                         $name         = $node->name;
117 117
                         $varDefs      = $this->wrap('(', $this->join($node->variableDefinitions, ', '), ')');
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 
121 121
                         // Anonymous queries with no directives or variable definitions can use
122 122
                         // the query short form.
123
-                        return ! $name && ! $directives && ! $varDefs && $op === 'query'
123
+                        return !$name && !$directives && !$varDefs && $op === 'query'
124 124
                             ? $selectionSet
125 125
                             : $this->join([$op, $this->join([$name, $varDefs]), $directives, $selectionSet], ' ');
126 126
                     },
127 127
 
128
-                    NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $node) {
128
+                    NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $node) {
129 129
                         return $node->variable
130 130
                             . ': '
131 131
                             . $node->type
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
                             . $this->wrap(' ', $this->join($node->directives, ' '));
134 134
                     },
135 135
 
136
-                    NodeKind::SELECTION_SET => function (SelectionSetNode $node) {
136
+                    NodeKind::SELECTION_SET => function(SelectionSetNode $node) {
137 137
                         return $this->block($node->selections);
138 138
                     },
139 139
 
140
-                    NodeKind::FIELD => function (FieldNode $node) {
140
+                    NodeKind::FIELD => function(FieldNode $node) {
141 141
                         return $this->join(
142 142
                             [
143 143
                                 $this->wrap('', $node->alias, ': ') . $node->name . $this->wrap(
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
                         );
153 153
                     },
154 154
 
155
-                    NodeKind::ARGUMENT => static function (ArgumentNode $node) {
155
+                    NodeKind::ARGUMENT => static function(ArgumentNode $node) {
156 156
                         return $node->name . ': ' . $node->value;
157 157
                     },
158 158
 
159
-                    NodeKind::FRAGMENT_SPREAD => function (FragmentSpreadNode $node) {
159
+                    NodeKind::FRAGMENT_SPREAD => function(FragmentSpreadNode $node) {
160 160
                         return '...' . $node->name . $this->wrap(' ', $this->join($node->directives, ' '));
161 161
                     },
162 162
 
163
-                    NodeKind::INLINE_FRAGMENT => function (InlineFragmentNode $node) {
163
+                    NodeKind::INLINE_FRAGMENT => function(InlineFragmentNode $node) {
164 164
                         return $this->join(
165 165
                             [
166 166
                                 '...',
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                         );
173 173
                     },
174 174
 
175
-                    NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) {
175
+                    NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $node) {
176 176
                         // Note: fragment variable definitions are experimental and may be changed or removed in the future.
177 177
                         return sprintf('fragment %s', $node->name)
178 178
                             . $this->wrap('(', $this->join($node->variableDefinitions, ', '), ')')
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
                             . $node->selectionSet;
182 182
                     },
183 183
 
184
-                    NodeKind::INT => static function (IntValueNode $node) {
184
+                    NodeKind::INT => static function(IntValueNode $node) {
185 185
                         return $node->value;
186 186
                     },
187 187
 
188
-                    NodeKind::FLOAT => static function (FloatValueNode $node) {
188
+                    NodeKind::FLOAT => static function(FloatValueNode $node) {
189 189
                         return $node->value;
190 190
                     },
191 191
 
192
-                    NodeKind::STRING => function (StringValueNode $node, $key) {
192
+                    NodeKind::STRING => function(StringValueNode $node, $key) {
193 193
                         if ($node->block) {
194 194
                             return $this->printBlockString($node->value, $key === 'description');
195 195
                         }
@@ -197,47 +197,47 @@  discard block
 block discarded – undo
197 197
                         return json_encode($node->value);
198 198
                     },
199 199
 
200
-                    NodeKind::BOOLEAN => static function (BooleanValueNode $node) {
200
+                    NodeKind::BOOLEAN => static function(BooleanValueNode $node) {
201 201
                         return $node->value ? 'true' : 'false';
202 202
                     },
203 203
 
204
-                    NodeKind::NULL => static function (NullValueNode $node) {
204
+                    NodeKind::NULL => static function(NullValueNode $node) {
205 205
                         return 'null';
206 206
                     },
207 207
 
208
-                    NodeKind::ENUM => static function (EnumValueNode $node) {
208
+                    NodeKind::ENUM => static function(EnumValueNode $node) {
209 209
                         return $node->value;
210 210
                     },
211 211
 
212
-                    NodeKind::LST => function (ListValueNode $node) {
212
+                    NodeKind::LST => function(ListValueNode $node) {
213 213
                         return '[' . $this->join($node->values, ', ') . ']';
214 214
                     },
215 215
 
216
-                    NodeKind::OBJECT => function (ObjectValueNode $node) {
216
+                    NodeKind::OBJECT => function(ObjectValueNode $node) {
217 217
                         return '{' . $this->join($node->fields, ', ') . '}';
218 218
                     },
219 219
 
220
-                    NodeKind::OBJECT_FIELD => static function (ObjectFieldNode $node) {
220
+                    NodeKind::OBJECT_FIELD => static function(ObjectFieldNode $node) {
221 221
                         return $node->name . ': ' . $node->value;
222 222
                     },
223 223
 
224
-                    NodeKind::DIRECTIVE => function (DirectiveNode $node) {
224
+                    NodeKind::DIRECTIVE => function(DirectiveNode $node) {
225 225
                         return '@' . $node->name . $this->wrap('(', $this->join($node->arguments, ', '), ')');
226 226
                     },
227 227
 
228
-                    NodeKind::NAMED_TYPE => static function (NamedTypeNode $node) {
228
+                    NodeKind::NAMED_TYPE => static function(NamedTypeNode $node) {
229 229
                         return $node->name;
230 230
                     },
231 231
 
232
-                    NodeKind::LIST_TYPE => static function (ListTypeNode $node) {
232
+                    NodeKind::LIST_TYPE => static function(ListTypeNode $node) {
233 233
                         return '[' . $node->type . ']';
234 234
                     },
235 235
 
236
-                    NodeKind::NON_NULL_TYPE => static function (NonNullTypeNode $node) {
236
+                    NodeKind::NON_NULL_TYPE => static function(NonNullTypeNode $node) {
237 237
                         return $node->type . '!';
238 238
                     },
239 239
 
240
-                    NodeKind::SCHEMA_DEFINITION => function (SchemaDefinitionNode $def) {
240
+                    NodeKind::SCHEMA_DEFINITION => function(SchemaDefinitionNode $def) {
241 241
                         return $this->join(
242 242
                             [
243 243
                                 'schema',
@@ -248,15 +248,15 @@  discard block
 block discarded – undo
248 248
                         );
249 249
                     },
250 250
 
251
-                    NodeKind::OPERATION_TYPE_DEFINITION => static function (OperationTypeDefinitionNode $def) {
251
+                    NodeKind::OPERATION_TYPE_DEFINITION => static function(OperationTypeDefinitionNode $def) {
252 252
                         return $def->operation . ': ' . $def->type;
253 253
                     },
254 254
 
255
-                    NodeKind::SCALAR_TYPE_DEFINITION => $this->addDescription(function (ScalarTypeDefinitionNode $def) {
255
+                    NodeKind::SCALAR_TYPE_DEFINITION => $this->addDescription(function(ScalarTypeDefinitionNode $def) {
256 256
                         return $this->join(['scalar', $def->name, $this->join($def->directives, ' ')], ' ');
257 257
                     }),
258 258
 
259
-                    NodeKind::OBJECT_TYPE_DEFINITION => $this->addDescription(function (ObjectTypeDefinitionNode $def) {
259
+                    NodeKind::OBJECT_TYPE_DEFINITION => $this->addDescription(function(ObjectTypeDefinitionNode $def) {
260 260
                         return $this->join(
261 261
                             [
262 262
                                 'type',
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
                         );
270 270
                     }),
271 271
 
272
-                    NodeKind::FIELD_DEFINITION => $this->addDescription(function (FieldDefinitionNode $def) {
273
-                        $noIndent = Utils::every($def->arguments, static function (string $arg) {
272
+                    NodeKind::FIELD_DEFINITION => $this->addDescription(function(FieldDefinitionNode $def) {
273
+                        $noIndent = Utils::every($def->arguments, static function(string $arg) {
274 274
                             return strpos($arg, "\n") === false;
275 275
                         });
276 276
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
                             . $this->wrap(' ', $this->join($def->directives, ' '));
283 283
                     }),
284 284
 
285
-                    NodeKind::INPUT_VALUE_DEFINITION => $this->addDescription(function (InputValueDefinitionNode $def) {
285
+                    NodeKind::INPUT_VALUE_DEFINITION => $this->addDescription(function(InputValueDefinitionNode $def) {
286 286
                         return $this->join(
287 287
                             [
288 288
                                 $def->name . ': ' . $def->type,
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
                     }),
295 295
 
296 296
                     NodeKind::INTERFACE_TYPE_DEFINITION => $this->addDescription(
297
-                        function (InterfaceTypeDefinitionNode $def) {
297
+                        function(InterfaceTypeDefinitionNode $def) {
298 298
                             return $this->join(
299 299
                                 [
300 300
                                     'interface',
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                         }
308 308
                     ),
309 309
 
310
-                    NodeKind::UNION_TYPE_DEFINITION => $this->addDescription(function (UnionTypeDefinitionNode $def) {
310
+                    NodeKind::UNION_TYPE_DEFINITION => $this->addDescription(function(UnionTypeDefinitionNode $def) {
311 311
                         return $this->join(
312 312
                             [
313 313
                                 'union',
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
                         );
322 322
                     }),
323 323
 
324
-                    NodeKind::ENUM_TYPE_DEFINITION => $this->addDescription(function (EnumTypeDefinitionNode $def) {
324
+                    NodeKind::ENUM_TYPE_DEFINITION => $this->addDescription(function(EnumTypeDefinitionNode $def) {
325 325
                         return $this->join(
326 326
                             [
327 327
                                 'enum',
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
                         );
334 334
                     }),
335 335
 
336
-                    NodeKind::ENUM_VALUE_DEFINITION => $this->addDescription(function (EnumValueDefinitionNode $def) {
336
+                    NodeKind::ENUM_VALUE_DEFINITION => $this->addDescription(function(EnumValueDefinitionNode $def) {
337 337
                         return $this->join([$def->name, $this->join($def->directives, ' ')], ' ');
338 338
                     }),
339 339
 
340
-                    NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $this->addDescription(function (
340
+                    NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $this->addDescription(function(
341 341
                         InputObjectTypeDefinitionNode $def
342 342
                     ) {
343 343
                         return $this->join(
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
                         );
352 352
                     }),
353 353
 
354
-                    NodeKind::SCHEMA_EXTENSION => function (SchemaTypeExtensionNode $def) {
354
+                    NodeKind::SCHEMA_EXTENSION => function(SchemaTypeExtensionNode $def) {
355 355
                         return $this->join(
356 356
                             [
357 357
                                 'extend schema',
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
                         );
363 363
                     },
364 364
 
365
-                    NodeKind::SCALAR_TYPE_EXTENSION => function (ScalarTypeExtensionNode $def) {
365
+                    NodeKind::SCALAR_TYPE_EXTENSION => function(ScalarTypeExtensionNode $def) {
366 366
                         return $this->join(
367 367
                             [
368 368
                                 'extend scalar',
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                         );
374 374
                     },
375 375
 
376
-                    NodeKind::OBJECT_TYPE_EXTENSION => function (ObjectTypeExtensionNode $def) {
376
+                    NodeKind::OBJECT_TYPE_EXTENSION => function(ObjectTypeExtensionNode $def) {
377 377
                         return $this->join(
378 378
                             [
379 379
                                 'extend type',
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                         );
387 387
                     },
388 388
 
389
-                    NodeKind::INTERFACE_TYPE_EXTENSION => function (InterfaceTypeExtensionNode $def) {
389
+                    NodeKind::INTERFACE_TYPE_EXTENSION => function(InterfaceTypeExtensionNode $def) {
390 390
                         return $this->join(
391 391
                             [
392 392
                                 'extend interface',
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                         );
399 399
                     },
400 400
 
401
-                    NodeKind::UNION_TYPE_EXTENSION => function (UnionTypeExtensionNode $def) {
401
+                    NodeKind::UNION_TYPE_EXTENSION => function(UnionTypeExtensionNode $def) {
402 402
                         return $this->join(
403 403
                             [
404 404
                                 'extend union',
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
                         );
413 413
                     },
414 414
 
415
-                    NodeKind::ENUM_TYPE_EXTENSION => function (EnumTypeExtensionNode $def) {
415
+                    NodeKind::ENUM_TYPE_EXTENSION => function(EnumTypeExtensionNode $def) {
416 416
                         return $this->join(
417 417
                             [
418 418
                                 'extend enum',
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                         );
425 425
                     },
426 426
 
427
-                    NodeKind::INPUT_OBJECT_TYPE_EXTENSION => function (InputObjectTypeExtensionNode $def) {
427
+                    NodeKind::INPUT_OBJECT_TYPE_EXTENSION => function(InputObjectTypeExtensionNode $def) {
428 428
                         return $this->join(
429 429
                             [
430 430
                                 'extend input',
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
                         );
437 437
                     },
438 438
 
439
-                    NodeKind::DIRECTIVE_DEFINITION => $this->addDescription(function (DirectiveDefinitionNode $def) {
440
-                        $noIndent = Utils::every($def->arguments, static function (string $arg) {
439
+                    NodeKind::DIRECTIVE_DEFINITION => $this->addDescription(function(DirectiveDefinitionNode $def) {
440
+                        $noIndent = Utils::every($def->arguments, static function(string $arg) {
441 441
                             return strpos($arg, "\n") === false;
442 442
                         });
443 443
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 
456 456
     public function addDescription(callable $cb)
457 457
     {
458
-        return function ($node) use ($cb) {
458
+        return function($node) use ($cb) {
459 459
             return $this->join([$node->description, $cb($node)], "\n");
460 460
         };
461 461
     }
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
                 $separator,
503 503
                 Utils::filter(
504 504
                     $maybeArray,
505
-                    static function ($x) {
505
+                    static function($x) {
506 506
                         return (bool) $x;
507 507
                     }
508 508
                 )
Please login to merge, or discard this patch.
src/Language/Lexer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
                     case 117:
519 519
                         $position = $this->position;
520 520
                         [$hex]    = $this->readChars(4, true);
521
-                        if (! preg_match('/[0-9a-fA-F]{4}/', $hex)) {
521
+                        if (!preg_match('/[0-9a-fA-F]{4}/', $hex)) {
522 522
                             throw new SyntaxError(
523 523
                                 $this->source,
524 524
                                 $position - 1,
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
                         $highOrderByte = $code >> 8;
533 533
                         if (0xD8 <= $highOrderByte && $highOrderByte <= 0xDF) {
534 534
                             [$utf16Continuation] = $this->readChars(6, true);
535
-                            if (! preg_match('/^\\\u[0-9a-fA-F]{4}$/', $utf16Continuation)) {
535
+                            if (!preg_match('/^\\\u[0-9a-fA-F]{4}$/', $utf16Continuation)) {
536 536
                                 throw new SyntaxError(
537 537
                                     $this->source,
538 538
                                     $this->position - 5,
Please login to merge, or discard this patch.
src/Language/Visitor.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             $isEdited  = $isLeaving && count($edits) !== 0;
209 209
 
210 210
             if ($isLeaving) {
211
-                $key    = ! $ancestors ? $UNDEFINED : $path[count($path) - 1];
211
+                $key    = !$ancestors ? $UNDEFINED : $path[count($path) - 1];
212 212
                 $node   = $parent;
213 213
                 $parent = array_pop($ancestors);
214 214
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                 $inArray = $stack['inArray'];
252 252
                 $stack   = $stack['prev'];
253 253
             } else {
254
-                $key  = $parent !== null
254
+                $key = $parent !== null
255 255
                     ? ($inArray
256 256
                         ? $index
257 257
                         : $keys[$index]
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
             }
273 273
 
274 274
             $result = null;
275
-            if (! $node instanceof NodeList && ! is_array($node)) {
276
-                if (! ($node instanceof Node)) {
275
+            if (!$node instanceof NodeList && !is_array($node)) {
276
+                if (!($node instanceof Node)) {
277 277
                     throw new Exception('Invalid AST Node: ' . json_encode($node));
278 278
                 }
279 279
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                             if ($result->doBreak) {
289 289
                                 break;
290 290
                             }
291
-                            if (! $isLeaving && $result->doContinue) {
291
+                            if (!$isLeaving && $result->doContinue) {
292 292
                                 array_pop($path);
293 293
                                 continue;
294 294
                             }
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
                         }
301 301
 
302 302
                         $edits[] = [$key, $editValue];
303
-                        if (! $isLeaving) {
304
-                            if (! ($editValue instanceof Node)) {
303
+                        if (!$isLeaving) {
304
+                            if (!($editValue instanceof Node)) {
305 305
                                 array_pop($path);
306 306
                                 continue;
307 307
                             }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
             if ($isLeaving) {
320 320
                 array_pop($path);
321 321
             } else {
322
-                $stack   = [
322
+                $stack = [
323 323
                     'inArray' => $inArray,
324 324
                     'index'   => $index,
325 325
                     'keys'    => $keys,
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
         $skipping      = new SplFixedArray($visitorsCount);
402 402
 
403 403
         return [
404
-            'enter' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) {
404
+            'enter' => static function(Node $node) use ($visitors, $skipping, $visitorsCount) {
405 405
                 for ($i = 0; $i < $visitorsCount; $i++) {
406
-                    if (! empty($skipping[$i])) {
406
+                    if (!empty($skipping[$i])) {
407 407
                         continue;
408 408
                     }
409 409
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                         false
414 414
                     );
415 415
 
416
-                    if (! $fn) {
416
+                    if (!$fn) {
417 417
                         continue;
418 418
                     }
419 419
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                     }
433 433
                 }
434 434
             },
435
-            'leave' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) {
435
+            'leave' => static function(Node $node) use ($visitors, $skipping, $visitorsCount) {
436 436
                 for ($i = 0; $i < $visitorsCount; $i++) {
437 437
                     if (empty($skipping[$i])) {
438 438
                         $fn = self::getVisitFn(
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
     public static function visitWithTypeInfo(TypeInfo $typeInfo, $visitor)
469 469
     {
470 470
         return [
471
-            'enter' => static function (Node $node) use ($typeInfo, $visitor) {
471
+            'enter' => static function(Node $node) use ($typeInfo, $visitor) {
472 472
                 $typeInfo->enter($node);
473 473
                 $fn = self::getVisitFn($visitor, $node->kind, false);
474 474
 
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 
487 487
                 return null;
488 488
             },
489
-            'leave' => static function (Node $node) use ($typeInfo, $visitor) {
489
+            'leave' => static function(Node $node) use ($typeInfo, $visitor) {
490 490
                 $fn     = self::getVisitFn($visitor, $node->kind, true);
491 491
                 $result = $fn ? call_user_func_array($fn, func_get_args()) : null;
492 492
                 $typeInfo->leave($node);
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 
512 512
         $kindVisitor = $visitor[$kind] ?? null;
513 513
 
514
-        if (! $isLeaving && is_callable($kindVisitor)) {
514
+        if (!$isLeaving && is_callable($kindVisitor)) {
515 515
             // { Kind() {} }
516 516
             return $kindVisitor;
517 517
         }
Please login to merge, or discard this patch.
src/Language/Parser.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
         $this->expect($openKind);
393 393
 
394 394
         $nodes = [];
395
-        while (! $this->skip($closeKind)) {
395
+        while (!$this->skip($closeKind)) {
396 396
             $nodes[] = $parseFn($this);
397 397
         }
398 398
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         $this->expect($openKind);
419 419
 
420 420
         $nodes = [$parseFn($this)];
421
-        while (! $this->skip($closeKind)) {
421
+        while (!$this->skip($closeKind)) {
422 422
             $nodes[] = $parseFn($this);
423 423
         }
424 424
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         return new DocumentNode([
457 457
             'definitions' => $this->many(
458 458
                 Token::SOF,
459
-                function () {
459
+                function() {
460 460
                     return $this->parseDefinition();
461 461
                 },
462 462
                 Token::EOF
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
         return $this->peek(Token::PAREN_L)
593 593
             ? $this->many(
594 594
                 Token::PAREN_L,
595
-                function () {
595
+                function() {
596 596
                     return $this->parseVariableDefinition();
597 597
                 },
598 598
                 Token::PAREN_R
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
             [
651 651
                 'selections' => $this->many(
652 652
                     Token::BRACE_L,
653
-                    function () {
653
+                    function() {
654 654
                         return $this->parseSelection();
655 655
                     },
656 656
                     Token::BRACE_R
@@ -713,10 +713,10 @@  discard block
 block discarded – undo
713 713
     private function parseArguments($isConst)
714 714
     {
715 715
         $parseFn = $isConst
716
-            ? function () {
716
+            ? function() {
717 717
                 return $this->parseConstArgument();
718 718
             }
719
-            : function () {
719
+            : function() {
720 720
                 return $this->parseArgument();
721 721
             };
722 722
 
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
                 break;
924 924
 
925 925
             case Token::DOLLAR:
926
-                if (! $isConst) {
926
+                if (!$isConst) {
927 927
                     return $this->parseVariable();
928 928
                 }
929 929
                 break;
@@ -972,9 +972,9 @@  discard block
 block discarded – undo
972 972
     private function parseArray($isConst)
973 973
     {
974 974
         $start   = $this->lexer->token;
975
-        $parseFn = $isConst ? function () {
975
+        $parseFn = $isConst ? function() {
976 976
             return $this->parseConstValue();
977
-        } : function () {
977
+        } : function() {
978 978
             return $this->parseVariableValue();
979 979
         };
980 980
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
         $start = $this->lexer->token;
997 997
         $this->expect(Token::BRACE_L);
998 998
         $fields = [];
999
-        while (! $this->skip(Token::BRACE_R)) {
999
+        while (!$this->skip(Token::BRACE_R)) {
1000 1000
             $fields[] = $this->parseObjectField($isConst);
1001 1001
         }
1002 1002
 
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
 
1192 1192
         $operationTypes = $this->many(
1193 1193
             Token::BRACE_L,
1194
-            function () {
1194
+            function() {
1195 1195
                 return $this->parseOperationTypeDefinition();
1196 1196
             },
1197 1197
             Token::BRACE_R
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
                 $types[] = $this->parseNamedType();
1288 1288
             } while ($this->skip(Token::AMP) ||
1289 1289
                 // Legacy support for the SDL?
1290
-                (! empty($this->lexer->options['allowLegacySDLImplementsInterfaces']) && $this->peek(Token::NAME))
1290
+                (!empty($this->lexer->options['allowLegacySDLImplementsInterfaces']) && $this->peek(Token::NAME))
1291 1291
             );
1292 1292
         }
1293 1293
 
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
     private function parseFieldsDefinition()
1303 1303
     {
1304 1304
         // Legacy support for the SDL?
1305
-        if (! empty($this->lexer->options['allowLegacySDLEmptyFields']) &&
1305
+        if (!empty($this->lexer->options['allowLegacySDLEmptyFields']) &&
1306 1306
             $this->peek(Token::BRACE_L) &&
1307 1307
             $this->lexer->lookahead()->kind === Token::BRACE_R
1308 1308
         ) {
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
         return $this->peek(Token::BRACE_L)
1316 1316
             ? $this->many(
1317 1317
                 Token::BRACE_L,
1318
-                function () {
1318
+                function() {
1319 1319
                     return $this->parseFieldDefinition();
1320 1320
                 },
1321 1321
                 Token::BRACE_R
@@ -1355,13 +1355,13 @@  discard block
 block discarded – undo
1355 1355
      */
1356 1356
     private function parseArgumentsDefinition()
1357 1357
     {
1358
-        if (! $this->peek(Token::PAREN_L)) {
1358
+        if (!$this->peek(Token::PAREN_L)) {
1359 1359
             return new NodeList([]);
1360 1360
         }
1361 1361
 
1362 1362
         return $this->many(
1363 1363
             Token::PAREN_L,
1364
-            function () {
1364
+            function() {
1365 1365
                 return $this->parseInputValueDefinition();
1366 1366
             },
1367 1367
             Token::PAREN_R
@@ -1499,7 +1499,7 @@  discard block
 block discarded – undo
1499 1499
         return $this->peek(Token::BRACE_L)
1500 1500
             ? $this->many(
1501 1501
                 Token::BRACE_L,
1502
-                function () {
1502
+                function() {
1503 1503
                     return $this->parseEnumValueDefinition();
1504 1504
                 },
1505 1505
                 Token::BRACE_R
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
         return $this->peek(Token::BRACE_L)
1561 1561
             ? $this->many(
1562 1562
                 Token::BRACE_L,
1563
-                function () {
1563
+                function() {
1564 1564
                     return $this->parseInputValueDefinition();
1565 1565
                 },
1566 1566
                 Token::BRACE_R
Please login to merge, or discard this patch.
src/Server/Helper.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                     throw new RequestError('Could not parse JSON: ' . json_last_error_msg());
88 88
                 }
89 89
 
90
-                if (! is_array($bodyParams)) {
90
+                if (!is_array($bodyParams)) {
91 91
                     throw new RequestError(
92 92
                         'GraphQL Server expects JSON object or array, but got ' .
93 93
                         Utils::printSafeJson($bodyParams)
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     public function validateOperationParams(OperationParams $params)
154 154
     {
155 155
         $errors = [];
156
-        if (! $params->query && ! $params->queryId) {
156
+        if (!$params->query && !$params->queryId) {
157 157
             $errors[] = new RequestError('GraphQL Request must include at least one of those two parameters: "query" or "queryId"');
158 158
         }
159 159
 
@@ -161,28 +161,28 @@  discard block
 block discarded – undo
161 161
             $errors[] = new RequestError('GraphQL Request parameters "query" and "queryId" are mutually exclusive');
162 162
         }
163 163
 
164
-        if ($params->query !== null && (! is_string($params->query) || empty($params->query))) {
164
+        if ($params->query !== null && (!is_string($params->query) || empty($params->query))) {
165 165
             $errors[] = new RequestError(
166 166
                 'GraphQL Request parameter "query" must be string, but got ' .
167 167
                 Utils::printSafeJson($params->query)
168 168
             );
169 169
         }
170 170
 
171
-        if ($params->queryId !== null && (! is_string($params->queryId) || empty($params->queryId))) {
171
+        if ($params->queryId !== null && (!is_string($params->queryId) || empty($params->queryId))) {
172 172
             $errors[] = new RequestError(
173 173
                 'GraphQL Request parameter "queryId" must be string, but got ' .
174 174
                 Utils::printSafeJson($params->queryId)
175 175
             );
176 176
         }
177 177
 
178
-        if ($params->operation !== null && (! is_string($params->operation) || empty($params->operation))) {
178
+        if ($params->operation !== null && (!is_string($params->operation) || empty($params->operation))) {
179 179
             $errors[] = new RequestError(
180 180
                 'GraphQL Request parameter "operation" must be string, but got ' .
181 181
                 Utils::printSafeJson($params->operation)
182 182
             );
183 183
         }
184 184
 
185
-        if ($params->variables !== null && (! is_array($params->variables) || isset($params->variables[0]))) {
185
+        if ($params->variables !== null && (!is_array($params->variables) || isset($params->variables[0]))) {
186 186
             $errors[] = new RequestError(
187 187
                 'GraphQL Request parameter "variables" must be object or JSON string parsed to object, but got ' .
188 188
                 Utils::printSafeJson($params->getOriginalInput('variables'))
@@ -253,20 +253,20 @@  discard block
 block discarded – undo
253 253
         $isBatch = false
254 254
     ) {
255 255
         try {
256
-            if (! $config->getSchema()) {
256
+            if (!$config->getSchema()) {
257 257
                 throw new InvariantViolation('Schema is required for the server');
258 258
             }
259 259
 
260
-            if ($isBatch && ! $config->getQueryBatching()) {
260
+            if ($isBatch && !$config->getQueryBatching()) {
261 261
                 throw new RequestError('Batched queries are not supported by this server');
262 262
             }
263 263
 
264 264
             $errors = $this->validateOperationParams($op);
265 265
 
266
-            if (! empty($errors)) {
266
+            if (!empty($errors)) {
267 267
                 $errors = Utils::map(
268 268
                     $errors,
269
-                    static function (RequestError $err) {
269
+                    static function(RequestError $err) {
270 270
                         return Error::createLocatedError($err, null, null);
271 271
                     }
272 272
                 );
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
                 ? $this->loadPersistedQuery($config, $op)
281 281
                 : $op->query;
282 282
 
283
-            if (! $doc instanceof DocumentNode) {
283
+            if (!$doc instanceof DocumentNode) {
284 284
                 $doc = Parser::parse($doc);
285 285
             }
286 286
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
             );
316 316
         }
317 317
 
318
-        $applyErrorHandling = static function (ExecutionResult $result) use ($config) {
318
+        $applyErrorHandling = static function(ExecutionResult $result) use ($config) {
319 319
             if ($config->getErrorsHandler()) {
320 320
                 $result->setErrorsHandler($config->getErrorsHandler());
321 321
             }
@@ -344,13 +344,13 @@  discard block
 block discarded – undo
344 344
         // Load query if we got persisted query id:
345 345
         $loader = $config->getPersistentQueryLoader();
346 346
 
347
-        if (! $loader) {
347
+        if (!$loader) {
348 348
             throw new RequestError('Persisted queries are not supported by this server');
349 349
         }
350 350
 
351 351
         $source = $loader($operationParams->queryId, $operationParams);
352 352
 
353
-        if (! is_string($source) && ! $source instanceof DocumentNode) {
353
+        if (!is_string($source) && !$source instanceof DocumentNode) {
354 354
             throw new InvariantViolation(sprintf(
355 355
                 'Persistent query loader must return query string or instance of %s but got: %s',
356 356
                 DocumentNode::class,
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         if (is_callable($validationRules)) {
379 379
             $validationRules = $validationRules($params, $doc, $operationType);
380 380
 
381
-            if (! is_array($validationRules)) {
381
+            if (!is_array($validationRules)) {
382 382
                 throw new InvariantViolation(sprintf(
383 383
                     'Expecting validation rules to be array or callable returning array, but got: %s',
384 384
                     Utils::printSafe($validationRules)
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
     public function sendResponse($result, $exitWhenDone = false)
435 435
     {
436 436
         if ($result instanceof Promise) {
437
-            $result->then(function ($actualResult) use ($exitWhenDone) {
437
+            $result->then(function($actualResult) use ($exitWhenDone) {
438 438
                 $this->doSendResponse($actualResult, $exitWhenDone);
439 439
             });
440 440
         } else {
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
         if (is_array($result) && isset($result[0])) {
483 483
             Utils::each(
484 484
                 $result,
485
-                static function ($executionResult, $index) {
486
-                    if (! $executionResult instanceof ExecutionResult) {
485
+                static function($executionResult, $index) {
486
+                    if (!$executionResult instanceof ExecutionResult) {
487 487
                         throw new InvariantViolation(sprintf(
488 488
                             'Expecting every entry of batched query result to be instance of %s but entry at position %d is %s',
489 489
                             ExecutionResult::class,
@@ -495,14 +495,14 @@  discard block
 block discarded – undo
495 495
             );
496 496
             $httpStatus = 200;
497 497
         } else {
498
-            if (! $result instanceof ExecutionResult) {
498
+            if (!$result instanceof ExecutionResult) {
499 499
                 throw new InvariantViolation(sprintf(
500 500
                     'Expecting query result to be instance of %s but got %s',
501 501
                     ExecutionResult::class,
502 502
                     Utils::printSafe($result)
503 503
                 ));
504 504
             }
505
-            if ($result->data === null && ! empty($result->errors)) {
505
+            if ($result->data === null && !empty($result->errors)) {
506 506
                 $httpStatus = 400;
507 507
             } else {
508 508
                 $httpStatus = 200;
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
         } else {
529 529
             $contentType = $request->getHeader('content-type');
530 530
 
531
-            if (! isset($contentType[0])) {
531
+            if (!isset($contentType[0])) {
532 532
                 throw new RequestError('Missing "Content-Type" header');
533 533
             }
534 534
 
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                     );
544 544
                 }
545 545
 
546
-                if (! is_array($bodyParams)) {
546
+                if (!is_array($bodyParams)) {
547 547
                     throw new RequestError(
548 548
                         'GraphQL Server expects JSON object or array, but got ' .
549 549
                         Utils::printSafeJson($bodyParams)
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
             } else {
553 553
                 $bodyParams = $request->getParsedBody();
554 554
 
555
-                if (! is_array($bodyParams)) {
555
+                if (!is_array($bodyParams)) {
556 556
                     throw new RequestError('Unexpected content type: ' . Utils::printSafeJson($contentType[0]));
557 557
                 }
558 558
             }
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
     public function toPsrResponse($result, ResponseInterface $response, StreamInterface $writableBodyStream)
578 578
     {
579 579
         if ($result instanceof Promise) {
580
-            return $result->then(function ($actualResult) use ($response, $writableBodyStream) {
580
+            return $result->then(function($actualResult) use ($response, $writableBodyStream) {
581 581
                 return $this->doConvertToPsrResponse($actualResult, $response, $writableBodyStream);
582 582
             });
583 583
         }
Please login to merge, or discard this patch.