@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $suggestions = Utils::suggestionList( |
99 | 99 | Utils::printSafe($value), |
100 | 100 | array_map( |
101 | - static function ($enumValue) { |
|
101 | + static function($enumValue) { |
|
102 | 102 | return $enumValue->name; |
103 | 103 | }, |
104 | 104 | $type->getValues() |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | if ($type instanceof InputObjectType) { |
150 | - if (! is_object($value) && ! is_array($value) && ! $value instanceof Traversable) { |
|
150 | + if (!is_object($value) && !is_array($value) && !$value instanceof Traversable) { |
|
151 | 151 | return self::ofErrors([ |
152 | 152 | self::coercionError( |
153 | 153 | sprintf('Expected type %s to be an object', $type->name), |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $pathStr = ''; |
271 | 271 | $currentPath = $path; |
272 | 272 | while ($currentPath) { |
273 | - $pathStr = |
|
273 | + $pathStr = |
|
274 | 274 | (is_string($currentPath['key']) |
275 | 275 | ? '.' . $currentPath['key'] |
276 | 276 | : '[' . $currentPath['key'] . ']') . $pathStr; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $this->parentTypeStack = []; |
75 | 75 | $this->inputTypeStack = []; |
76 | 76 | $this->fieldDefStack = []; |
77 | - if (! $initialType) { |
|
77 | + if (!$initialType) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | if (Type::isCompositeType($initialType)) { |
85 | 85 | $this->parentTypeStack[] = $initialType; |
86 | 86 | } |
87 | - if (! Type::isOutputType($initialType)) { |
|
87 | + if (!Type::isOutputType($initialType)) { |
|
88 | 88 | return; |
89 | 89 | } |
90 | 90 | |
@@ -133,17 +133,17 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public static function extractTypes($type, ?array $typeMap = null) |
135 | 135 | { |
136 | - if (! $typeMap) { |
|
136 | + if (!$typeMap) { |
|
137 | 137 | $typeMap = []; |
138 | 138 | } |
139 | - if (! $type) { |
|
139 | + if (!$type) { |
|
140 | 140 | return $typeMap; |
141 | 141 | } |
142 | 142 | |
143 | 143 | if ($type instanceof WrappingType) { |
144 | 144 | return self::extractTypes($type->getWrappedType(true), $typeMap); |
145 | 145 | } |
146 | - if (! $type instanceof Type) { |
|
146 | + if (!$type instanceof Type) { |
|
147 | 147 | // Preserve these invalid types in map (at numeric index) to make them |
148 | 148 | // detectable during $schema->validate() |
149 | 149 | $i = 0; |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | $alreadyInMap = $alreadyInMap || $typeMap[$i] === $type; |
153 | 153 | $i++; |
154 | 154 | } |
155 | - if (! $alreadyInMap) { |
|
155 | + if (!$alreadyInMap) { |
|
156 | 156 | $typeMap[$i] = $type; |
157 | 157 | } |
158 | 158 | return $typeMap; |
159 | 159 | } |
160 | 160 | |
161 | - if (! empty($typeMap[$type->name])) { |
|
161 | + if (!empty($typeMap[$type->name])) { |
|
162 | 162 | Utils::invariant( |
163 | 163 | $typeMap[$type->name] === $type, |
164 | 164 | sprintf('Schema must contain unique named types but contains multiple types named "%s" ', $type) . |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | } |
180 | 180 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
181 | 181 | foreach ((array) $type->getFields() as $fieldName => $field) { |
182 | - if (! empty($field->args)) { |
|
182 | + if (!empty($field->args)) { |
|
183 | 183 | $fieldArgTypes = array_map( |
184 | - static function (FieldArgument $arg) { |
|
184 | + static function(FieldArgument $arg) { |
|
185 | 185 | return $arg->getType(); |
186 | 186 | }, |
187 | 187 | $field->args |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | if ($fieldOrDirective) { |
313 | 313 | $argDef = Utils::find( |
314 | 314 | $fieldOrDirective->args, |
315 | - static function ($arg) use ($node) { |
|
315 | + static function($arg) use ($node) { |
|
316 | 316 | return $arg->name === $node->name->value; |
317 | 317 | } |
318 | 318 | ); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | */ |
361 | 361 | public function getType() |
362 | 362 | { |
363 | - if (! empty($this->typeStack)) { |
|
363 | + if (!empty($this->typeStack)) { |
|
364 | 364 | return $this->typeStack[count($this->typeStack) - 1]; |
365 | 365 | } |
366 | 366 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function getParentType() |
374 | 374 | { |
375 | - if (! empty($this->parentTypeStack)) { |
|
375 | + if (!empty($this->parentTypeStack)) { |
|
376 | 376 | return $this->parentTypeStack[count($this->parentTypeStack) - 1]; |
377 | 377 | } |
378 | 378 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | */ |
438 | 438 | public function getFieldDef() |
439 | 439 | { |
440 | - if (! empty($this->fieldDefStack)) { |
|
440 | + if (!empty($this->fieldDefStack)) { |
|
441 | 441 | return $this->fieldDefStack[count($this->fieldDefStack) - 1]; |
442 | 442 | } |
443 | 443 | |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | */ |
450 | 450 | public function getInputType() |
451 | 451 | { |
452 | - if (! empty($this->inputTypeStack)) { |
|
452 | + if (!empty($this->inputTypeStack)) { |
|
453 | 453 | return $this->inputTypeStack[count($this->inputTypeStack) - 1]; |
454 | 454 | } |
455 | 455 |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | // Compute list of blame nodes. |
107 | 107 | if ($nodes instanceof Traversable) { |
108 | 108 | $nodes = iterator_to_array($nodes); |
109 | - } elseif ($nodes && ! is_array($nodes)) { |
|
109 | + } elseif ($nodes && !is_array($nodes)) { |
|
110 | 110 | $nodes = [$nodes]; |
111 | 111 | } |
112 | 112 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | public function getSource() |
213 | 213 | { |
214 | 214 | if ($this->source === null) { |
215 | - if (! empty($this->nodes[0]) && ! empty($this->nodes[0]->loc)) { |
|
215 | + if (!empty($this->nodes[0]) && !empty($this->nodes[0]->loc)) { |
|
216 | 216 | $this->source = $this->nodes[0]->loc->source; |
217 | 217 | } |
218 | 218 | } |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function getPositions() |
227 | 227 | { |
228 | - if ($this->positions === null && ! empty($this->nodes)) { |
|
228 | + if ($this->positions === null && !empty($this->nodes)) { |
|
229 | 229 | $positions = array_map( |
230 | - static function ($node) { |
|
230 | + static function($node) { |
|
231 | 231 | return isset($node->loc) ? $node->loc->start : null; |
232 | 232 | }, |
233 | 233 | $this->nodes |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | $positions = array_filter( |
237 | 237 | $positions, |
238 | - static function ($p) { |
|
238 | + static function($p) { |
|
239 | 239 | return $p !== null; |
240 | 240 | } |
241 | 241 | ); |
@@ -270,15 +270,15 @@ discard block |
||
270 | 270 | |
271 | 271 | if ($positions && $source) { |
272 | 272 | $this->locations = array_map( |
273 | - static function ($pos) use ($source) { |
|
273 | + static function($pos) use ($source) { |
|
274 | 274 | return $source->getLocation($pos); |
275 | 275 | }, |
276 | 276 | $positions |
277 | 277 | ); |
278 | 278 | } elseif ($nodes) { |
279 | - $locations = array_filter( |
|
279 | + $locations = array_filter( |
|
280 | 280 | array_map( |
281 | - static function ($node) { |
|
281 | + static function($node) { |
|
282 | 282 | if ($node->loc && $node->loc->source) { |
283 | 283 | return $node->loc->source->getLocation($node->loc->start); |
284 | 284 | } |
@@ -339,18 +339,18 @@ discard block |
||
339 | 339 | |
340 | 340 | $locations = Utils::map( |
341 | 341 | $this->getLocations(), |
342 | - static function (SourceLocation $loc) { |
|
342 | + static function(SourceLocation $loc) { |
|
343 | 343 | return $loc->toSerializableArray(); |
344 | 344 | } |
345 | 345 | ); |
346 | 346 | |
347 | - if (! empty($locations)) { |
|
347 | + if (!empty($locations)) { |
|
348 | 348 | $arr['locations'] = $locations; |
349 | 349 | } |
350 | - if (! empty($this->path)) { |
|
350 | + if (!empty($this->path)) { |
|
351 | 351 | $arr['path'] = $this->path; |
352 | 352 | } |
353 | - if (! empty($this->extensions)) { |
|
353 | + if (!empty($this->extensions)) { |
|
354 | 354 | $arr['extensions'] = $this->extensions; |
355 | 355 | } |
356 | 356 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if ($error->nodes) { |
71 | 71 | /** @var Node $node */ |
72 | 72 | foreach ($error->nodes as $node) { |
73 | - if (! $node->loc) { |
|
73 | + if (!$node->loc) { |
|
74 | 74 | continue; |
75 | 75 | } |
76 | 76 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | - return ! $printedLocations |
|
93 | + return !$printedLocations |
|
94 | 94 | ? $error->getMessage() |
95 | 95 | : implode("\n\n", array_merge([$error->getMessage()], $printedLocations)) . "\n"; |
96 | 96 | } |
@@ -203,17 +203,17 @@ discard block |
||
203 | 203 | if ($e instanceof Error) { |
204 | 204 | $locations = Utils::map( |
205 | 205 | $e->getLocations(), |
206 | - static function (SourceLocation $loc) { |
|
206 | + static function(SourceLocation $loc) { |
|
207 | 207 | return $loc->toSerializableArray(); |
208 | 208 | } |
209 | 209 | ); |
210 | - if (! empty($locations)) { |
|
210 | + if (!empty($locations)) { |
|
211 | 211 | $formattedError['locations'] = $locations; |
212 | 212 | } |
213 | - if (! empty($e->path)) { |
|
213 | + if (!empty($e->path)) { |
|
214 | 214 | $formattedError['path'] = $e->path; |
215 | 215 | } |
216 | - if (! empty($e->getExtensions())) { |
|
216 | + if (!empty($e->getExtensions())) { |
|
217 | 217 | $formattedError['extensions'] = $e->getExtensions() + $formattedError['extensions']; |
218 | 218 | } |
219 | 219 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public static function addDebugEntries(array $formattedError, $e, $debug) |
241 | 241 | { |
242 | - if (! $debug) { |
|
242 | + if (!$debug) { |
|
243 | 243 | return $formattedError; |
244 | 244 | } |
245 | 245 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $debug = (int) $debug; |
253 | 253 | |
254 | 254 | if ($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) { |
255 | - if (! $e instanceof Error) { |
|
255 | + if (!$e instanceof Error) { |
|
256 | 256 | throw $e; |
257 | 257 | } |
258 | 258 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | - $isUnsafe = ! $e instanceof ClientAware || ! $e->isClientSafe(); |
|
264 | + $isUnsafe = !$e instanceof ClientAware || !$e->isClientSafe(); |
|
265 | 265 | |
266 | 266 | if (($debug & Debug::RETHROW_UNSAFE_EXCEPTIONS) && $isUnsafe) { |
267 | 267 | if ($e->getPrevious()) { |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | ]; |
283 | 283 | } |
284 | 284 | |
285 | - $isTrivial = $e instanceof Error && ! $e->getPrevious(); |
|
285 | + $isTrivial = $e instanceof Error && !$e->getPrevious(); |
|
286 | 286 | |
287 | - if (! $isTrivial) { |
|
287 | + if (!$isTrivial) { |
|
288 | 288 | $debugging = $e->getPrevious() ?: $e; |
289 | 289 | $formattedError['trace'] = static::toSafeTrace($debugging); |
290 | 290 | } |
@@ -303,11 +303,11 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public static function prepareFormatter(?callable $formatter = null, $debug) |
305 | 305 | { |
306 | - $formatter = $formatter ?: static function ($e) { |
|
306 | + $formatter = $formatter ?: static function($e) { |
|
307 | 307 | return FormattedError::createFromException($e); |
308 | 308 | }; |
309 | 309 | if ($debug) { |
310 | - $formatter = static function ($e) use ($formatter, $debug) { |
|
310 | + $formatter = static function($e) use ($formatter, $debug) { |
|
311 | 311 | return FormattedError::addDebugEntries($formatter($e), $e, $debug); |
312 | 312 | }; |
313 | 313 | } |
@@ -332,18 +332,18 @@ discard block |
||
332 | 332 | // Remove invariant entries as they don't provide much value: |
333 | 333 | ($trace[0]['class'] . '::' . $trace[0]['function'] === 'GraphQL\Utils\Utils::invariant')) { |
334 | 334 | array_shift($trace); |
335 | - } elseif (! isset($trace[0]['file'])) { |
|
335 | + } elseif (!isset($trace[0]['file'])) { |
|
336 | 336 | // Remove root call as it's likely error handler trace: |
337 | 337 | array_shift($trace); |
338 | 338 | } |
339 | 339 | |
340 | 340 | return array_map( |
341 | - static function ($err) { |
|
341 | + static function($err) { |
|
342 | 342 | $safeErr = array_intersect_key($err, ['file' => true, 'line' => true]); |
343 | 343 | |
344 | 344 | if (isset($err['function'])) { |
345 | 345 | $func = $err['function']; |
346 | - $args = ! empty($err['args']) ? array_map([self::class, 'printVar'], $err['args']) : []; |
|
346 | + $args = !empty($err['args']) ? array_map([self::class, 'printVar'], $err['args']) : []; |
|
347 | 347 | $funcStr = $func . '(' . implode(', ', $args) . ')'; |
348 | 348 | |
349 | 349 | if (isset($err['class'])) { |
@@ -412,9 +412,9 @@ discard block |
||
412 | 412 | { |
413 | 413 | $formatted = ['message' => $error]; |
414 | 414 | |
415 | - if (! empty($locations)) { |
|
415 | + if (!empty($locations)) { |
|
416 | 416 | $formatted['locations'] = array_map( |
417 | - static function ($loc) { |
|
417 | + static function($loc) { |
|
418 | 418 | return $loc->toArray(); |
419 | 419 | }, |
420 | 420 | $locations |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | throw new RequestError('Could not parse JSON: ' . json_last_error_msg()); |
84 | 84 | } |
85 | 85 | |
86 | - if (! is_array($bodyParams)) { |
|
86 | + if (!is_array($bodyParams)) { |
|
87 | 87 | throw new RequestError( |
88 | 88 | 'GraphQL Server expects JSON object or array, but got ' . |
89 | 89 | Utils::printSafeJson($bodyParams) |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | public function validateOperationParams(OperationParams $params) |
150 | 150 | { |
151 | 151 | $errors = []; |
152 | - if (! $params->query && ! $params->queryId) { |
|
152 | + if (!$params->query && !$params->queryId) { |
|
153 | 153 | $errors[] = new RequestError('GraphQL Request must include at least one of those two parameters: "query" or "queryId"'); |
154 | 154 | } |
155 | 155 | |
@@ -157,28 +157,28 @@ discard block |
||
157 | 157 | $errors[] = new RequestError('GraphQL Request parameters "query" and "queryId" are mutually exclusive'); |
158 | 158 | } |
159 | 159 | |
160 | - if ($params->query !== null && (! is_string($params->query) || empty($params->query))) { |
|
160 | + if ($params->query !== null && (!is_string($params->query) || empty($params->query))) { |
|
161 | 161 | $errors[] = new RequestError( |
162 | 162 | 'GraphQL Request parameter "query" must be string, but got ' . |
163 | 163 | Utils::printSafeJson($params->query) |
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
167 | - if ($params->queryId !== null && (! is_string($params->queryId) || empty($params->queryId))) { |
|
167 | + if ($params->queryId !== null && (!is_string($params->queryId) || empty($params->queryId))) { |
|
168 | 168 | $errors[] = new RequestError( |
169 | 169 | 'GraphQL Request parameter "queryId" must be string, but got ' . |
170 | 170 | Utils::printSafeJson($params->queryId) |
171 | 171 | ); |
172 | 172 | } |
173 | 173 | |
174 | - if ($params->operation !== null && (! is_string($params->operation) || empty($params->operation))) { |
|
174 | + if ($params->operation !== null && (!is_string($params->operation) || empty($params->operation))) { |
|
175 | 175 | $errors[] = new RequestError( |
176 | 176 | 'GraphQL Request parameter "operation" must be string, but got ' . |
177 | 177 | Utils::printSafeJson($params->operation) |
178 | 178 | ); |
179 | 179 | } |
180 | 180 | |
181 | - if ($params->variables !== null && (! is_array($params->variables) || isset($params->variables[0]))) { |
|
181 | + if ($params->variables !== null && (!is_array($params->variables) || isset($params->variables[0]))) { |
|
182 | 182 | $errors[] = new RequestError( |
183 | 183 | 'GraphQL Request parameter "variables" must be object or JSON string parsed to object, but got ' . |
184 | 184 | Utils::printSafeJson($params->getOriginalInput('variables')) |
@@ -249,20 +249,20 @@ discard block |
||
249 | 249 | $isBatch = false |
250 | 250 | ) { |
251 | 251 | try { |
252 | - if (! $config->getSchema()) { |
|
252 | + if (!$config->getSchema()) { |
|
253 | 253 | throw new InvariantViolation('Schema is required for the server'); |
254 | 254 | } |
255 | 255 | |
256 | - if ($isBatch && ! $config->getQueryBatching()) { |
|
256 | + if ($isBatch && !$config->getQueryBatching()) { |
|
257 | 257 | throw new RequestError('Batched queries are not supported by this server'); |
258 | 258 | } |
259 | 259 | |
260 | 260 | $errors = $this->validateOperationParams($op); |
261 | 261 | |
262 | - if (! empty($errors)) { |
|
262 | + if (!empty($errors)) { |
|
263 | 263 | $errors = Utils::map( |
264 | 264 | $errors, |
265 | - static function (RequestError $err) { |
|
265 | + static function(RequestError $err) { |
|
266 | 266 | return Error::createLocatedError($err, null, null); |
267 | 267 | } |
268 | 268 | ); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | $doc = $op->queryId ? $this->loadPersistedQuery($config, $op) : $op->query; |
276 | 276 | |
277 | - if (! $doc instanceof DocumentNode) { |
|
277 | + if (!$doc instanceof DocumentNode) { |
|
278 | 278 | $doc = Parser::parse($doc); |
279 | 279 | } |
280 | 280 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | ); |
305 | 305 | } |
306 | 306 | |
307 | - $applyErrorHandling = static function (ExecutionResult $result) use ($config) { |
|
307 | + $applyErrorHandling = static function(ExecutionResult $result) use ($config) { |
|
308 | 308 | if ($config->getErrorsHandler()) { |
309 | 309 | $result->setErrorsHandler($config->getErrorsHandler()); |
310 | 310 | } |
@@ -333,13 +333,13 @@ discard block |
||
333 | 333 | // Load query if we got persisted query id: |
334 | 334 | $loader = $config->getPersistentQueryLoader(); |
335 | 335 | |
336 | - if (! $loader) { |
|
336 | + if (!$loader) { |
|
337 | 337 | throw new RequestError('Persisted queries are not supported by this server'); |
338 | 338 | } |
339 | 339 | |
340 | 340 | $source = $loader($operationParams->queryId, $operationParams); |
341 | 341 | |
342 | - if (! is_string($source) && ! $source instanceof DocumentNode) { |
|
342 | + if (!is_string($source) && !$source instanceof DocumentNode) { |
|
343 | 343 | throw new InvariantViolation(sprintf( |
344 | 344 | 'Persistent query loader must return query string or instance of %s but got: %s', |
345 | 345 | DocumentNode::class, |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | if (is_callable($validationRules)) { |
368 | 368 | $validationRules = $validationRules($params, $doc, $operationType); |
369 | 369 | |
370 | - if (! is_array($validationRules)) { |
|
370 | + if (!is_array($validationRules)) { |
|
371 | 371 | throw new InvariantViolation(sprintf( |
372 | 372 | 'Expecting validation rules to be array or callable returning array, but got: %s', |
373 | 373 | Utils::printSafe($validationRules) |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | public function sendResponse($result, $exitWhenDone = false) |
426 | 426 | { |
427 | 427 | if ($result instanceof Promise) { |
428 | - $result->then(function ($actualResult) use ($exitWhenDone) { |
|
428 | + $result->then(function($actualResult) use ($exitWhenDone) { |
|
429 | 429 | $this->doSendResponse($actualResult, $exitWhenDone); |
430 | 430 | }); |
431 | 431 | } else { |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | if (is_array($result) && isset($result[0])) { |
474 | 474 | Utils::each( |
475 | 475 | $result, |
476 | - static function ($executionResult, $index) { |
|
477 | - if (! $executionResult instanceof ExecutionResult) { |
|
476 | + static function($executionResult, $index) { |
|
477 | + if (!$executionResult instanceof ExecutionResult) { |
|
478 | 478 | throw new InvariantViolation(sprintf( |
479 | 479 | 'Expecting every entry of batched query result to be instance of %s but entry at position %d is %s', |
480 | 480 | ExecutionResult::class, |
@@ -486,14 +486,14 @@ discard block |
||
486 | 486 | ); |
487 | 487 | $httpStatus = 200; |
488 | 488 | } else { |
489 | - if (! $result instanceof ExecutionResult) { |
|
489 | + if (!$result instanceof ExecutionResult) { |
|
490 | 490 | throw new InvariantViolation(sprintf( |
491 | 491 | 'Expecting query result to be instance of %s but got %s', |
492 | 492 | ExecutionResult::class, |
493 | 493 | Utils::printSafe($result) |
494 | 494 | )); |
495 | 495 | } |
496 | - if ($result->data === null && ! empty($result->errors)) { |
|
496 | + if ($result->data === null && !empty($result->errors)) { |
|
497 | 497 | $httpStatus = 400; |
498 | 498 | } else { |
499 | 499 | $httpStatus = 200; |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | } else { |
520 | 520 | $contentType = $request->getHeader('content-type'); |
521 | 521 | |
522 | - if (! isset($contentType[0])) { |
|
522 | + if (!isset($contentType[0])) { |
|
523 | 523 | throw new RequestError('Missing "Content-Type" header'); |
524 | 524 | } |
525 | 525 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | ); |
535 | 535 | } |
536 | 536 | |
537 | - if (! is_array($bodyParams)) { |
|
537 | + if (!is_array($bodyParams)) { |
|
538 | 538 | throw new RequestError( |
539 | 539 | 'GraphQL Server expects JSON object or array, but got ' . |
540 | 540 | Utils::printSafeJson($bodyParams) |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | } else { |
544 | 544 | $bodyParams = $request->getParsedBody(); |
545 | 545 | |
546 | - if (! is_array($bodyParams)) { |
|
546 | + if (!is_array($bodyParams)) { |
|
547 | 547 | throw new RequestError('Unexpected content type: ' . Utils::printSafeJson($contentType[0])); |
548 | 548 | } |
549 | 549 | } |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | public function toPsrResponse($result, ResponseInterface $response, StreamInterface $writableBodyStream) |
569 | 569 | { |
570 | 570 | if ($result instanceof Promise) { |
571 | - return $result->then(function ($actualResult) use ($response, $writableBodyStream) { |
|
571 | + return $result->then(function($actualResult) use ($response, $writableBodyStream) { |
|
572 | 572 | return $this->doConvertToPsrResponse($actualResult, $response, $writableBodyStream); |
573 | 573 | }); |
574 | 574 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ); |
63 | 63 | $descriptions = $options; |
64 | 64 | } else { |
65 | - $descriptions = ! array_key_exists('descriptions', $options) || $options['descriptions'] === true; |
|
65 | + $descriptions = !array_key_exists('descriptions', $options) || $options['descriptions'] === true; |
|
66 | 66 | } |
67 | 67 | $descriptionField = $descriptions ? 'description' : ''; |
68 | 68 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | public static function _schema() |
189 | 189 | { |
190 | - if (! isset(self::$map['__Schema'])) { |
|
190 | + if (!isset(self::$map['__Schema'])) { |
|
191 | 191 | self::$map['__Schema'] = new ObjectType([ |
192 | 192 | 'name' => '__Schema', |
193 | 193 | 'isIntrospection' => true, |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | 'types' => [ |
201 | 201 | 'description' => 'A list of all types supported by this server.', |
202 | 202 | 'type' => new NonNull(new ListOfType(new NonNull(self::_type()))), |
203 | - 'resolve' => static function (Schema $schema) { |
|
203 | + 'resolve' => static function(Schema $schema) { |
|
204 | 204 | return array_values($schema->getTypeMap()); |
205 | 205 | }, |
206 | 206 | ], |
207 | 207 | 'queryType' => [ |
208 | 208 | 'description' => 'The type that query operations will be rooted at.', |
209 | 209 | 'type' => new NonNull(self::_type()), |
210 | - 'resolve' => static function (Schema $schema) { |
|
210 | + 'resolve' => static function(Schema $schema) { |
|
211 | 211 | return $schema->getQueryType(); |
212 | 212 | }, |
213 | 213 | ], |
@@ -216,21 +216,21 @@ discard block |
||
216 | 216 | 'If this server supports mutation, the type that ' . |
217 | 217 | 'mutation operations will be rooted at.', |
218 | 218 | 'type' => self::_type(), |
219 | - 'resolve' => static function (Schema $schema) { |
|
219 | + 'resolve' => static function(Schema $schema) { |
|
220 | 220 | return $schema->getMutationType(); |
221 | 221 | }, |
222 | 222 | ], |
223 | 223 | 'subscriptionType' => [ |
224 | 224 | 'description' => 'If this server support subscription, the type that subscription operations will be rooted at.', |
225 | 225 | 'type' => self::_type(), |
226 | - 'resolve' => static function (Schema $schema) { |
|
226 | + 'resolve' => static function(Schema $schema) { |
|
227 | 227 | return $schema->getSubscriptionType(); |
228 | 228 | }, |
229 | 229 | ], |
230 | 230 | 'directives' => [ |
231 | 231 | 'description' => 'A list of all directives supported by this server.', |
232 | 232 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_directive()))), |
233 | - 'resolve' => static function (Schema $schema) { |
|
233 | + 'resolve' => static function(Schema $schema) { |
|
234 | 234 | return $schema->getDirectives(); |
235 | 235 | }, |
236 | 236 | ], |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | public static function _type() |
245 | 245 | { |
246 | - if (! isset(self::$map['__Type'])) { |
|
246 | + if (!isset(self::$map['__Type'])) { |
|
247 | 247 | self::$map['__Type'] = new ObjectType([ |
248 | 248 | 'name' => '__Type', |
249 | 249 | 'isIntrospection' => true, |
@@ -257,11 +257,11 @@ discard block |
||
257 | 257 | 'Object and Interface types provide the fields they describe. Abstract ' . |
258 | 258 | 'types, Union and Interface, provide the Object types possible ' . |
259 | 259 | 'at runtime. List and NonNull types compose other types.', |
260 | - 'fields' => static function () { |
|
260 | + 'fields' => static function() { |
|
261 | 261 | return [ |
262 | 262 | 'kind' => [ |
263 | 263 | 'type' => Type::nonNull(self::_typeKind()), |
264 | - 'resolve' => static function (Type $type) { |
|
264 | + 'resolve' => static function(Type $type) { |
|
265 | 265 | switch (true) { |
266 | 266 | case $type instanceof ListOfType: |
267 | 267 | return TypeKind::LIST_KIND; |
@@ -291,15 +291,15 @@ discard block |
||
291 | 291 | 'args' => [ |
292 | 292 | 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false], |
293 | 293 | ], |
294 | - 'resolve' => static function (Type $type, $args) { |
|
294 | + 'resolve' => static function(Type $type, $args) { |
|
295 | 295 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
296 | 296 | $fields = $type->getFields(); |
297 | 297 | |
298 | 298 | if (empty($args['includeDeprecated'])) { |
299 | 299 | $fields = array_filter( |
300 | 300 | $fields, |
301 | - static function (FieldDefinition $field) { |
|
302 | - return ! $field->deprecationReason; |
|
301 | + static function(FieldDefinition $field) { |
|
302 | + return !$field->deprecationReason; |
|
303 | 303 | } |
304 | 304 | ); |
305 | 305 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | ], |
313 | 313 | 'interfaces' => [ |
314 | 314 | 'type' => Type::listOf(Type::nonNull(self::_type())), |
315 | - 'resolve' => static function ($type) { |
|
315 | + 'resolve' => static function($type) { |
|
316 | 316 | if ($type instanceof ObjectType) { |
317 | 317 | return $type->getInterfaces(); |
318 | 318 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | ], |
323 | 323 | 'possibleTypes' => [ |
324 | 324 | 'type' => Type::listOf(Type::nonNull(self::_type())), |
325 | - 'resolve' => static function ($type, $args, $context, ResolveInfo $info) { |
|
325 | + 'resolve' => static function($type, $args, $context, ResolveInfo $info) { |
|
326 | 326 | if ($type instanceof InterfaceType || $type instanceof UnionType) { |
327 | 327 | return $info->schema->getPossibleTypes($type); |
328 | 328 | } |
@@ -335,15 +335,15 @@ discard block |
||
335 | 335 | 'args' => [ |
336 | 336 | 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false], |
337 | 337 | ], |
338 | - 'resolve' => static function ($type, $args) { |
|
338 | + 'resolve' => static function($type, $args) { |
|
339 | 339 | if ($type instanceof EnumType) { |
340 | 340 | $values = array_values($type->getValues()); |
341 | 341 | |
342 | 342 | if (empty($args['includeDeprecated'])) { |
343 | 343 | $values = array_filter( |
344 | 344 | $values, |
345 | - static function ($value) { |
|
346 | - return ! $value->deprecationReason; |
|
345 | + static function($value) { |
|
346 | + return !$value->deprecationReason; |
|
347 | 347 | } |
348 | 348 | ); |
349 | 349 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | ], |
357 | 357 | 'inputFields' => [ |
358 | 358 | 'type' => Type::listOf(Type::nonNull(self::_inputValue())), |
359 | - 'resolve' => static function ($type) { |
|
359 | + 'resolve' => static function($type) { |
|
360 | 360 | if ($type instanceof InputObjectType) { |
361 | 361 | return array_values($type->getFields()); |
362 | 362 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | ], |
367 | 367 | 'ofType' => [ |
368 | 368 | 'type' => self::_type(), |
369 | - 'resolve' => static function ($type) { |
|
369 | + 'resolve' => static function($type) { |
|
370 | 370 | if ($type instanceof WrappingType) { |
371 | 371 | return $type->getWrappedType(); |
372 | 372 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | public static function _typeKind() |
386 | 386 | { |
387 | - if (! isset(self::$map['__TypeKind'])) { |
|
387 | + if (!isset(self::$map['__TypeKind'])) { |
|
388 | 388 | self::$map['__TypeKind'] = new EnumType([ |
389 | 389 | 'name' => '__TypeKind', |
390 | 390 | 'isIntrospection' => true, |
@@ -431,32 +431,32 @@ discard block |
||
431 | 431 | |
432 | 432 | public static function _field() |
433 | 433 | { |
434 | - if (! isset(self::$map['__Field'])) { |
|
434 | + if (!isset(self::$map['__Field'])) { |
|
435 | 435 | self::$map['__Field'] = new ObjectType([ |
436 | 436 | 'name' => '__Field', |
437 | 437 | 'isIntrospection' => true, |
438 | 438 | 'description' => |
439 | 439 | 'Object and Interface types are described by a list of Fields, each of ' . |
440 | 440 | 'which has a name, potentially a list of arguments, and a return type.', |
441 | - 'fields' => static function () { |
|
441 | + 'fields' => static function() { |
|
442 | 442 | return [ |
443 | 443 | 'name' => ['type' => Type::nonNull(Type::string())], |
444 | 444 | 'description' => ['type' => Type::string()], |
445 | 445 | 'args' => [ |
446 | 446 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))), |
447 | - 'resolve' => static function (FieldDefinition $field) { |
|
447 | + 'resolve' => static function(FieldDefinition $field) { |
|
448 | 448 | return empty($field->args) ? [] : $field->args; |
449 | 449 | }, |
450 | 450 | ], |
451 | 451 | 'type' => [ |
452 | 452 | 'type' => Type::nonNull(self::_type()), |
453 | - 'resolve' => static function (FieldDefinition $field) { |
|
453 | + 'resolve' => static function(FieldDefinition $field) { |
|
454 | 454 | return $field->getType(); |
455 | 455 | }, |
456 | 456 | ], |
457 | 457 | 'isDeprecated' => [ |
458 | 458 | 'type' => Type::nonNull(Type::boolean()), |
459 | - 'resolve' => static function (FieldDefinition $field) { |
|
459 | + 'resolve' => static function(FieldDefinition $field) { |
|
460 | 460 | return (bool) $field->deprecationReason; |
461 | 461 | }, |
462 | 462 | ], |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | |
474 | 474 | public static function _inputValue() |
475 | 475 | { |
476 | - if (! isset(self::$map['__InputValue'])) { |
|
476 | + if (!isset(self::$map['__InputValue'])) { |
|
477 | 477 | self::$map['__InputValue'] = new ObjectType([ |
478 | 478 | 'name' => '__InputValue', |
479 | 479 | 'isIntrospection' => true, |
@@ -481,13 +481,13 @@ discard block |
||
481 | 481 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
482 | 482 | 'InputObject are represented as Input Values which describe their type ' . |
483 | 483 | 'and optionally a default value.', |
484 | - 'fields' => static function () { |
|
484 | + 'fields' => static function() { |
|
485 | 485 | return [ |
486 | 486 | 'name' => ['type' => Type::nonNull(Type::string())], |
487 | 487 | 'description' => ['type' => Type::string()], |
488 | 488 | 'type' => [ |
489 | 489 | 'type' => Type::nonNull(self::_type()), |
490 | - 'resolve' => static function ($value) { |
|
490 | + 'resolve' => static function($value) { |
|
491 | 491 | return method_exists($value, 'getType') ? $value->getType() : $value->type; |
492 | 492 | }, |
493 | 493 | ], |
@@ -495,9 +495,9 @@ discard block |
||
495 | 495 | 'type' => Type::string(), |
496 | 496 | 'description' => |
497 | 497 | 'A GraphQL-formatted string representing the default value for this input value.', |
498 | - 'resolve' => static function ($inputValue) { |
|
498 | + 'resolve' => static function($inputValue) { |
|
499 | 499 | /** @var FieldArgument|InputObjectField $inputValue */ |
500 | - return ! $inputValue->defaultValueExists() |
|
500 | + return !$inputValue->defaultValueExists() |
|
501 | 501 | ? null |
502 | 502 | : Printer::doPrint(AST::astFromValue( |
503 | 503 | $inputValue->defaultValue, |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | |
516 | 516 | public static function _enumValue() |
517 | 517 | { |
518 | - if (! isset(self::$map['__EnumValue'])) { |
|
518 | + if (!isset(self::$map['__EnumValue'])) { |
|
519 | 519 | self::$map['__EnumValue'] = new ObjectType([ |
520 | 520 | 'name' => '__EnumValue', |
521 | 521 | 'isIntrospection' => true, |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | 'description' => ['type' => Type::string()], |
529 | 529 | 'isDeprecated' => [ |
530 | 530 | 'type' => Type::nonNull(Type::boolean()), |
531 | - 'resolve' => static function ($enumValue) { |
|
531 | + 'resolve' => static function($enumValue) { |
|
532 | 532 | return (bool) $enumValue->deprecationReason; |
533 | 533 | }, |
534 | 534 | ], |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | |
545 | 545 | public static function _directive() |
546 | 546 | { |
547 | - if (! isset(self::$map['__Directive'])) { |
|
547 | + if (!isset(self::$map['__Directive'])) { |
|
548 | 548 | self::$map['__Directive'] = new ObjectType([ |
549 | 549 | 'name' => '__Directive', |
550 | 550 | 'isIntrospection' => true, |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | ], |
565 | 565 | 'args' => [ |
566 | 566 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))), |
567 | - 'resolve' => static function (Directive $directive) { |
|
567 | + 'resolve' => static function(Directive $directive) { |
|
568 | 568 | return $directive->args ?: []; |
569 | 569 | }, |
570 | 570 | ], |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | 'onOperation' => [ |
575 | 575 | 'deprecationReason' => 'Use `locations`.', |
576 | 576 | 'type' => Type::nonNull(Type::boolean()), |
577 | - 'resolve' => static function ($d) { |
|
577 | + 'resolve' => static function($d) { |
|
578 | 578 | return in_array(DirectiveLocation::QUERY, $d->locations, true) || |
579 | 579 | in_array(DirectiveLocation::MUTATION, $d->locations, true) || |
580 | 580 | in_array(DirectiveLocation::SUBSCRIPTION, $d->locations, true); |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | 'onFragment' => [ |
584 | 584 | 'deprecationReason' => 'Use `locations`.', |
585 | 585 | 'type' => Type::nonNull(Type::boolean()), |
586 | - 'resolve' => static function ($d) { |
|
586 | + 'resolve' => static function($d) { |
|
587 | 587 | return in_array(DirectiveLocation::FRAGMENT_SPREAD, $d->locations, true) || |
588 | 588 | in_array(DirectiveLocation::INLINE_FRAGMENT, $d->locations, true) || |
589 | 589 | in_array(DirectiveLocation::FRAGMENT_DEFINITION, $d->locations, true); |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | 'onField' => [ |
593 | 593 | 'deprecationReason' => 'Use `locations`.', |
594 | 594 | 'type' => Type::nonNull(Type::boolean()), |
595 | - 'resolve' => static function ($d) { |
|
595 | + 'resolve' => static function($d) { |
|
596 | 596 | return in_array(DirectiveLocation::FIELD, $d->locations, true); |
597 | 597 | }, |
598 | 598 | ], |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | |
606 | 606 | public static function _directiveLocation() |
607 | 607 | { |
608 | - if (! isset(self::$map['__DirectiveLocation'])) { |
|
608 | + if (!isset(self::$map['__DirectiveLocation'])) { |
|
609 | 609 | self::$map['__DirectiveLocation'] = new EnumType([ |
610 | 610 | 'name' => '__DirectiveLocation', |
611 | 611 | 'isIntrospection' => true, |
@@ -695,13 +695,13 @@ discard block |
||
695 | 695 | |
696 | 696 | public static function schemaMetaFieldDef() |
697 | 697 | { |
698 | - if (! isset(self::$map[self::SCHEMA_FIELD_NAME])) { |
|
698 | + if (!isset(self::$map[self::SCHEMA_FIELD_NAME])) { |
|
699 | 699 | self::$map[self::SCHEMA_FIELD_NAME] = FieldDefinition::create([ |
700 | 700 | 'name' => self::SCHEMA_FIELD_NAME, |
701 | 701 | 'type' => Type::nonNull(self::_schema()), |
702 | 702 | 'description' => 'Access the current type schema of this server.', |
703 | 703 | 'args' => [], |
704 | - 'resolve' => static function ( |
|
704 | + 'resolve' => static function( |
|
705 | 705 | $source, |
706 | 706 | $args, |
707 | 707 | $context, |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | |
718 | 718 | public static function typeMetaFieldDef() |
719 | 719 | { |
720 | - if (! isset(self::$map[self::TYPE_FIELD_NAME])) { |
|
720 | + if (!isset(self::$map[self::TYPE_FIELD_NAME])) { |
|
721 | 721 | self::$map[self::TYPE_FIELD_NAME] = FieldDefinition::create([ |
722 | 722 | 'name' => self::TYPE_FIELD_NAME, |
723 | 723 | 'type' => self::_type(), |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | 'args' => [ |
726 | 726 | ['name' => 'name', 'type' => Type::nonNull(Type::string())], |
727 | 727 | ], |
728 | - 'resolve' => static function ($source, $args, $context, ResolveInfo $info) { |
|
728 | + 'resolve' => static function($source, $args, $context, ResolveInfo $info) { |
|
729 | 729 | return $info->schema->getType($args['name']); |
730 | 730 | }, |
731 | 731 | ]); |
@@ -736,13 +736,13 @@ discard block |
||
736 | 736 | |
737 | 737 | public static function typeNameMetaFieldDef() |
738 | 738 | { |
739 | - if (! isset(self::$map[self::TYPE_NAME_FIELD_NAME])) { |
|
739 | + if (!isset(self::$map[self::TYPE_NAME_FIELD_NAME])) { |
|
740 | 740 | self::$map[self::TYPE_NAME_FIELD_NAME] = FieldDefinition::create([ |
741 | 741 | 'name' => self::TYPE_NAME_FIELD_NAME, |
742 | 742 | 'type' => Type::nonNull(Type::string()), |
743 | 743 | 'description' => 'The name of the current Object type at runtime.', |
744 | 744 | 'args' => [], |
745 | - 'resolve' => static function ( |
|
745 | + 'resolve' => static function( |
|
746 | 746 | $source, |
747 | 747 | $args, |
748 | 748 | $context, |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | Utils::getVariableType($config) |
109 | 109 | ); |
110 | 110 | Utils::invariant( |
111 | - ! $config->types || is_array($config->types) || is_callable($config->types), |
|
111 | + !$config->types || is_array($config->types) || is_callable($config->types), |
|
112 | 112 | '"types" must be array or callable if provided but got: ' . Utils::getVariableType($config->types) |
113 | 113 | ); |
114 | 114 | Utils::invariant( |
115 | - ! $config->directives || is_array($config->directives), |
|
115 | + !$config->directives || is_array($config->directives), |
|
116 | 116 | '"directives" must be Array if provided but got: ' . Utils::getVariableType($config->directives) |
117 | 117 | ); |
118 | 118 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $types = $types(); |
165 | 165 | } |
166 | 166 | |
167 | - if (! is_array($types) && ! $types instanceof Traversable) { |
|
167 | + if (!is_array($types) && !$types instanceof Traversable) { |
|
168 | 168 | throw new InvariantViolation(sprintf( |
169 | 169 | 'Schema types callable must return array or instance of Traversable but got: %s', |
170 | 170 | Utils::getVariableType($types) |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | foreach ($types as $index => $type) { |
175 | - if (! $type instanceof Type) { |
|
175 | + if (!$type instanceof Type) { |
|
176 | 176 | throw new InvariantViolation(sprintf( |
177 | 177 | 'Each entry of schema types must be instance of GraphQL\Type\Definition\Type but entry at %s is %s', |
178 | 178 | $index, |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function getTypeMap() |
197 | 197 | { |
198 | - if (! $this->fullyLoaded) { |
|
198 | + if (!$this->fullyLoaded) { |
|
199 | 199 | $this->resolvedTypes = $this->collectAllTypes(); |
200 | 200 | $this->fullyLoaded = true; |
201 | 201 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $typeMap = TypeInfo::extractTypes($type, $typeMap); |
214 | 214 | } |
215 | 215 | foreach ($this->getDirectives() as $directive) { |
216 | - if (! ($directive instanceof Directive)) { |
|
216 | + if (!($directive instanceof Directive)) { |
|
217 | 217 | continue; |
218 | 218 | } |
219 | 219 | |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | */ |
299 | 299 | public function getType($name) |
300 | 300 | { |
301 | - if (! isset($this->resolvedTypes[$name])) { |
|
301 | + if (!isset($this->resolvedTypes[$name])) { |
|
302 | 302 | $type = $this->loadType($name); |
303 | - if (! $type) { |
|
303 | + if (!$type) { |
|
304 | 304 | return null; |
305 | 305 | } |
306 | 306 | $this->resolvedTypes[$name] = $type; |
@@ -328,13 +328,13 @@ discard block |
||
328 | 328 | { |
329 | 329 | $typeLoader = $this->config->typeLoader; |
330 | 330 | |
331 | - if (! $typeLoader) { |
|
331 | + if (!$typeLoader) { |
|
332 | 332 | return $this->defaultTypeLoader($typeName); |
333 | 333 | } |
334 | 334 | |
335 | 335 | $type = $typeLoader($typeName); |
336 | 336 | |
337 | - if (! $type instanceof Type) { |
|
337 | + if (!$type instanceof Type) { |
|
338 | 338 | throw new InvariantViolation( |
339 | 339 | sprintf( |
340 | 340 | 'Type loader is expected to return valid type "%s", but it returned %s', |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | foreach ($this->getTypeMap() as $type) { |
393 | 393 | if ($type instanceof ObjectType) { |
394 | 394 | foreach ($type->getInterfaces() as $interface) { |
395 | - if (! ($interface instanceof InterfaceType)) { |
|
395 | + if (!($interface instanceof InterfaceType)) { |
|
396 | 396 | continue; |
397 | 397 | } |
398 | 398 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | $type->assertValid(); |
482 | 482 | |
483 | 483 | // Make sure type loader returns the same instance as registered in other places of schema |
484 | - if (! $this->config->typeLoader) { |
|
484 | + if (!$this->config->typeLoader) { |
|
485 | 485 | continue; |
486 | 486 | } |
487 | 487 |
@@ -79,7 +79,7 @@ discard block |
||
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 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | private function getInterfaceMap() |
170 | 170 | { |
171 | - if (! $this->interfaceMap) { |
|
171 | + if (!$this->interfaceMap) { |
|
172 | 172 | $this->interfaceMap = []; |
173 | 173 | foreach ($this->getInterfaces() as $interface) { |
174 | 174 | $this->interfaceMap[$interface->name] = $interface; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $interfaces = $this->config['interfaces'] ?? []; |
188 | 188 | $interfaces = is_callable($interfaces) ? call_user_func($interfaces) : $interfaces; |
189 | 189 | |
190 | - if ($interfaces !== null && ! is_array($interfaces)) { |
|
190 | + if ($interfaces !== null && !is_array($interfaces)) { |
|
191 | 191 | throw new InvariantViolation( |
192 | 192 | sprintf('%s interfaces must be an Array or a callable which returns an Array.', $this->name) |
193 | 193 | ); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public function __construct($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 |
||
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 |
||
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 |
||
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 |
||
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 |