Passed
Push — master ( 6fd55f...3cccd4 )
by Šimon
06:47 queued 03:57
created
tools/gendocs.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 
4 4
 use GraphQL\Utils\Utils;
5 5
 
6
-$outputFile = __DIR__  . '/../docs/reference.md';
6
+$outputFile = __DIR__ . '/../docs/reference.md';
7 7
 
8 8
 $entries = [
9 9
     \GraphQL\GraphQL::class,
Please login to merge, or discard this patch.
src/Server/OperationParams.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
 
90 90
         // Some parameters could be provided as serialized JSON.
91 91
         foreach (['extensions', 'variables'] as $param) {
92
-            if (! is_string($params[$param])) {
92
+            if (!is_string($params[$param])) {
93 93
                 continue;
94 94
             }
95 95
 
Please login to merge, or discard this patch.
src/Server/ServerConfig.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $instance = new static();
46 46
         foreach ($config as $key => $value) {
47 47
             $method = 'set' . ucfirst($key);
48
-            if (! method_exists($instance, $method)) {
48
+            if (!method_exists($instance, $method)) {
49 49
                 throw new InvariantViolation(sprintf('Unknown server config option "%s"', $key));
50 50
             }
51 51
             $instance->$method($value);
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public function setValidationRules($validationRules)
168 168
     {
169
-        if (! is_callable($validationRules) && ! is_array($validationRules) && $validationRules !== null) {
169
+        if (!is_callable($validationRules) && !is_array($validationRules) && $validationRules !== null) {
170 170
             throw new InvariantViolation(
171 171
                 'Server config expects array of validation rules or callable returning such array, but got ' .
172 172
                 Utils::printSafe($validationRules)
Please login to merge, or discard this patch.
src/Server/StandardServer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
         if (is_array($config)) {
77 77
             $config = ServerConfig::create($config);
78 78
         }
79
-        if (! $config instanceof ServerConfig) {
79
+        if (!$config instanceof ServerConfig) {
80 80
             throw new InvariantViolation('Expecting valid server config, but got ' . Utils::printSafe($config));
81 81
         }
82 82
         $this->config = $config;
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.
src/Type/Definition/ObjectType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function __construct(array $config)
81 81
     {
82
-        if (! isset($config['name'])) {
82
+        if (!isset($config['name'])) {
83 83
             $config['name'] = $this->tryInferName();
84 84
         }
85 85
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
                 ? call_user_func($interfaces)
190 190
                 : $interfaces;
191 191
 
192
-            if ($interfaces !== null && ! is_array($interfaces)) {
192
+            if ($interfaces !== null && !is_array($interfaces)) {
193 193
                 throw new InvariantViolation(
194 194
                     sprintf('%s interfaces must be an Array or a callable which returns an Array.', $this->name)
195 195
                 );
Please login to merge, or discard this patch.
src/Type/Definition/UnionType.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function __construct(array $config)
35 35
     {
36
-        if (! isset($config['name'])) {
36
+        if (!isset($config['name'])) {
37 37
             $config['name'] = $this->tryInferName();
38 38
         }
39 39
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function isPossibleType(Type $type) : bool
55 55
     {
56
-        if (! $type instanceof ObjectType) {
56
+        if (!$type instanceof ObjectType) {
57 57
             return false;
58 58
         }
59 59
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function getTypes()
74 74
     {
75 75
         if ($this->types === null) {
76
-            if (! isset($this->config['types'])) {
76
+            if (!isset($this->config['types'])) {
77 77
                 $types = null;
78 78
             } elseif (is_callable($this->config['types'])) {
79 79
                 $types = call_user_func($this->config['types']);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                 $types = $this->config['types'];
82 82
             }
83 83
 
84
-            if (! is_array($types)) {
84
+            if (!is_array($types)) {
85 85
                 throw new InvariantViolation(
86 86
                     sprintf(
87 87
                         'Must provide Array of types or a callable which returns such an array for Union %s',
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     {
123 123
         parent::assertValid();
124 124
 
125
-        if (! isset($this->config['resolveType'])) {
125
+        if (!isset($this->config['resolveType'])) {
126 126
             return;
127 127
         }
128 128
 
Please login to merge, or discard this patch.
src/Type/Definition/FieldDefinition.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         if (is_callable($fields)) {
90 90
             $fields = $fields();
91 91
         }
92
-        if (! is_array($fields)) {
92
+        if (!is_array($fields)) {
93 93
             throw new InvariantViolation(
94 94
                 sprintf('%s fields must be an array or a callable which returns such an array.', $type->name)
95 95
             );
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
         $map = [];
98 98
         foreach ($fields as $name => $field) {
99 99
             if (is_array($field)) {
100
-                if (! isset($field['name'])) {
101
-                    if (! is_string($name)) {
100
+                if (!isset($field['name'])) {
101
+                    if (!is_string($name)) {
102 102
                         throw new InvariantViolation(
103 103
                             sprintf(
104 104
                                 '%s fields must be an associative array with field names as keys or a function which returns such an array.',
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
                     $field['name'] = $name;
111 111
                 }
112
-                if (isset($field['args']) && ! is_array($field['args'])) {
112
+                if (isset($field['args']) && !is_array($field['args'])) {
113 113
                     throw new InvariantViolation(
114 114
                         sprintf('%s.%s args must be an array.', $type->name, $name)
115 115
                     );
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             } elseif ($field instanceof self) {
119 119
                 $fieldDef = $field;
120 120
             } else {
121
-                if (! is_string($name) || ! $field) {
121
+                if (!is_string($name) || !$field) {
122 122
                     throw new InvariantViolation(
123 123
                         sprintf(
124 124
                             '%s.%s field config must be an array, but got: %s',
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             throw new InvariantViolation(sprintf('%s.%s: %s', $parentType->name, $this->name, $e->getMessage()));
210 210
         }
211 211
         Utils::invariant(
212
-            ! isset($this->config['isDeprecated']),
212
+            !isset($this->config['isDeprecated']),
213 213
             sprintf(
214 214
                 '%s.%s should provide "deprecationReason" instead of "isDeprecated".',
215 215
                 $parentType->name,
Please login to merge, or discard this patch.
src/Type/Definition/QueryPlan.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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])) {
Please login to merge, or discard this patch.