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
Push — master ( 34fe96...e7bef7 )
by Šimon
05:10
created
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.
src/Language/Parser.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
         $this->expect($openKind);
370 370
 
371 371
         $nodes = [];
372
-        while (! $this->skip($closeKind)) {
372
+        while (!$this->skip($closeKind)) {
373 373
             $nodes[] = $parseFn($this);
374 374
         }
375 375
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
         $this->expect($openKind);
390 390
 
391 391
         $nodes = [$parseFn($this)];
392
-        while (! $this->skip($closeKind)) {
392
+        while (!$this->skip($closeKind)) {
393 393
             $nodes[] = $parseFn($this);
394 394
         }
395 395
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         return new DocumentNode([
424 424
             'definitions' => $this->many(
425 425
                 Token::SOF,
426
-                function () {
426
+                function() {
427 427
                     return $this->parseDefinition();
428 428
                 },
429 429
                 Token::EOF
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
         return $this->peek(Token::PAREN_L)
551 551
             ? $this->many(
552 552
                 Token::PAREN_L,
553
-                function () {
553
+                function() {
554 554
                     return $this->parseVariableDefinition();
555 555
                 },
556 556
                 Token::PAREN_R
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
             [
602 602
                 'selections' => $this->many(
603 603
                     Token::BRACE_L,
604
-                    function () {
604
+                    function() {
605 605
                         return $this->parseSelection();
606 606
                     },
607 607
                     Token::BRACE_R
@@ -656,10 +656,10 @@  discard block
 block discarded – undo
656 656
     private function parseArguments(bool $isConst) : NodeList
657 657
     {
658 658
         $parseFn = $isConst
659
-            ? function () {
659
+            ? function() {
660 660
                 return $this->parseConstArgument();
661 661
             }
662
-            : function () {
662
+            : function() {
663 663
                 return $this->parseArgument();
664 664
             };
665 665
 
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
                 break;
857 857
 
858 858
             case Token::DOLLAR:
859
-                if (! $isConst) {
859
+                if (!$isConst) {
860 860
                     return $this->parseVariable();
861 861
                 }
862 862
                 break;
@@ -897,9 +897,9 @@  discard block
 block discarded – undo
897 897
     private function parseArray(bool $isConst) : ListValueNode
898 898
     {
899 899
         $start   = $this->lexer->token;
900
-        $parseFn = $isConst ? function () {
900
+        $parseFn = $isConst ? function() {
901 901
             return $this->parseConstValue();
902
-        } : function () {
902
+        } : function() {
903 903
             return $this->parseVariableValue();
904 904
         };
905 905
 
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
         $start = $this->lexer->token;
917 917
         $this->expect(Token::BRACE_L);
918 918
         $fields = [];
919
-        while (! $this->skip(Token::BRACE_R)) {
919
+        while (!$this->skip(Token::BRACE_R)) {
920 920
             $fields[] = $this->parseObjectField($isConst);
921 921
         }
922 922
 
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 
1091 1091
         $operationTypes = $this->many(
1092 1092
             Token::BRACE_L,
1093
-            function () {
1093
+            function() {
1094 1094
                 return $this->parseOperationTypeDefinition();
1095 1095
             },
1096 1096
             Token::BRACE_R
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
                 $types[] = $this->parseNamedType();
1181 1181
             } while ($this->skip(Token::AMP) ||
1182 1182
                 // Legacy support for the SDL?
1183
-                (! empty($this->lexer->options['allowLegacySDLImplementsInterfaces']) && $this->peek(Token::NAME))
1183
+                (!empty($this->lexer->options['allowLegacySDLImplementsInterfaces']) && $this->peek(Token::NAME))
1184 1184
             );
1185 1185
         }
1186 1186
 
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
     private function parseFieldsDefinition() : NodeList
1194 1194
     {
1195 1195
         // Legacy support for the SDL?
1196
-        if (! empty($this->lexer->options['allowLegacySDLEmptyFields'])
1196
+        if (!empty($this->lexer->options['allowLegacySDLEmptyFields'])
1197 1197
             && $this->peek(Token::BRACE_L)
1198 1198
             && $this->lexer->lookahead()->kind === Token::BRACE_R
1199 1199
         ) {
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
             $nodeList = $this->peek(Token::BRACE_L)
1208 1208
                 ? $this->many(
1209 1209
                     Token::BRACE_L,
1210
-                    function () {
1210
+                    function() {
1211 1211
                         return $this->parseFieldDefinition();
1212 1212
                     },
1213 1213
                     Token::BRACE_R
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
         $nodeList = $this->peek(Token::PAREN_L)
1251 1251
             ? $this->many(
1252 1252
                 Token::PAREN_L,
1253
-                function () {
1253
+                function() {
1254 1254
                     return $this->parseInputValueDefinition();
1255 1255
                 },
1256 1256
                 Token::PAREN_R
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
         $nodeList = $this->peek(Token::BRACE_L)
1383 1383
             ? $this->many(
1384 1384
                 Token::BRACE_L,
1385
-                function () {
1385
+                function() {
1386 1386
                     return $this->parseEnumValueDefinition();
1387 1387
                 },
1388 1388
                 Token::BRACE_R
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
         $nodeList = $this->peek(Token::BRACE_L)
1441 1441
             ? $this->many(
1442 1442
                 Token::BRACE_L,
1443
-                function () {
1443
+                function() {
1444 1444
                     return $this->parseInputValueDefinition();
1445 1445
                 },
1446 1446
                 Token::BRACE_R
Please login to merge, or discard this patch.
src/Utils/TypeInfo.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         if (Type::isCompositeType($initialType)) {
95 95
             $this->parentTypeStack[] = $initialType;
96 96
         }
97
-        if (! Type::isOutputType($initialType)) {
97
+        if (!Type::isOutputType($initialType)) {
98 98
             return;
99 99
         }
100 100
 
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public static function extractTypes($type, ?array $typeMap = null)
151 151
     {
152
-        if (! $typeMap) {
152
+        if (!$typeMap) {
153 153
             $typeMap = [];
154 154
         }
155
-        if (! $type) {
155
+        if (!$type) {
156 156
             return $typeMap;
157 157
         }
158 158
 
159 159
         if ($type instanceof WrappingType) {
160 160
             return self::extractTypes($type->getWrappedType(true), $typeMap);
161 161
         }
162
-        if (! $type instanceof Type) {
162
+        if (!$type instanceof Type) {
163 163
             // Preserve these invalid types in map (at numeric index) to make them
164 164
             // detectable during $schema->validate()
165 165
             $i            = 0;
@@ -168,14 +168,14 @@  discard block
 block discarded – undo
168 168
                 $alreadyInMap = $alreadyInMap || $typeMap[$i] === $type;
169 169
                 $i++;
170 170
             }
171
-            if (! $alreadyInMap) {
171
+            if (!$alreadyInMap) {
172 172
                 $typeMap[$i] = $type;
173 173
             }
174 174
 
175 175
             return $typeMap;
176 176
         }
177 177
 
178
-        if (! empty($typeMap[$type->name])) {
178
+        if (!empty($typeMap[$type->name])) {
179 179
             Utils::invariant(
180 180
                 $typeMap[$type->name] === $type,
181 181
                 sprintf('Schema must contain unique named types but contains multiple types named "%s" ', $type) .
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
         }
197 197
         if ($type instanceof ObjectType || $type instanceof InterfaceType) {
198 198
             foreach ($type->getFields() as $fieldName => $field) {
199
-                if (! empty($field->args)) {
199
+                if (!empty($field->args)) {
200 200
                     $fieldArgTypes = array_map(
201
-                        static function (FieldArgument $arg) {
201
+                        static function(FieldArgument $arg) {
202 202
                             return $arg->getType();
203 203
                         },
204 204
                         $field->args
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
                     /** @var FieldArgument $argDef */
324 324
                     $argDef = Utils::find(
325 325
                         $fieldOrDirective->args,
326
-                        static function ($arg) use ($node) {
326
+                        static function($arg) use ($node) {
327 327
                             return $arg->name === $node->name->value;
328 328
                         }
329 329
                     );
Please login to merge, or discard this patch.
src/Validator/Rules/KnownArgumentNames.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public function getVisitor(ValidationContext $context)
29 29
     {
30 30
         return [
31
-            NodeKind::ARGUMENT => static function (ArgumentNode $node, $key, $parent, $path, $ancestors) use ($context) {
31
+            NodeKind::ARGUMENT => static function(ArgumentNode $node, $key, $parent, $path, $ancestors) use ($context) {
32 32
                 $argDef = $context->getArgument();
33 33
                 if ($argDef !== null) {
34 34
                     return null;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                                 Utils::suggestionList(
49 49
                                     $node->name->value,
50 50
                                     array_map(
51
-                                        static function ($arg) {
51
+                                        static function($arg) {
52 52
                                             return $arg->name;
53 53
                                         },
54 54
                                         $fieldDef->args
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                                 Utils::suggestionList(
69 69
                                     $node->name->value,
70 70
                                     array_map(
71
-                                        static function ($arg) {
71
+                                        static function($arg) {
72 72
                                             return $arg->name;
73 73
                                         },
74 74
                                         $directive->args
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     public static function unknownArgMessage($argName, $fieldName, $typeName, array $suggestedArgs)
90 90
     {
91 91
         $message = sprintf('Unknown argument "%s" on field "%s" of type "%s".', $argName, $fieldName, $typeName);
92
-        if (! empty($suggestedArgs)) {
92
+        if (!empty($suggestedArgs)) {
93 93
             $message .= sprintf(' Did you mean %s?', Utils::quotedOrList($suggestedArgs));
94 94
         }
95 95
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     public static function unknownDirectiveArgMessage($argName, $directiveName, array $suggestedArgs)
103 103
     {
104 104
         $message = sprintf('Unknown argument "%s" on directive "@%s".', $argName, $directiveName);
105
-        if (! empty($suggestedArgs)) {
105
+        if (!empty($suggestedArgs)) {
106 106
             $message .= sprintf(' Did you mean %s?', Utils::quotedOrList($suggestedArgs));
107 107
         }
108 108
 
Please login to merge, or discard this patch.
src/Validator/Rules/ProvidedRequiredArgumentsOnDirectives.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 
46 46
         foreach ($definedDirectives as $directive) {
47 47
             $requiredArgsMap[$directive->name] = Utils::keyMap(
48
-                array_filter($directive->args, static function (FieldArgument $arg) : bool {
49
-                    return $arg->getType() instanceof NonNull && ! isset($arg->defaultValue);
48
+                array_filter($directive->args, static function(FieldArgument $arg) : bool {
49
+                    return $arg->getType() instanceof NonNull && !isset($arg->defaultValue);
50 50
                 }),
51
-                static function (FieldArgument $arg) : string {
51
+                static function(FieldArgument $arg) : string {
52 52
                     return $arg->name;
53 53
                 }
54 54
             );
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         $astDefinition = $context->getDocument()->definitions;
58 58
         foreach ($astDefinition as $def) {
59
-            if (! ($def instanceof DirectiveDefinitionNode)) {
59
+            if (!($def instanceof DirectiveDefinitionNode)) {
60 60
                 continue;
61 61
             }
62 62
 
@@ -70,32 +70,32 @@  discard block
 block discarded – undo
70 70
 
71 71
             $requiredArgsMap[$def->name->value] = Utils::keyMap(
72 72
                 $arguments
73
-                    ? array_filter($arguments, static function (Node $argument) : bool {
73
+                    ? array_filter($arguments, static function(Node $argument) : bool {
74 74
                         return $argument instanceof NonNullTypeNode &&
75 75
                             (
76
-                                ! isset($argument->defaultValue) ||
76
+                                !isset($argument->defaultValue) ||
77 77
                                 $argument->defaultValue === null
78 78
                             );
79 79
                     })
80 80
                     : [],
81
-                static function (NamedTypeNode $argument) : string {
81
+                static function(NamedTypeNode $argument) : string {
82 82
                     return $argument->name->value;
83 83
                 }
84 84
             );
85 85
         }
86 86
 
87 87
         return [
88
-            NodeKind::DIRECTIVE => static function (DirectiveNode $directiveNode) use ($requiredArgsMap, $context) {
88
+            NodeKind::DIRECTIVE => static function(DirectiveNode $directiveNode) use ($requiredArgsMap, $context) {
89 89
                 $directiveName = $directiveNode->name->value;
90 90
                 $requiredArgs  = $requiredArgsMap[$directiveName] ?? null;
91
-                if (! $requiredArgs) {
91
+                if (!$requiredArgs) {
92 92
                     return null;
93 93
                 }
94 94
 
95 95
                 $argNodes   = $directiveNode->arguments ?: [];
96 96
                 $argNodeMap = Utils::keyMap(
97 97
                     $argNodes,
98
-                    static function (ArgumentNode $arg) : string {
98
+                    static function(ArgumentNode $arg) : string {
99 99
                         return $arg->name->value;
100 100
                     }
101 101
                 );
Please login to merge, or discard this patch.