@@ -74,7 +74,7 @@ |
||
74 | 74 | if (is_array($config)) { |
75 | 75 | $config = ServerConfig::create($config); |
76 | 76 | } |
77 | - if (! $config instanceof ServerConfig) { |
|
77 | + if (!$config instanceof ServerConfig) { |
|
78 | 78 | throw new InvariantViolation('Expecting valid server config, but got ' . Utils::printSafe($config)); |
79 | 79 | } |
80 | 80 | $this->config = $config; |
@@ -82,7 +82,7 @@ |
||
82 | 82 | |
83 | 83 | if (is_string($params['variables'])) { |
84 | 84 | $tmp = json_decode($params['variables'], true); |
85 | - if (! json_last_error()) { |
|
85 | + if (!json_last_error()) { |
|
86 | 86 | $params['variables'] = $tmp; |
87 | 87 | } |
88 | 88 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | throw new RequestError('Could not parse JSON: ' . json_last_error_msg()); |
81 | 81 | } |
82 | 82 | |
83 | - if (! is_array($bodyParams)) { |
|
83 | + if (!is_array($bodyParams)) { |
|
84 | 84 | throw new RequestError( |
85 | 85 | 'GraphQL Server expects JSON object or array, but got ' . |
86 | 86 | Utils::printSafeJson($bodyParams) |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | public function validateOperationParams(OperationParams $params) |
143 | 143 | { |
144 | 144 | $errors = []; |
145 | - if (! $params->query && ! $params->queryId) { |
|
145 | + if (!$params->query && !$params->queryId) { |
|
146 | 146 | $errors[] = new RequestError('GraphQL Request must include at least one of those two parameters: "query" or "queryId"'); |
147 | 147 | } |
148 | 148 | |
@@ -150,28 +150,28 @@ discard block |
||
150 | 150 | $errors[] = new RequestError('GraphQL Request parameters "query" and "queryId" are mutually exclusive'); |
151 | 151 | } |
152 | 152 | |
153 | - if ($params->query !== null && (! is_string($params->query) || empty($params->query))) { |
|
153 | + if ($params->query !== null && (!is_string($params->query) || empty($params->query))) { |
|
154 | 154 | $errors[] = new RequestError( |
155 | 155 | 'GraphQL Request parameter "query" must be string, but got ' . |
156 | 156 | Utils::printSafeJson($params->query) |
157 | 157 | ); |
158 | 158 | } |
159 | 159 | |
160 | - if ($params->queryId !== null && (! is_string($params->queryId) || empty($params->queryId))) { |
|
160 | + if ($params->queryId !== null && (!is_string($params->queryId) || empty($params->queryId))) { |
|
161 | 161 | $errors[] = new RequestError( |
162 | 162 | 'GraphQL Request parameter "queryId" must be string, but got ' . |
163 | 163 | Utils::printSafeJson($params->queryId) |
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
167 | - if ($params->operation !== null && (! is_string($params->operation) || empty($params->operation))) { |
|
167 | + if ($params->operation !== null && (!is_string($params->operation) || empty($params->operation))) { |
|
168 | 168 | $errors[] = new RequestError( |
169 | 169 | 'GraphQL Request parameter "operation" must be string, but got ' . |
170 | 170 | Utils::printSafeJson($params->operation) |
171 | 171 | ); |
172 | 172 | } |
173 | 173 | |
174 | - if ($params->variables !== null && (! is_array($params->variables) || isset($params->variables[0]))) { |
|
174 | + if ($params->variables !== null && (!is_array($params->variables) || isset($params->variables[0]))) { |
|
175 | 175 | $errors[] = new RequestError( |
176 | 176 | 'GraphQL Request parameter "variables" must be object or JSON string parsed to object, but got ' . |
177 | 177 | Utils::printSafeJson($params->getOriginalInput('variables')) |
@@ -239,20 +239,20 @@ discard block |
||
239 | 239 | $isBatch = false |
240 | 240 | ) { |
241 | 241 | try { |
242 | - if (! $config->getSchema()) { |
|
242 | + if (!$config->getSchema()) { |
|
243 | 243 | throw new InvariantViolation('Schema is required for the server'); |
244 | 244 | } |
245 | 245 | |
246 | - if ($isBatch && ! $config->getQueryBatching()) { |
|
246 | + if ($isBatch && !$config->getQueryBatching()) { |
|
247 | 247 | throw new RequestError('Batched queries are not supported by this server'); |
248 | 248 | } |
249 | 249 | |
250 | 250 | $errors = $this->validateOperationParams($op); |
251 | 251 | |
252 | - if (! empty($errors)) { |
|
252 | + if (!empty($errors)) { |
|
253 | 253 | $errors = Utils::map( |
254 | 254 | $errors, |
255 | - function (RequestError $err) { |
|
255 | + function(RequestError $err) { |
|
256 | 256 | return Error::createLocatedError($err, null, null); |
257 | 257 | } |
258 | 258 | ); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | $doc = $op->queryId ? $this->loadPersistedQuery($config, $op) : $op->query; |
266 | 266 | |
267 | - if (! $doc instanceof DocumentNode) { |
|
267 | + if (!$doc instanceof DocumentNode) { |
|
268 | 268 | $doc = Parser::parse($doc); |
269 | 269 | } |
270 | 270 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | ); |
295 | 295 | } |
296 | 296 | |
297 | - $applyErrorHandling = function (ExecutionResult $result) use ($config) { |
|
297 | + $applyErrorHandling = function(ExecutionResult $result) use ($config) { |
|
298 | 298 | if ($config->getErrorsHandler()) { |
299 | 299 | $result->setErrorsHandler($config->getErrorsHandler()); |
300 | 300 | } |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | // Load query if we got persisted query id: |
323 | 323 | $loader = $config->getPersistentQueryLoader(); |
324 | 324 | |
325 | - if (! $loader) { |
|
325 | + if (!$loader) { |
|
326 | 326 | throw new RequestError('Persisted queries are not supported by this server'); |
327 | 327 | } |
328 | 328 | |
329 | 329 | $source = $loader($operationParams->queryId, $operationParams); |
330 | 330 | |
331 | - if (! is_string($source) && ! $source instanceof DocumentNode) { |
|
331 | + if (!is_string($source) && !$source instanceof DocumentNode) { |
|
332 | 332 | throw new InvariantViolation(sprintf( |
333 | 333 | 'Persistent query loader must return query string or instance of %s but got: %s', |
334 | 334 | DocumentNode::class, |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | if (is_callable($validationRules)) { |
356 | 356 | $validationRules = $validationRules($params, $doc, $operationType); |
357 | 357 | |
358 | - if (! is_array($validationRules)) { |
|
358 | + if (!is_array($validationRules)) { |
|
359 | 359 | throw new InvariantViolation(sprintf( |
360 | 360 | 'Expecting validation rules to be array or callable returning array, but got: %s', |
361 | 361 | Utils::printSafe($validationRules) |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | public function sendResponse($result, $exitWhenDone = false) |
411 | 411 | { |
412 | 412 | if ($result instanceof Promise) { |
413 | - $result->then(function ($actualResult) use ($exitWhenDone) { |
|
413 | + $result->then(function($actualResult) use ($exitWhenDone) { |
|
414 | 414 | $this->doSendResponse($actualResult, $exitWhenDone); |
415 | 415 | }); |
416 | 416 | } else { |
@@ -457,8 +457,8 @@ discard block |
||
457 | 457 | if (is_array($result) && isset($result[0])) { |
458 | 458 | Utils::each( |
459 | 459 | $result, |
460 | - function ($executionResult, $index) { |
|
461 | - if (! $executionResult instanceof ExecutionResult) { |
|
460 | + function($executionResult, $index) { |
|
461 | + if (!$executionResult instanceof ExecutionResult) { |
|
462 | 462 | throw new InvariantViolation(sprintf( |
463 | 463 | 'Expecting every entry of batched query result to be instance of %s but entry at position %d is %s', |
464 | 464 | ExecutionResult::class, |
@@ -470,14 +470,14 @@ discard block |
||
470 | 470 | ); |
471 | 471 | $httpStatus = 200; |
472 | 472 | } else { |
473 | - if (! $result instanceof ExecutionResult) { |
|
473 | + if (!$result instanceof ExecutionResult) { |
|
474 | 474 | throw new InvariantViolation(sprintf( |
475 | 475 | 'Expecting query result to be instance of %s but got %s', |
476 | 476 | ExecutionResult::class, |
477 | 477 | Utils::printSafe($result) |
478 | 478 | )); |
479 | 479 | } |
480 | - if ($result->data === null && ! empty($result->errors)) { |
|
480 | + if ($result->data === null && !empty($result->errors)) { |
|
481 | 481 | $httpStatus = 400; |
482 | 482 | } else { |
483 | 483 | $httpStatus = 200; |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | } else { |
502 | 502 | $contentType = $request->getHeader('content-type'); |
503 | 503 | |
504 | - if (! isset($contentType[0])) { |
|
504 | + if (!isset($contentType[0])) { |
|
505 | 505 | throw new RequestError('Missing "Content-Type" header'); |
506 | 506 | } |
507 | 507 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | ); |
517 | 517 | } |
518 | 518 | |
519 | - if (! is_array($bodyParams)) { |
|
519 | + if (!is_array($bodyParams)) { |
|
520 | 520 | throw new RequestError( |
521 | 521 | 'GraphQL Server expects JSON object or array, but got ' . |
522 | 522 | Utils::printSafeJson($bodyParams) |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | } else { |
526 | 526 | $bodyParams = $request->getParsedBody(); |
527 | 527 | |
528 | - if (! is_array($bodyParams)) { |
|
528 | + if (!is_array($bodyParams)) { |
|
529 | 529 | throw new RequestError('Unexpected content type: ' . Utils::printSafeJson($contentType[0])); |
530 | 530 | } |
531 | 531 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | public function toPsrResponse($result, ResponseInterface $response, StreamInterface $writableBodyStream) |
549 | 549 | { |
550 | 550 | if ($result instanceof Promise) { |
551 | - return $result->then(function ($actualResult) use ($response, $writableBodyStream) { |
|
551 | + return $result->then(function($actualResult) use ($response, $writableBodyStream) { |
|
552 | 552 | return $this->doConvertToPsrResponse($actualResult, $response, $writableBodyStream); |
553 | 553 | }); |
554 | 554 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $instance = new static(); |
44 | 44 | foreach ($config as $key => $value) { |
45 | 45 | $method = 'set' . ucfirst($key); |
46 | - if (! method_exists($instance, $method)) { |
|
46 | + if (!method_exists($instance, $method)) { |
|
47 | 47 | throw new InvariantViolation(sprintf('Unknown server config option "%s"', $key)); |
48 | 48 | } |
49 | 49 | $instance->$method($value); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function setValidationRules($validationRules) |
157 | 157 | { |
158 | - if (! is_callable($validationRules) && ! is_array($validationRules) && $validationRules !== null) { |
|
158 | + if (!is_callable($validationRules) && !is_array($validationRules) && $validationRules !== null) { |
|
159 | 159 | throw new InvariantViolation( |
160 | 160 | 'Server config expects array of validation rules or callable returning such array, but got ' . |
161 | 161 | Utils::printSafe($validationRules) |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if ($error->nodes) { |
66 | 66 | /** @var Node $node */ |
67 | 67 | foreach ($error->nodes as $node) { |
68 | - if (! $node->loc) { |
|
68 | + if (!$node->loc) { |
|
69 | 69 | continue; |
70 | 70 | } |
71 | 71 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - return ! $printedLocations |
|
88 | + return !$printedLocations |
|
89 | 89 | ? $error->getMessage() |
90 | 90 | : implode("\n\n", array_merge([$error->getMessage()], $printedLocations)) . "\n"; |
91 | 91 | } |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | if ($e instanceof Error) { |
190 | 190 | $locations = Utils::map( |
191 | 191 | $e->getLocations(), |
192 | - function (SourceLocation $loc) { |
|
192 | + function(SourceLocation $loc) { |
|
193 | 193 | return $loc->toSerializableArray(); |
194 | 194 | } |
195 | 195 | ); |
196 | - if (! empty($locations)) { |
|
196 | + if (!empty($locations)) { |
|
197 | 197 | $formattedError['locations'] = $locations; |
198 | 198 | } |
199 | - if (! empty($e->path)) { |
|
199 | + if (!empty($e->path)) { |
|
200 | 200 | $formattedError['path'] = $e->path; |
201 | 201 | } |
202 | - if (! empty($e->getExtensions())) { |
|
202 | + if (!empty($e->getExtensions())) { |
|
203 | 203 | $formattedError['extensions'] = $e->getExtensions(); |
204 | 204 | } |
205 | 205 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public static function addDebugEntries(array $formattedError, $e, $debug) |
225 | 225 | { |
226 | - if (! $debug) { |
|
226 | + if (!$debug) { |
|
227 | 227 | return $formattedError; |
228 | 228 | } |
229 | 229 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $debug = (int) $debug; |
237 | 237 | |
238 | 238 | if ($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) { |
239 | - if (! $e instanceof Error) { |
|
239 | + if (!$e instanceof Error) { |
|
240 | 240 | throw $e; |
241 | 241 | } |
242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
248 | - $isInternal = ! $e instanceof ClientAware || ! $e->isClientSafe(); |
|
248 | + $isInternal = !$e instanceof ClientAware || !$e->isClientSafe(); |
|
249 | 249 | |
250 | 250 | if (($debug & Debug::INCLUDE_DEBUG_MESSAGE) && $isInternal) { |
251 | 251 | // Displaying debugMessage as a first entry: |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | ]; |
261 | 261 | } |
262 | 262 | |
263 | - $isTrivial = $e instanceof Error && ! $e->getPrevious(); |
|
263 | + $isTrivial = $e instanceof Error && !$e->getPrevious(); |
|
264 | 264 | |
265 | - if (! $isTrivial) { |
|
265 | + if (!$isTrivial) { |
|
266 | 266 | $debugging = $e->getPrevious() ?: $e; |
267 | 267 | $formattedError['trace'] = static::toSafeTrace($debugging); |
268 | 268 | } |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | */ |
281 | 281 | public static function prepareFormatter(?callable $formatter = null, $debug) |
282 | 282 | { |
283 | - $formatter = $formatter ?: function ($e) { |
|
283 | + $formatter = $formatter ?: function($e) { |
|
284 | 284 | return FormattedError::createFromException($e); |
285 | 285 | }; |
286 | 286 | if ($debug) { |
287 | - $formatter = function ($e) use ($formatter, $debug) { |
|
287 | + $formatter = function($e) use ($formatter, $debug) { |
|
288 | 288 | return FormattedError::addDebugEntries($formatter($e), $e, $debug); |
289 | 289 | }; |
290 | 290 | } |
@@ -307,18 +307,18 @@ discard block |
||
307 | 307 | // Remove invariant entries as they don't provide much value: |
308 | 308 | ($trace[0]['class'] . '::' . $trace[0]['function'] === 'GraphQL\Utils\Utils::invariant')) { |
309 | 309 | array_shift($trace); |
310 | - } elseif (! isset($trace[0]['file'])) { |
|
310 | + } elseif (!isset($trace[0]['file'])) { |
|
311 | 311 | // Remove root call as it's likely error handler trace: |
312 | 312 | array_shift($trace); |
313 | 313 | } |
314 | 314 | |
315 | 315 | return array_map( |
316 | - function ($err) { |
|
316 | + function($err) { |
|
317 | 317 | $safeErr = array_intersect_key($err, ['file' => true, 'line' => true]); |
318 | 318 | |
319 | 319 | if (isset($err['function'])) { |
320 | 320 | $func = $err['function']; |
321 | - $args = ! empty($err['args']) ? array_map([__CLASS__, 'printVar'], $err['args']) : []; |
|
321 | + $args = !empty($err['args']) ? array_map([__CLASS__, 'printVar'], $err['args']) : []; |
|
322 | 322 | $funcStr = $func . '(' . implode(', ', $args) . ')'; |
323 | 323 | |
324 | 324 | if (isset($err['class'])) { |
@@ -384,9 +384,9 @@ discard block |
||
384 | 384 | { |
385 | 385 | $formatted = ['message' => $error]; |
386 | 386 | |
387 | - if (! empty($locations)) { |
|
387 | + if (!empty($locations)) { |
|
388 | 388 | $formatted['locations'] = array_map( |
389 | - function ($loc) { |
|
389 | + function($loc) { |
|
390 | 390 | return $loc->toArray(); |
391 | 391 | }, |
392 | 392 | $locations |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | // Compute list of blame nodes. |
103 | 103 | if ($nodes instanceof \Traversable) { |
104 | 104 | $nodes = iterator_to_array($nodes); |
105 | - } elseif ($nodes && ! is_array($nodes)) { |
|
105 | + } elseif ($nodes && !is_array($nodes)) { |
|
106 | 106 | $nodes = [$nodes]; |
107 | 107 | } |
108 | 108 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | public function getSource() |
208 | 208 | { |
209 | 209 | if ($this->source === null) { |
210 | - if (! empty($this->nodes[0]) && ! empty($this->nodes[0]->loc)) { |
|
210 | + if (!empty($this->nodes[0]) && !empty($this->nodes[0]->loc)) { |
|
211 | 211 | $this->source = $this->nodes[0]->loc->source; |
212 | 212 | } |
213 | 213 | } |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function getPositions() |
222 | 222 | { |
223 | - if ($this->positions === null && ! empty($this->nodes)) { |
|
223 | + if ($this->positions === null && !empty($this->nodes)) { |
|
224 | 224 | $positions = array_map( |
225 | - function ($node) { |
|
225 | + function($node) { |
|
226 | 226 | return isset($node->loc) ? $node->loc->start : null; |
227 | 227 | }, |
228 | 228 | $this->nodes |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | $this->positions = array_filter( |
232 | 232 | $positions, |
233 | - function ($p) { |
|
233 | + function($p) { |
|
234 | 234 | return $p !== null; |
235 | 235 | } |
236 | 236 | ); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | if ($positions && $source) { |
264 | 264 | $this->locations = array_map( |
265 | - function ($pos) use ($source) { |
|
265 | + function($pos) use ($source) { |
|
266 | 266 | return $source->getLocation($pos); |
267 | 267 | }, |
268 | 268 | $positions |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | } elseif ($nodes) { |
271 | 271 | $this->locations = array_filter( |
272 | 272 | array_map( |
273 | - function ($node) { |
|
273 | + function($node) { |
|
274 | 274 | if ($node->loc) { |
275 | 275 | return $node->loc->source->getLocation($node->loc->start); |
276 | 276 | } |
@@ -328,18 +328,18 @@ discard block |
||
328 | 328 | |
329 | 329 | $locations = Utils::map( |
330 | 330 | $this->getLocations(), |
331 | - function (SourceLocation $loc) { |
|
331 | + function(SourceLocation $loc) { |
|
332 | 332 | return $loc->toSerializableArray(); |
333 | 333 | } |
334 | 334 | ); |
335 | 335 | |
336 | - if (! empty($locations)) { |
|
336 | + if (!empty($locations)) { |
|
337 | 337 | $arr['locations'] = $locations; |
338 | 338 | } |
339 | - if (! empty($this->path)) { |
|
339 | + if (!empty($this->path)) { |
|
340 | 340 | $arr['path'] = $this->path; |
341 | 341 | } |
342 | - if (! empty($this->extensions)) { |
|
342 | + if (!empty($this->extensions)) { |
|
343 | 343 | $arr['extensions'] = $this->extensions; |
344 | 344 | } |
345 | 345 |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | { |
98 | 98 | $usages = $this->recursiveVariableUsages[$operation] ?? null; |
99 | 99 | |
100 | - if (! $usages) { |
|
100 | + if (!$usages) { |
|
101 | 101 | $usages = $this->getVariableUsages($operation); |
102 | 102 | $fragments = $this->getRecursivelyReferencedFragments($operation); |
103 | 103 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | { |
120 | 120 | $usages = $this->variableUsages[$node] ?? null; |
121 | 121 | |
122 | - if (! $usages) { |
|
122 | + if (!$usages) { |
|
123 | 123 | $newUsages = []; |
124 | 124 | $typeInfo = new TypeInfo($this->schema); |
125 | 125 | Visitor::visit( |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | Visitor::visitWithTypeInfo( |
128 | 128 | $typeInfo, |
129 | 129 | [ |
130 | - NodeKind::VARIABLE_DEFINITION => function () { |
|
130 | + NodeKind::VARIABLE_DEFINITION => function() { |
|
131 | 131 | return false; |
132 | 132 | }, |
133 | - NodeKind::VARIABLE => function (VariableNode $variable) use ( |
|
133 | + NodeKind::VARIABLE => function(VariableNode $variable) use ( |
|
134 | 134 | &$newUsages, |
135 | 135 | $typeInfo |
136 | 136 | ) { |
@@ -153,23 +153,23 @@ discard block |
||
153 | 153 | { |
154 | 154 | $fragments = $this->recursivelyReferencedFragments[$operation] ?? null; |
155 | 155 | |
156 | - if (! $fragments) { |
|
156 | + if (!$fragments) { |
|
157 | 157 | $fragments = []; |
158 | 158 | $collectedNames = []; |
159 | 159 | $nodesToVisit = [$operation]; |
160 | - while (! empty($nodesToVisit)) { |
|
160 | + while (!empty($nodesToVisit)) { |
|
161 | 161 | $node = array_pop($nodesToVisit); |
162 | 162 | $spreads = $this->getFragmentSpreads($node); |
163 | 163 | for ($i = 0; $i < count($spreads); $i++) { |
164 | 164 | $fragName = $spreads[$i]->name->value; |
165 | 165 | |
166 | - if (! empty($collectedNames[$fragName])) { |
|
166 | + if (!empty($collectedNames[$fragName])) { |
|
167 | 167 | continue; |
168 | 168 | } |
169 | 169 | |
170 | 170 | $collectedNames[$fragName] = true; |
171 | 171 | $fragment = $this->getFragment($fragName); |
172 | - if (! $fragment) { |
|
172 | + if (!$fragment) { |
|
173 | 173 | continue; |
174 | 174 | } |
175 | 175 | |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | public function getFragmentSpreads(HasSelectionSet $node) |
190 | 190 | { |
191 | 191 | $spreads = $this->fragmentSpreads[$node] ?? null; |
192 | - if (! $spreads) { |
|
192 | + if (!$spreads) { |
|
193 | 193 | $spreads = []; |
194 | 194 | $setsToVisit = [$node->selectionSet]; |
195 | - while (! empty($setsToVisit)) { |
|
195 | + while (!empty($setsToVisit)) { |
|
196 | 196 | $set = array_pop($setsToVisit); |
197 | 197 | |
198 | 198 | for ($i = 0; $i < count($set->selections); $i++) { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | public function getFragment($name) |
218 | 218 | { |
219 | 219 | $fragments = $this->fragments; |
220 | - if (! $fragments) { |
|
220 | + if (!$fragments) { |
|
221 | 221 | $fragments = []; |
222 | 222 | foreach ($this->getDocument()->definitions as $statement) { |
223 | 223 | if ($statement->kind !== NodeKind::FRAGMENT_DEFINITION) { |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | |
26 | 26 | return [ |
27 | 27 | NodeKind::OPERATION_DEFINITION => [ |
28 | - 'enter' => function () use (&$variableNameDefined) { |
|
28 | + 'enter' => function() use (&$variableNameDefined) { |
|
29 | 29 | $variableNameDefined = []; |
30 | 30 | }, |
31 | - 'leave' => function (OperationDefinitionNode $operation) use (&$variableNameDefined, $context) { |
|
31 | + 'leave' => function(OperationDefinitionNode $operation) use (&$variableNameDefined, $context) { |
|
32 | 32 | $usages = $context->getRecursiveVariableUsages($operation); |
33 | 33 | |
34 | 34 | foreach ($usages as $usage) { |
35 | 35 | $node = $usage['node']; |
36 | 36 | $varName = $node->name->value; |
37 | 37 | |
38 | - if (! empty($variableNameDefined[$varName])) { |
|
38 | + if (!empty($variableNameDefined[$varName])) { |
|
39 | 39 | continue; |
40 | 40 | } |
41 | 41 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | }, |
51 | 51 | ], |
52 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $def) use (&$variableNameDefined) { |
|
52 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $def) use (&$variableNameDefined) { |
|
53 | 53 | $variableNameDefined[$def->variable->name->value] = true; |
54 | 54 | }, |
55 | 55 | ]; |
@@ -18,11 +18,11 @@ |
||
18 | 18 | public function getVisitor(ValidationContext $context) |
19 | 19 | { |
20 | 20 | return [ |
21 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $node) use ($context) { |
|
21 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $node) use ($context) { |
|
22 | 22 | $type = TypeInfo::typeFromAST($context->getSchema(), $node->type); |
23 | 23 | |
24 | 24 | // If the variable type is not an input type, return an error. |
25 | - if (! $type || Type::isInputType($type)) { |
|
25 | + if (!$type || Type::isInputType($type)) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 |