@@ -87,7 +87,7 @@ discard block |
||
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 |
||
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 |
||
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')) |
@@ -257,16 +257,16 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -350,7 +350,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -108,7 +108,7 @@ 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( |
@@ -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 | |
@@ -313,9 +313,9 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function getType(string $name) : ?Type |
315 | 315 | { |
316 | - if (! isset($this->resolvedTypes[$name])) { |
|
316 | + if (!isset($this->resolvedTypes[$name])) { |
|
317 | 317 | $type = $this->loadType($name); |
318 | - if (! $type) { |
|
318 | + if (!$type) { |
|
319 | 319 | return null; |
320 | 320 | } |
321 | 321 | $this->resolvedTypes[$name] = $type; |
@@ -333,13 +333,13 @@ discard block |
||
333 | 333 | { |
334 | 334 | $typeLoader = $this->config->typeLoader; |
335 | 335 | |
336 | - if (! $typeLoader) { |
|
336 | + if (!$typeLoader) { |
|
337 | 337 | return $this->defaultTypeLoader($typeName); |
338 | 338 | } |
339 | 339 | |
340 | 340 | $type = $typeLoader($typeName); |
341 | 341 | |
342 | - if (! $type instanceof Type) { |
|
342 | + if (!$type instanceof Type) { |
|
343 | 343 | throw new InvariantViolation( |
344 | 344 | sprintf( |
345 | 345 | 'Type loader is expected to return valid type "%s", but it returned %s', |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | foreach ($this->getTypeMap() as $type) { |
395 | 395 | if ($type instanceof ObjectType) { |
396 | 396 | foreach ($type->getInterfaces() as $interface) { |
397 | - if (! ($interface instanceof InterfaceType)) { |
|
397 | + if (!($interface instanceof InterfaceType)) { |
|
398 | 398 | continue; |
399 | 399 | } |
400 | 400 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $type->assertValid(); |
478 | 478 | |
479 | 479 | // Make sure type loader returns the same instance as registered in other places of schema |
480 | - if (! $this->config->typeLoader) { |
|
480 | + if (!$this->config->typeLoader) { |
|
481 | 481 | continue; |
482 | 482 | } |
483 | 483 |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | public function validateRootTypes() : void |
75 | 75 | { |
76 | 76 | $queryType = $this->schema->getQueryType(); |
77 | - if (! $queryType) { |
|
77 | + if (!$queryType) { |
|
78 | 78 | $this->reportError( |
79 | 79 | 'Query root type must be provided.', |
80 | 80 | $this->schema->getAstNode() |
81 | 81 | ); |
82 | - } elseif (! $queryType instanceof ObjectType) { |
|
82 | + } elseif (!$queryType instanceof ObjectType) { |
|
83 | 83 | $this->reportError( |
84 | 84 | 'Query root type must be Object type, it cannot be ' . Utils::printSafe($queryType) . '.', |
85 | 85 | $this->getOperationTypeNode($queryType, 'query') |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | $mutationType = $this->schema->getMutationType(); |
90 | - if ($mutationType && ! $mutationType instanceof ObjectType) { |
|
90 | + if ($mutationType && !$mutationType instanceof ObjectType) { |
|
91 | 91 | $this->reportError( |
92 | 92 | 'Mutation root type must be Object type if provided, it cannot be ' . Utils::printSafe($mutationType) . '.', |
93 | 93 | $this->getOperationTypeNode($mutationType, 'mutation') |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $directives = $this->schema->getDirectives(); |
167 | 167 | foreach ($directives as $directive) { |
168 | 168 | // Ensure all directives are in fact GraphQL directives. |
169 | - if (! $directive instanceof Directive) { |
|
169 | + if (!$directive instanceof Directive) { |
|
170 | 170 | $this->reportError( |
171 | 171 | 'Expected directive but got: ' . Utils::printSafe($directive) . '.', |
172 | 172 | is_object($directive) ? $directive->astNode : null |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | |
223 | 223 | $nodes = Utils::map( |
224 | 224 | $directiveList, |
225 | - static function (Directive $directive) { |
|
225 | + static function(Directive $directive) { |
|
226 | 226 | return $directive->astNode; |
227 | 227 | } |
228 | 228 | ); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | // Ensure names are valid, however introspection types opt out. |
242 | 242 | $error = Utils::isValidNameError($node->name, $node->astNode); |
243 | - if (! $error || Introspection::isIntrospectionType($node)) { |
|
243 | + if (!$error || Introspection::isIntrospectionType($node)) { |
|
244 | 244 | return; |
245 | 245 | } |
246 | 246 | |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | { |
257 | 257 | $subNodes = $this->getAllSubNodes( |
258 | 258 | $directive, |
259 | - static function ($directiveNode) { |
|
259 | + static function($directiveNode) { |
|
260 | 260 | return $directiveNode->arguments; |
261 | 261 | } |
262 | 262 | ); |
263 | 263 | |
264 | 264 | return Utils::filter( |
265 | 265 | $subNodes, |
266 | - static function ($argNode) use ($argName) { |
|
266 | + static function($argNode) use ($argName) { |
|
267 | 267 | return $argNode->name->value === $argName; |
268 | 268 | } |
269 | 269 | ); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $typeMap = $this->schema->getTypeMap(); |
287 | 287 | foreach ($typeMap as $typeName => $type) { |
288 | 288 | // Ensure all provided types are in fact GraphQL type. |
289 | - if (! $type instanceof NamedType) { |
|
289 | + if (!$type instanceof NamedType) { |
|
290 | 290 | $this->reportError( |
291 | 291 | 'Expected GraphQL named type but got: ' . Utils::printSafe($type) . '.', |
292 | 292 | $type instanceof Type ? $type->astNode : null |
@@ -378,11 +378,11 @@ discard block |
||
378 | 378 | } |
379 | 379 | $includes = Utils::some( |
380 | 380 | $schemaDirective->locations, |
381 | - static function ($schemaLocation) use ($location) { |
|
381 | + static function($schemaLocation) use ($location) { |
|
382 | 382 | return $schemaLocation === $location; |
383 | 383 | } |
384 | 384 | ); |
385 | - if (! $includes) { |
|
385 | + if (!$includes) { |
|
386 | 386 | $errorNodes = $schemaDirective->astNode |
387 | 387 | ? [$directive, $schemaDirective->astNode] |
388 | 388 | : [$directive]; |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $fieldMap = $type->getFields(); |
417 | 417 | |
418 | 418 | // Objects and Interfaces both must define one or more fields. |
419 | - if (! $fieldMap) { |
|
419 | + if (!$fieldMap) { |
|
420 | 420 | $this->reportError( |
421 | 421 | sprintf('Type %s must define one or more fields.', $type->name), |
422 | 422 | $this->getAllNodes($type) |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | // Ensure the type is an output type |
441 | - if (! Type::isOutputType($field->getType())) { |
|
441 | + if (!Type::isOutputType($field->getType())) { |
|
442 | 442 | $this->reportError( |
443 | 443 | sprintf( |
444 | 444 | 'The type of %s.%s must be Output Type but got: %s.', |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $argNames[$argName] = true; |
473 | 473 | |
474 | 474 | // Ensure the type is an input type |
475 | - if (! Type::isInputType($arg->getType())) { |
|
475 | + if (!Type::isInputType($arg->getType())) { |
|
476 | 476 | $this->reportError( |
477 | 477 | sprintf( |
478 | 478 | 'The type of %s.%s(%s:) must be Input Type but got: %s.', |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | } |
487 | 487 | |
488 | 488 | // Ensure argument definition directives are valid |
489 | - if (! isset($arg->astNode, $arg->astNode->directives)) { |
|
489 | + if (!isset($arg->astNode, $arg->astNode->directives)) { |
|
490 | 490 | continue; |
491 | 491 | } |
492 | 492 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | } |
498 | 498 | |
499 | 499 | // Ensure any directives are valid |
500 | - if (! isset($field->astNode, $field->astNode->directives)) { |
|
500 | + if (!isset($field->astNode, $field->astNode->directives)) { |
|
501 | 501 | continue; |
502 | 502 | } |
503 | 503 | |
@@ -539,12 +539,12 @@ discard block |
||
539 | 539 | { |
540 | 540 | $result = new NodeList([]); |
541 | 541 | foreach ($this->getAllNodes($obj) as $astNode) { |
542 | - if (! $astNode) { |
|
542 | + if (!$astNode) { |
|
543 | 543 | continue; |
544 | 544 | } |
545 | 545 | |
546 | 546 | $subNodes = $getter($astNode); |
547 | - if (! $subNodes) { |
|
547 | + if (!$subNodes) { |
|
548 | 548 | continue; |
549 | 549 | } |
550 | 550 | |
@@ -562,11 +562,11 @@ discard block |
||
562 | 562 | */ |
563 | 563 | private function getAllFieldNodes($type, $fieldName) |
564 | 564 | { |
565 | - $subNodes = $this->getAllSubNodes($type, static function ($typeNode) { |
|
565 | + $subNodes = $this->getAllSubNodes($type, static function($typeNode) { |
|
566 | 566 | return $typeNode->fields; |
567 | 567 | }); |
568 | 568 | |
569 | - return Utils::filter($subNodes, static function ($fieldNode) use ($fieldName) { |
|
569 | + return Utils::filter($subNodes, static function($fieldNode) use ($fieldName) { |
|
570 | 570 | return $fieldNode->name->value === $fieldName; |
571 | 571 | }); |
572 | 572 | } |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | { |
654 | 654 | $implementedTypeNames = []; |
655 | 655 | foreach ($object->getInterfaces() as $iface) { |
656 | - if (! $iface instanceof InterfaceType) { |
|
656 | + if (!$iface instanceof InterfaceType) { |
|
657 | 657 | $this->reportError( |
658 | 658 | sprintf( |
659 | 659 | 'Type %s must only implement Interface types, it cannot implement %s.', |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | */ |
684 | 684 | private function getDirectives($object) |
685 | 685 | { |
686 | - return $this->getAllSubNodes($object, static function ($node) { |
|
686 | + return $this->getAllSubNodes($object, static function($node) { |
|
687 | 687 | return $node->directives; |
688 | 688 | }); |
689 | 689 | } |
@@ -707,11 +707,11 @@ discard block |
||
707 | 707 | */ |
708 | 708 | private function getAllImplementsInterfaceNodes(ObjectType $type, $iface) |
709 | 709 | { |
710 | - $subNodes = $this->getAllSubNodes($type, static function ($typeNode) { |
|
710 | + $subNodes = $this->getAllSubNodes($type, static function($typeNode) { |
|
711 | 711 | return $typeNode->interfaces; |
712 | 712 | }); |
713 | 713 | |
714 | - return Utils::filter($subNodes, static function ($ifaceNode) use ($iface) { |
|
714 | + return Utils::filter($subNodes, static function($ifaceNode) use ($iface) { |
|
715 | 715 | return $ifaceNode->name->value === $iface->name; |
716 | 716 | }); |
717 | 717 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | : null; |
732 | 732 | |
733 | 733 | // Assert interface field exists on object. |
734 | - if (! $objectField) { |
|
734 | + if (!$objectField) { |
|
735 | 735 | $this->reportError( |
736 | 736 | sprintf( |
737 | 737 | 'Interface field %s.%s expected but %s does not provide it.', |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | |
750 | 750 | // Assert interface field type is satisfied by object field type, by being |
751 | 751 | // a valid subtype. (covariant) |
752 | - if (! TypeComparators::isTypeSubTypeOf( |
|
752 | + if (!TypeComparators::isTypeSubTypeOf( |
|
753 | 753 | $this->schema, |
754 | 754 | $objectField->getType(), |
755 | 755 | $ifaceField->getType() |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | } |
786 | 786 | |
787 | 787 | // Assert interface field arg exists on object field. |
788 | - if (! $objectArg) { |
|
788 | + if (!$objectArg) { |
|
789 | 789 | $this->reportError( |
790 | 790 | sprintf( |
791 | 791 | 'Interface field argument %s.%s(%s:) expected but %s.%s does not provide it.', |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | // Assert interface field arg type matches object field arg type. |
807 | 807 | // (invariant) |
808 | 808 | // TODO: change to contravariant? |
809 | - if (! TypeComparators::isEqualType($ifaceArg->getType(), $objectArg->getType())) { |
|
809 | + if (!TypeComparators::isEqualType($ifaceArg->getType(), $objectArg->getType())) { |
|
810 | 810 | $this->reportError( |
811 | 811 | sprintf( |
812 | 812 | 'Interface field argument %s.%s(%s:) expects type %s but %s.%s(%s:) is type %s.', |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | } |
841 | 841 | } |
842 | 842 | |
843 | - if ($ifaceArg || ! ($objectArg->getType() instanceof NonNull)) { |
|
843 | + if ($ifaceArg || !($objectArg->getType() instanceof NonNull)) { |
|
844 | 844 | continue; |
845 | 845 | } |
846 | 846 | |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | { |
868 | 868 | $memberTypes = $union->getTypes(); |
869 | 869 | |
870 | - if (! $memberTypes) { |
|
870 | + if (!$memberTypes) { |
|
871 | 871 | $this->reportError( |
872 | 872 | sprintf('Union type %s must define one or more member types.', $union->name), |
873 | 873 | $this->getAllNodes($union) |
@@ -907,11 +907,11 @@ discard block |
||
907 | 907 | */ |
908 | 908 | private function getUnionMemberTypeNodes(UnionType $union, $typeName) |
909 | 909 | { |
910 | - $subNodes = $this->getAllSubNodes($union, static function ($unionNode) { |
|
910 | + $subNodes = $this->getAllSubNodes($union, static function($unionNode) { |
|
911 | 911 | return $unionNode->types; |
912 | 912 | }); |
913 | 913 | |
914 | - return Utils::filter($subNodes, static function ($typeNode) use ($typeName) { |
|
914 | + return Utils::filter($subNodes, static function($typeNode) use ($typeName) { |
|
915 | 915 | return $typeNode->name->value === $typeName; |
916 | 916 | }); |
917 | 917 | } |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | { |
921 | 921 | $enumValues = $enumType->getValues(); |
922 | 922 | |
923 | - if (! $enumValues) { |
|
923 | + if (!$enumValues) { |
|
924 | 924 | $this->reportError( |
925 | 925 | sprintf('Enum type %s must define one or more values.', $enumType->name), |
926 | 926 | $this->getAllNodes($enumType) |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | } |
950 | 950 | |
951 | 951 | // Ensure valid directives |
952 | - if (! isset($enumValue->astNode, $enumValue->astNode->directives)) { |
|
952 | + if (!isset($enumValue->astNode, $enumValue->astNode->directives)) { |
|
953 | 953 | continue; |
954 | 954 | } |
955 | 955 | |
@@ -967,11 +967,11 @@ discard block |
||
967 | 967 | */ |
968 | 968 | private function getEnumValueNodes(EnumType $enum, $valueName) |
969 | 969 | { |
970 | - $subNodes = $this->getAllSubNodes($enum, static function ($enumNode) { |
|
970 | + $subNodes = $this->getAllSubNodes($enum, static function($enumNode) { |
|
971 | 971 | return $enumNode->values; |
972 | 972 | }); |
973 | 973 | |
974 | - return Utils::filter($subNodes, static function ($valueNode) use ($valueName) { |
|
974 | + return Utils::filter($subNodes, static function($valueNode) use ($valueName) { |
|
975 | 975 | return $valueNode->name->value === $valueName; |
976 | 976 | }); |
977 | 977 | } |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | { |
981 | 981 | $fieldMap = $inputObj->getFields(); |
982 | 982 | |
983 | - if (! $fieldMap) { |
|
983 | + if (!$fieldMap) { |
|
984 | 984 | $this->reportError( |
985 | 985 | sprintf('Input Object type %s must define one or more fields.', $inputObj->name), |
986 | 986 | $this->getAllNodes($inputObj) |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | // TODO: Ensure they are unique per field. |
996 | 996 | |
997 | 997 | // Ensure the type is an input type |
998 | - if (! Type::isInputType($field->getType())) { |
|
998 | + if (!Type::isInputType($field->getType())) { |
|
999 | 999 | $this->reportError( |
1000 | 1000 | sprintf( |
1001 | 1001 | 'The type of %s.%s must be Input Type but got: %s.', |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | // Ensure valid directives |
1011 | - if (! isset($field->astNode, $field->astNode->directives)) { |
|
1011 | + if (!isset($field->astNode, $field->astNode->directives)) { |
|
1012 | 1012 | continue; |
1013 | 1013 | } |
1014 | 1014 |
@@ -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 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | public static function _schema() |
217 | 217 | { |
218 | - if (! isset(self::$map['__Schema'])) { |
|
218 | + if (!isset(self::$map['__Schema'])) { |
|
219 | 219 | self::$map['__Schema'] = new ObjectType([ |
220 | 220 | 'name' => '__Schema', |
221 | 221 | 'isIntrospection' => true, |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | 'types' => [ |
229 | 229 | 'description' => 'A list of all types supported by this server.', |
230 | 230 | 'type' => new NonNull(new ListOfType(new NonNull(self::_type()))), |
231 | - 'resolve' => static function (Schema $schema) { |
|
231 | + 'resolve' => static function(Schema $schema) { |
|
232 | 232 | return array_values($schema->getTypeMap()); |
233 | 233 | }, |
234 | 234 | ], |
235 | 235 | 'queryType' => [ |
236 | 236 | 'description' => 'The type that query operations will be rooted at.', |
237 | 237 | 'type' => new NonNull(self::_type()), |
238 | - 'resolve' => static function (Schema $schema) { |
|
238 | + 'resolve' => static function(Schema $schema) { |
|
239 | 239 | return $schema->getQueryType(); |
240 | 240 | }, |
241 | 241 | ], |
@@ -244,21 +244,21 @@ discard block |
||
244 | 244 | 'If this server supports mutation, the type that ' . |
245 | 245 | 'mutation operations will be rooted at.', |
246 | 246 | 'type' => self::_type(), |
247 | - 'resolve' => static function (Schema $schema) { |
|
247 | + 'resolve' => static function(Schema $schema) { |
|
248 | 248 | return $schema->getMutationType(); |
249 | 249 | }, |
250 | 250 | ], |
251 | 251 | 'subscriptionType' => [ |
252 | 252 | 'description' => 'If this server support subscription, the type that subscription operations will be rooted at.', |
253 | 253 | 'type' => self::_type(), |
254 | - 'resolve' => static function (Schema $schema) : ?ObjectType { |
|
254 | + 'resolve' => static function(Schema $schema) : ?ObjectType { |
|
255 | 255 | return $schema->getSubscriptionType(); |
256 | 256 | }, |
257 | 257 | ], |
258 | 258 | 'directives' => [ |
259 | 259 | 'description' => 'A list of all directives supported by this server.', |
260 | 260 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_directive()))), |
261 | - 'resolve' => static function (Schema $schema) : array { |
|
261 | + 'resolve' => static function(Schema $schema) : array { |
|
262 | 262 | return $schema->getDirectives(); |
263 | 263 | }, |
264 | 264 | ], |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | |
272 | 272 | public static function _type() |
273 | 273 | { |
274 | - if (! isset(self::$map['__Type'])) { |
|
274 | + if (!isset(self::$map['__Type'])) { |
|
275 | 275 | self::$map['__Type'] = new ObjectType([ |
276 | 276 | 'name' => '__Type', |
277 | 277 | 'isIntrospection' => true, |
@@ -285,11 +285,11 @@ discard block |
||
285 | 285 | 'Object and Interface types provide the fields they describe. Abstract ' . |
286 | 286 | 'types, Union and Interface, provide the Object types possible ' . |
287 | 287 | 'at runtime. List and NonNull types compose other types.', |
288 | - 'fields' => static function () { |
|
288 | + 'fields' => static function() { |
|
289 | 289 | return [ |
290 | 290 | 'kind' => [ |
291 | 291 | 'type' => Type::nonNull(self::_typeKind()), |
292 | - 'resolve' => static function (Type $type) { |
|
292 | + 'resolve' => static function(Type $type) { |
|
293 | 293 | switch (true) { |
294 | 294 | case $type instanceof ListOfType: |
295 | 295 | return TypeKind::LIST; |
@@ -314,13 +314,13 @@ discard block |
||
314 | 314 | ], |
315 | 315 | 'name' => [ |
316 | 316 | 'type' => Type::string(), |
317 | - 'resolve' => static function ($obj) { |
|
317 | + 'resolve' => static function($obj) { |
|
318 | 318 | return $obj->name; |
319 | 319 | }, |
320 | 320 | ], |
321 | 321 | 'description' => [ |
322 | 322 | 'type' => Type::string(), |
323 | - 'resolve' => static function ($obj) { |
|
323 | + 'resolve' => static function($obj) { |
|
324 | 324 | return $obj->description; |
325 | 325 | }, |
326 | 326 | ], |
@@ -329,15 +329,15 @@ discard block |
||
329 | 329 | 'args' => [ |
330 | 330 | 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false], |
331 | 331 | ], |
332 | - 'resolve' => static function (Type $type, $args) { |
|
332 | + 'resolve' => static function(Type $type, $args) { |
|
333 | 333 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
334 | 334 | $fields = $type->getFields(); |
335 | 335 | |
336 | 336 | if (empty($args['includeDeprecated'])) { |
337 | 337 | $fields = array_filter( |
338 | 338 | $fields, |
339 | - static function (FieldDefinition $field) { |
|
340 | - return ! $field->deprecationReason; |
|
339 | + static function(FieldDefinition $field) { |
|
340 | + return !$field->deprecationReason; |
|
341 | 341 | } |
342 | 342 | ); |
343 | 343 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | ], |
351 | 351 | 'interfaces' => [ |
352 | 352 | 'type' => Type::listOf(Type::nonNull(self::_type())), |
353 | - 'resolve' => static function ($type) { |
|
353 | + 'resolve' => static function($type) { |
|
354 | 354 | if ($type instanceof ObjectType) { |
355 | 355 | return $type->getInterfaces(); |
356 | 356 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | ], |
361 | 361 | 'possibleTypes' => [ |
362 | 362 | 'type' => Type::listOf(Type::nonNull(self::_type())), |
363 | - 'resolve' => static function ($type, $args, $context, ResolveInfo $info) { |
|
363 | + 'resolve' => static function($type, $args, $context, ResolveInfo $info) { |
|
364 | 364 | if ($type instanceof InterfaceType || $type instanceof UnionType) { |
365 | 365 | return $info->schema->getPossibleTypes($type); |
366 | 366 | } |
@@ -373,15 +373,15 @@ discard block |
||
373 | 373 | 'args' => [ |
374 | 374 | 'includeDeprecated' => ['type' => Type::boolean(), 'defaultValue' => false], |
375 | 375 | ], |
376 | - 'resolve' => static function ($type, $args) { |
|
376 | + 'resolve' => static function($type, $args) { |
|
377 | 377 | if ($type instanceof EnumType) { |
378 | 378 | $values = array_values($type->getValues()); |
379 | 379 | |
380 | 380 | if (empty($args['includeDeprecated'])) { |
381 | 381 | $values = array_filter( |
382 | 382 | $values, |
383 | - static function ($value) { |
|
384 | - return ! $value->deprecationReason; |
|
383 | + static function($value) { |
|
384 | + return !$value->deprecationReason; |
|
385 | 385 | } |
386 | 386 | ); |
387 | 387 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | ], |
395 | 395 | 'inputFields' => [ |
396 | 396 | 'type' => Type::listOf(Type::nonNull(self::_inputValue())), |
397 | - 'resolve' => static function ($type) { |
|
397 | + 'resolve' => static function($type) { |
|
398 | 398 | if ($type instanceof InputObjectType) { |
399 | 399 | return array_values($type->getFields()); |
400 | 400 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | ], |
405 | 405 | 'ofType' => [ |
406 | 406 | 'type' => self::_type(), |
407 | - 'resolve' => static function ($type) { |
|
407 | + 'resolve' => static function($type) { |
|
408 | 408 | if ($type instanceof WrappingType) { |
409 | 409 | return $type->getWrappedType(); |
410 | 410 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | |
423 | 423 | public static function _typeKind() |
424 | 424 | { |
425 | - if (! isset(self::$map['__TypeKind'])) { |
|
425 | + if (!isset(self::$map['__TypeKind'])) { |
|
426 | 426 | self::$map['__TypeKind'] = new EnumType([ |
427 | 427 | 'name' => '__TypeKind', |
428 | 428 | 'isIntrospection' => true, |
@@ -469,48 +469,48 @@ discard block |
||
469 | 469 | |
470 | 470 | public static function _field() |
471 | 471 | { |
472 | - if (! isset(self::$map['__Field'])) { |
|
472 | + if (!isset(self::$map['__Field'])) { |
|
473 | 473 | self::$map['__Field'] = new ObjectType([ |
474 | 474 | 'name' => '__Field', |
475 | 475 | 'isIntrospection' => true, |
476 | 476 | 'description' => |
477 | 477 | 'Object and Interface types are described by a list of Fields, each of ' . |
478 | 478 | 'which has a name, potentially a list of arguments, and a return type.', |
479 | - 'fields' => static function () { |
|
479 | + 'fields' => static function() { |
|
480 | 480 | return [ |
481 | 481 | 'name' => [ |
482 | 482 | 'type' => Type::nonNull(Type::string()), |
483 | - 'resolve' => static function (FieldDefinition $field) { |
|
483 | + 'resolve' => static function(FieldDefinition $field) { |
|
484 | 484 | return $field->name; |
485 | 485 | }, |
486 | 486 | ], |
487 | 487 | 'description' => [ |
488 | 488 | 'type' => Type::string(), |
489 | - 'resolve' => static function (FieldDefinition $field) { |
|
489 | + 'resolve' => static function(FieldDefinition $field) { |
|
490 | 490 | return $field->description; |
491 | 491 | }, |
492 | 492 | ], |
493 | 493 | 'args' => [ |
494 | 494 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))), |
495 | - 'resolve' => static function (FieldDefinition $field) { |
|
495 | + 'resolve' => static function(FieldDefinition $field) { |
|
496 | 496 | return empty($field->args) ? [] : $field->args; |
497 | 497 | }, |
498 | 498 | ], |
499 | 499 | 'type' => [ |
500 | 500 | 'type' => Type::nonNull(self::_type()), |
501 | - 'resolve' => static function (FieldDefinition $field) { |
|
501 | + 'resolve' => static function(FieldDefinition $field) { |
|
502 | 502 | return $field->getType(); |
503 | 503 | }, |
504 | 504 | ], |
505 | 505 | 'isDeprecated' => [ |
506 | 506 | 'type' => Type::nonNull(Type::boolean()), |
507 | - 'resolve' => static function (FieldDefinition $field) { |
|
507 | + 'resolve' => static function(FieldDefinition $field) { |
|
508 | 508 | return (bool) $field->deprecationReason; |
509 | 509 | }, |
510 | 510 | ], |
511 | 511 | 'deprecationReason' => [ |
512 | 512 | 'type' => Type::string(), |
513 | - 'resolve' => static function (FieldDefinition $field) { |
|
513 | + 'resolve' => static function(FieldDefinition $field) { |
|
514 | 514 | return $field->deprecationReason; |
515 | 515 | }, |
516 | 516 | ], |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | |
525 | 525 | public static function _inputValue() |
526 | 526 | { |
527 | - if (! isset(self::$map['__InputValue'])) { |
|
527 | + if (!isset(self::$map['__InputValue'])) { |
|
528 | 528 | self::$map['__InputValue'] = new ObjectType([ |
529 | 529 | 'name' => '__InputValue', |
530 | 530 | 'isIntrospection' => true, |
@@ -532,11 +532,11 @@ discard block |
||
532 | 532 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
533 | 533 | 'InputObject are represented as Input Values which describe their type ' . |
534 | 534 | 'and optionally a default value.', |
535 | - 'fields' => static function () { |
|
535 | + 'fields' => static function() { |
|
536 | 536 | return [ |
537 | 537 | 'name' => [ |
538 | 538 | 'type' => Type::nonNull(Type::string()), |
539 | - 'resolve' => static function ($inputValue) { |
|
539 | + 'resolve' => static function($inputValue) { |
|
540 | 540 | /** @var FieldArgument|InputObjectField $inputValue */ |
541 | 541 | $inputValue = $inputValue; |
542 | 542 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | ], |
546 | 546 | 'description' => [ |
547 | 547 | 'type' => Type::string(), |
548 | - 'resolve' => static function ($inputValue) { |
|
548 | + 'resolve' => static function($inputValue) { |
|
549 | 549 | /** @var FieldArgument|InputObjectField $inputValue */ |
550 | 550 | $inputValue = $inputValue; |
551 | 551 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | ], |
555 | 555 | 'type' => [ |
556 | 556 | 'type' => Type::nonNull(self::_type()), |
557 | - 'resolve' => static function ($value) { |
|
557 | + 'resolve' => static function($value) { |
|
558 | 558 | return method_exists($value, 'getType') |
559 | 559 | ? $value->getType() |
560 | 560 | : $value->type; |
@@ -564,11 +564,11 @@ discard block |
||
564 | 564 | 'type' => Type::string(), |
565 | 565 | 'description' => |
566 | 566 | 'A GraphQL-formatted string representing the default value for this input value.', |
567 | - 'resolve' => static function ($inputValue) { |
|
567 | + 'resolve' => static function($inputValue) { |
|
568 | 568 | /** @var FieldArgument|InputObjectField $inputValue */ |
569 | 569 | $inputValue = $inputValue; |
570 | 570 | |
571 | - return ! $inputValue->defaultValueExists() |
|
571 | + return !$inputValue->defaultValueExists() |
|
572 | 572 | ? null |
573 | 573 | : Printer::doPrint(AST::astFromValue( |
574 | 574 | $inputValue->defaultValue, |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | |
587 | 587 | public static function _enumValue() |
588 | 588 | { |
589 | - if (! isset(self::$map['__EnumValue'])) { |
|
589 | + if (!isset(self::$map['__EnumValue'])) { |
|
590 | 590 | self::$map['__EnumValue'] = new ObjectType([ |
591 | 591 | 'name' => '__EnumValue', |
592 | 592 | 'isIntrospection' => true, |
@@ -597,25 +597,25 @@ discard block |
||
597 | 597 | 'fields' => [ |
598 | 598 | 'name' => [ |
599 | 599 | 'type' => Type::nonNull(Type::string()), |
600 | - 'resolve' => static function ($enumValue) { |
|
600 | + 'resolve' => static function($enumValue) { |
|
601 | 601 | return $enumValue->name; |
602 | 602 | }, |
603 | 603 | ], |
604 | 604 | 'description' => [ |
605 | 605 | 'type' => Type::string(), |
606 | - 'resolve' => static function ($enumValue) { |
|
606 | + 'resolve' => static function($enumValue) { |
|
607 | 607 | return $enumValue->description; |
608 | 608 | }, |
609 | 609 | ], |
610 | 610 | 'isDeprecated' => [ |
611 | 611 | 'type' => Type::nonNull(Type::boolean()), |
612 | - 'resolve' => static function ($enumValue) { |
|
612 | + 'resolve' => static function($enumValue) { |
|
613 | 613 | return (bool) $enumValue->deprecationReason; |
614 | 614 | }, |
615 | 615 | ], |
616 | 616 | 'deprecationReason' => [ |
617 | 617 | 'type' => Type::string(), |
618 | - 'resolve' => static function ($enumValue) { |
|
618 | + 'resolve' => static function($enumValue) { |
|
619 | 619 | return $enumValue->deprecationReason; |
620 | 620 | }, |
621 | 621 | ], |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | public static function _directive() |
630 | 630 | { |
631 | - if (! isset(self::$map['__Directive'])) { |
|
631 | + if (!isset(self::$map['__Directive'])) { |
|
632 | 632 | self::$map['__Directive'] = new ObjectType([ |
633 | 633 | 'name' => '__Directive', |
634 | 634 | 'isIntrospection' => true, |
@@ -641,13 +641,13 @@ discard block |
||
641 | 641 | 'fields' => [ |
642 | 642 | 'name' => [ |
643 | 643 | 'type' => Type::nonNull(Type::string()), |
644 | - 'resolve' => static function ($obj) { |
|
644 | + 'resolve' => static function($obj) { |
|
645 | 645 | return $obj->name; |
646 | 646 | }, |
647 | 647 | ], |
648 | 648 | 'description' => [ |
649 | 649 | 'type' => Type::string(), |
650 | - 'resolve' => static function ($obj) { |
|
650 | + 'resolve' => static function($obj) { |
|
651 | 651 | return $obj->description; |
652 | 652 | }, |
653 | 653 | ], |
@@ -655,13 +655,13 @@ discard block |
||
655 | 655 | 'type' => Type::nonNull(Type::listOf(Type::nonNull( |
656 | 656 | self::_directiveLocation() |
657 | 657 | ))), |
658 | - 'resolve' => static function ($obj) { |
|
658 | + 'resolve' => static function($obj) { |
|
659 | 659 | return $obj->locations; |
660 | 660 | }, |
661 | 661 | ], |
662 | 662 | 'args' => [ |
663 | 663 | 'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))), |
664 | - 'resolve' => static function (Directive $directive) { |
|
664 | + 'resolve' => static function(Directive $directive) { |
|
665 | 665 | return $directive->args ?: []; |
666 | 666 | }, |
667 | 667 | ], |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | |
675 | 675 | public static function _directiveLocation() |
676 | 676 | { |
677 | - if (! isset(self::$map['__DirectiveLocation'])) { |
|
677 | + if (!isset(self::$map['__DirectiveLocation'])) { |
|
678 | 678 | self::$map['__DirectiveLocation'] = new EnumType([ |
679 | 679 | 'name' => '__DirectiveLocation', |
680 | 680 | 'isIntrospection' => true, |
@@ -768,13 +768,13 @@ discard block |
||
768 | 768 | |
769 | 769 | public static function schemaMetaFieldDef() : FieldDefinition |
770 | 770 | { |
771 | - if (! isset(self::$map[self::SCHEMA_FIELD_NAME])) { |
|
771 | + if (!isset(self::$map[self::SCHEMA_FIELD_NAME])) { |
|
772 | 772 | self::$map[self::SCHEMA_FIELD_NAME] = FieldDefinition::create([ |
773 | 773 | 'name' => self::SCHEMA_FIELD_NAME, |
774 | 774 | 'type' => Type::nonNull(self::_schema()), |
775 | 775 | 'description' => 'Access the current type schema of this server.', |
776 | 776 | 'args' => [], |
777 | - 'resolve' => static function ( |
|
777 | + 'resolve' => static function( |
|
778 | 778 | $source, |
779 | 779 | $args, |
780 | 780 | $context, |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | |
791 | 791 | public static function typeMetaFieldDef() : FieldDefinition |
792 | 792 | { |
793 | - if (! isset(self::$map[self::TYPE_FIELD_NAME])) { |
|
793 | + if (!isset(self::$map[self::TYPE_FIELD_NAME])) { |
|
794 | 794 | self::$map[self::TYPE_FIELD_NAME] = FieldDefinition::create([ |
795 | 795 | 'name' => self::TYPE_FIELD_NAME, |
796 | 796 | 'type' => self::_type(), |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | 'args' => [ |
799 | 799 | ['name' => 'name', 'type' => Type::nonNull(Type::string())], |
800 | 800 | ], |
801 | - 'resolve' => static function ($source, $args, $context, ResolveInfo $info) { |
|
801 | + 'resolve' => static function($source, $args, $context, ResolveInfo $info) { |
|
802 | 802 | return $info->schema->getType($args['name']); |
803 | 803 | }, |
804 | 804 | ]); |
@@ -809,13 +809,13 @@ discard block |
||
809 | 809 | |
810 | 810 | public static function typeNameMetaFieldDef() : FieldDefinition |
811 | 811 | { |
812 | - if (! isset(self::$map[self::TYPE_NAME_FIELD_NAME])) { |
|
812 | + if (!isset(self::$map[self::TYPE_NAME_FIELD_NAME])) { |
|
813 | 813 | self::$map[self::TYPE_NAME_FIELD_NAME] = FieldDefinition::create([ |
814 | 814 | 'name' => self::TYPE_NAME_FIELD_NAME, |
815 | 815 | 'type' => Type::nonNull(Type::string()), |
816 | 816 | 'description' => 'The name of the current Object type at runtime.', |
817 | 817 | 'args' => [], |
818 | - 'resolve' => static function ( |
|
818 | + 'resolve' => static function( |
|
819 | 819 | $source, |
820 | 820 | $args, |
821 | 821 | $context, |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | public function buildSchema() : Schema |
88 | 88 | { |
89 | - if (! array_key_exists('__schema', $this->introspection)) { |
|
89 | + if (!array_key_exists('__schema', $this->introspection)) { |
|
90 | 90 | throw new InvariantViolation('Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ' . json_encode($this->introspection) . '.'); |
91 | 91 | } |
92 | 92 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | |
95 | 95 | $this->typeMap = Utils::keyValMap( |
96 | 96 | $schemaIntrospection['types'], |
97 | - static function (array $typeIntrospection) { |
|
97 | + static function(array $typeIntrospection) { |
|
98 | 98 | return $typeIntrospection['name']; |
99 | 99 | }, |
100 | - function (array $typeIntrospection) : NamedType { |
|
100 | + function(array $typeIntrospection) : NamedType { |
|
101 | 101 | return $this->buildType($typeIntrospection); |
102 | 102 | } |
103 | 103 | ); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | Introspection::getTypes() |
108 | 108 | ); |
109 | 109 | foreach ($builtInTypes as $name => $type) { |
110 | - if (! isset($this->typeMap[$name])) { |
|
110 | + if (!isset($this->typeMap[$name])) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | if (isset($typeRef['kind'])) { |
157 | 157 | if ($typeRef['kind'] === TypeKind::LIST) { |
158 | - if (! isset($typeRef['ofType'])) { |
|
158 | + if (!isset($typeRef['ofType'])) { |
|
159 | 159 | throw new InvariantViolation('Decorated type deeper than introspection query.'); |
160 | 160 | } |
161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | if ($typeRef['kind'] === TypeKind::NON_NULL) { |
166 | - if (! isset($typeRef['ofType'])) { |
|
166 | + if (!isset($typeRef['ofType'])) { |
|
167 | 167 | throw new InvariantViolation('Decorated type deeper than introspection query.'); |
168 | 168 | } |
169 | 169 | /** @var NullableType $nullableType */ |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | - if (! isset($typeRef['name'])) { |
|
176 | + if (!isset($typeRef['name'])) { |
|
177 | 177 | throw new InvariantViolation('Unknown type reference: ' . json_encode($typeRef) . '.'); |
178 | 178 | } |
179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | private function getNamedType(string $typeName) : NamedType |
187 | 187 | { |
188 | - if (! isset($this->typeMap[$typeName])) { |
|
188 | + if (!isset($this->typeMap[$typeName])) { |
|
189 | 189 | throw new InvariantViolation( |
190 | 190 | "Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema." |
191 | 191 | ); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | return new CustomScalarType([ |
278 | 278 | 'name' => $scalar['name'], |
279 | 279 | 'description' => $scalar['description'], |
280 | - 'serialize' => static function ($value) : string { |
|
280 | + 'serialize' => static function($value) : string { |
|
281 | 281 | return (string) $value; |
282 | 282 | }, |
283 | 283 | ]); |
@@ -288,21 +288,21 @@ discard block |
||
288 | 288 | */ |
289 | 289 | private function buildObjectDef(array $object) : ObjectType |
290 | 290 | { |
291 | - if (! array_key_exists('interfaces', $object)) { |
|
291 | + if (!array_key_exists('interfaces', $object)) { |
|
292 | 292 | throw new InvariantViolation('Introspection result missing interfaces: ' . json_encode($object) . '.'); |
293 | 293 | } |
294 | 294 | |
295 | 295 | return new ObjectType([ |
296 | 296 | 'name' => $object['name'], |
297 | 297 | 'description' => $object['description'], |
298 | - 'interfaces' => function () use ($object) : array { |
|
298 | + 'interfaces' => function() use ($object) : array { |
|
299 | 299 | return array_map( |
300 | 300 | [$this, 'getInterfaceType'], |
301 | 301 | // Legacy support for interfaces with null as interfaces field |
302 | 302 | $object['interfaces'] ?? [] |
303 | 303 | ); |
304 | 304 | }, |
305 | - 'fields' => function () use ($object) { |
|
305 | + 'fields' => function() use ($object) { |
|
306 | 306 | return $this->buildFieldDefMap($object); |
307 | 307 | }, |
308 | 308 | ]); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | return new InterfaceType([ |
317 | 317 | 'name' => $interface['name'], |
318 | 318 | 'description' => $interface['description'], |
319 | - 'fields' => function () use ($interface) { |
|
319 | + 'fields' => function() use ($interface) { |
|
320 | 320 | return $this->buildFieldDefMap($interface); |
321 | 321 | }, |
322 | 322 | ]); |
@@ -327,14 +327,14 @@ discard block |
||
327 | 327 | */ |
328 | 328 | private function buildUnionDef(array $union) : UnionType |
329 | 329 | { |
330 | - if (! array_key_exists('possibleTypes', $union)) { |
|
330 | + if (!array_key_exists('possibleTypes', $union)) { |
|
331 | 331 | throw new InvariantViolation('Introspection result missing possibleTypes: ' . json_encode($union) . '.'); |
332 | 332 | } |
333 | 333 | |
334 | 334 | return new UnionType([ |
335 | 335 | 'name' => $union['name'], |
336 | 336 | 'description' => $union['description'], |
337 | - 'types' => function () use ($union) : array { |
|
337 | + 'types' => function() use ($union) : array { |
|
338 | 338 | return array_map( |
339 | 339 | [$this, 'getObjectType'], |
340 | 340 | $union['possibleTypes'] |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | private function buildEnumDef(array $enum) : EnumType |
350 | 350 | { |
351 | - if (! array_key_exists('enumValues', $enum)) { |
|
351 | + if (!array_key_exists('enumValues', $enum)) { |
|
352 | 352 | throw new InvariantViolation('Introspection result missing enumValues: ' . json_encode($enum) . '.'); |
353 | 353 | } |
354 | 354 | |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | 'description' => $enum['description'], |
358 | 358 | 'values' => Utils::keyValMap( |
359 | 359 | $enum['enumValues'], |
360 | - static function (array $enumValue) : string { |
|
360 | + static function(array $enumValue) : string { |
|
361 | 361 | return $enumValue['name']; |
362 | 362 | }, |
363 | - static function (array $enumValue) : array { |
|
363 | + static function(array $enumValue) : array { |
|
364 | 364 | return [ |
365 | 365 | 'description' => $enumValue['description'], |
366 | 366 | 'deprecationReason' => $enumValue['deprecationReason'], |
@@ -375,14 +375,14 @@ discard block |
||
375 | 375 | */ |
376 | 376 | private function buildInputObjectDef(array $inputObject) : InputObjectType |
377 | 377 | { |
378 | - if (! array_key_exists('inputFields', $inputObject)) { |
|
378 | + if (!array_key_exists('inputFields', $inputObject)) { |
|
379 | 379 | throw new InvariantViolation('Introspection result missing inputFields: ' . json_encode($inputObject) . '.'); |
380 | 380 | } |
381 | 381 | |
382 | 382 | return new InputObjectType([ |
383 | 383 | 'name' => $inputObject['name'], |
384 | 384 | 'description' => $inputObject['description'], |
385 | - 'fields' => function () use ($inputObject) : array { |
|
385 | + 'fields' => function() use ($inputObject) : array { |
|
386 | 386 | return $this->buildInputValueDefMap($inputObject['inputFields']); |
387 | 387 | }, |
388 | 388 | ]); |
@@ -393,17 +393,17 @@ discard block |
||
393 | 393 | */ |
394 | 394 | private function buildFieldDefMap(array $typeIntrospection) |
395 | 395 | { |
396 | - if (! array_key_exists('fields', $typeIntrospection)) { |
|
396 | + if (!array_key_exists('fields', $typeIntrospection)) { |
|
397 | 397 | throw new InvariantViolation('Introspection result missing fields: ' . json_encode($typeIntrospection) . '.'); |
398 | 398 | } |
399 | 399 | |
400 | 400 | return Utils::keyValMap( |
401 | 401 | $typeIntrospection['fields'], |
402 | - static function (array $fieldIntrospection) : string { |
|
402 | + static function(array $fieldIntrospection) : string { |
|
403 | 403 | return $fieldIntrospection['name']; |
404 | 404 | }, |
405 | - function (array $fieldIntrospection) : array { |
|
406 | - if (! array_key_exists('args', $fieldIntrospection)) { |
|
405 | + function(array $fieldIntrospection) : array { |
|
406 | + if (!array_key_exists('args', $fieldIntrospection)) { |
|
407 | 407 | throw new InvariantViolation('Introspection result missing field args: ' . json_encode($fieldIntrospection) . '.'); |
408 | 408 | } |
409 | 409 | |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | { |
427 | 427 | return Utils::keyValMap( |
428 | 428 | $inputValueIntrospections, |
429 | - static function (array $inputValue) : string { |
|
429 | + static function(array $inputValue) : string { |
|
430 | 430 | return $inputValue['name']; |
431 | 431 | }, |
432 | 432 | [$this, 'buildInputValue'] |
@@ -462,10 +462,10 @@ discard block |
||
462 | 462 | */ |
463 | 463 | public function buildDirective(array $directive) : Directive |
464 | 464 | { |
465 | - if (! array_key_exists('args', $directive)) { |
|
465 | + if (!array_key_exists('args', $directive)) { |
|
466 | 466 | throw new InvariantViolation('Introspection result missing directive args: ' . json_encode($directive) . '.'); |
467 | 467 | } |
468 | - if (! array_key_exists('locations', $directive)) { |
|
468 | + if (!array_key_exists('locations', $directive)) { |
|
469 | 469 | throw new InvariantViolation('Introspection result missing directive locations: ' . json_encode($directive) . '.'); |
470 | 470 | } |
471 | 471 |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public static function fromArray(array $node) : Node |
90 | 90 | { |
91 | - if (! isset($node['kind']) || ! isset(NodeKind::$classMap[$node['kind']])) { |
|
91 | + if (!isset($node['kind']) || !isset(NodeKind::$classMap[$node['kind']])) { |
|
92 | 92 | throw new InvariantViolation('Unexpected node structure: ' . Utils::printSafeJson($node)); |
93 | 93 | } |
94 | 94 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $valuesNodes = []; |
177 | 177 | foreach ($value as $item) { |
178 | 178 | $itemNode = self::astFromValue($item, $itemType); |
179 | - if (! $itemNode) { |
|
179 | + if (!$itemNode) { |
|
180 | 180 | continue; |
181 | 181 | } |
182 | 182 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | if ($type instanceof InputObjectType) { |
195 | 195 | $isArray = is_array($value); |
196 | 196 | $isArrayLike = $isArray || $value instanceof ArrayAccess; |
197 | - if ($value === null || (! $isArrayLike && ! is_object($value))) { |
|
197 | + if ($value === null || (!$isArrayLike && !is_object($value))) { |
|
198 | 198 | return null; |
199 | 199 | } |
200 | 200 | $fields = $type->getFields(); |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | $fieldExists = property_exists($value, $fieldName); |
219 | 219 | } |
220 | 220 | |
221 | - if (! $fieldExists) { |
|
221 | + if (!$fieldExists) { |
|
222 | 222 | continue; |
223 | 223 | } |
224 | 224 | |
225 | 225 | $fieldNode = self::astFromValue($fieldValue, $field->getType()); |
226 | 226 | |
227 | - if (! $fieldNode) { |
|
227 | + if (!$fieldNode) { |
|
228 | 228 | continue; |
229 | 229 | } |
230 | 230 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | if ($valueNode instanceof VariableNode) { |
344 | 344 | $variableName = $valueNode->name->value; |
345 | 345 | |
346 | - if (! $variables || ! array_key_exists($variableName, $variables)) { |
|
346 | + if (!$variables || !array_key_exists($variableName, $variables)) { |
|
347 | 347 | // No valid return value. |
348 | 348 | return $undefined; |
349 | 349 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | } |
397 | 397 | |
398 | 398 | if ($type instanceof InputObjectType) { |
399 | - if (! $valueNode instanceof ObjectValueNode) { |
|
399 | + if (!$valueNode instanceof ObjectValueNode) { |
|
400 | 400 | // Invalid: intentionally return no value. |
401 | 401 | return $undefined; |
402 | 402 | } |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $fields = $type->getFields(); |
406 | 406 | $fieldNodes = Utils::keyMap( |
407 | 407 | $valueNode->fields, |
408 | - static function ($field) { |
|
408 | + static function($field) { |
|
409 | 409 | return $field->name->value; |
410 | 410 | } |
411 | 411 | ); |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | } |
442 | 442 | |
443 | 443 | if ($type instanceof EnumType) { |
444 | - if (! $valueNode instanceof EnumValueNode) { |
|
444 | + if (!$valueNode instanceof EnumValueNode) { |
|
445 | 445 | return $undefined; |
446 | 446 | } |
447 | 447 | $enumValue = $type->getValue($valueNode->value); |
448 | - if (! $enumValue) { |
|
448 | + if (!$enumValue) { |
|
449 | 449 | return $undefined; |
450 | 450 | } |
451 | 451 | |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | private static function isMissingVariable(ValueNode $valueNode, $variables) |
479 | 479 | { |
480 | 480 | return $valueNode instanceof VariableNode && |
481 | - (count($variables) === 0 || ! array_key_exists($valueNode->name->value, $variables)); |
|
481 | + (count($variables) === 0 || !array_key_exists($valueNode->name->value, $variables)); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | /** |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | return $valueNode->value; |
522 | 522 | case $valueNode instanceof ListValueNode: |
523 | 523 | return array_map( |
524 | - static function ($node) use ($variables) { |
|
524 | + static function($node) use ($variables) { |
|
525 | 525 | return self::valueFromASTUntyped($node, $variables); |
526 | 526 | }, |
527 | 527 | iterator_to_array($valueNode->values) |
@@ -529,13 +529,13 @@ discard block |
||
529 | 529 | case $valueNode instanceof ObjectValueNode: |
530 | 530 | return array_combine( |
531 | 531 | array_map( |
532 | - static function ($field) : string { |
|
532 | + static function($field) : string { |
|
533 | 533 | return $field->name->value; |
534 | 534 | }, |
535 | 535 | iterator_to_array($valueNode->fields) |
536 | 536 | ), |
537 | 537 | array_map( |
538 | - static function ($field) use ($variables) { |
|
538 | + static function($field) use ($variables) { |
|
539 | 539 | return self::valueFromASTUntyped($field->value, $variables); |
540 | 540 | }, |
541 | 541 | iterator_to_array($valueNode->fields) |
@@ -595,11 +595,11 @@ discard block |
||
595 | 595 | { |
596 | 596 | if ($document->definitions) { |
597 | 597 | foreach ($document->definitions as $def) { |
598 | - if (! ($def instanceof OperationDefinitionNode)) { |
|
598 | + if (!($def instanceof OperationDefinitionNode)) { |
|
599 | 599 | continue; |
600 | 600 | } |
601 | 601 | |
602 | - if (! $operationName || (isset($def->name->value) && $def->name->value === $operationName)) { |
|
602 | + if (!$operationName || (isset($def->name->value) && $def->name->value === $operationName)) { |
|
603 | 603 | return $def->operation; |
604 | 604 | } |
605 | 605 | } |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | public static function assign($obj, array $vars, array $requiredKeys = []) |
84 | 84 | { |
85 | 85 | foreach ($requiredKeys as $key) { |
86 | - if (! isset($vars[$key])) { |
|
86 | + if (!isset($vars[$key])) { |
|
87 | 87 | throw new InvalidArgumentException(sprintf('Key %s is expected to be set and not to be null', $key)); |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | 91 | foreach ($vars as $key => $value) { |
92 | - if (! property_exists($obj, $key)) { |
|
92 | + if (!property_exists($obj, $key)) { |
|
93 | 93 | $cls = get_class($obj); |
94 | 94 | Warning::warn( |
95 | 95 | sprintf("Trying to set non-existing property '%s' on class '%s'", $key, $cls), |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | $result = []; |
141 | 141 | $assoc = false; |
142 | 142 | foreach ($iterable as $key => $value) { |
143 | - if (! $assoc && ! is_int($key)) { |
|
143 | + if (!$assoc && !is_int($key)) { |
|
144 | 144 | $assoc = true; |
145 | 145 | } |
146 | - if (! $predicate($value, $key)) { |
|
146 | + if (!$predicate($value, $key)) { |
|
147 | 147 | continue; |
148 | 148 | } |
149 | 149 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $map = []; |
216 | 216 | foreach ($iterable as $key => $value) { |
217 | 217 | $newKey = $keyFn($value, $key); |
218 | - if (! is_scalar($newKey)) { |
|
218 | + if (!is_scalar($newKey)) { |
|
219 | 219 | continue; |
220 | 220 | } |
221 | 221 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | public static function every($iterable, callable $predicate) : bool |
296 | 296 | { |
297 | 297 | foreach ($iterable as $key => $value) { |
298 | - if (! $predicate($value, $key)) { |
|
298 | + if (!$predicate($value, $key)) { |
|
299 | 299 | return false; |
300 | 300 | } |
301 | 301 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | */ |
324 | 324 | public static function invariant($test, $message = '') |
325 | 325 | { |
326 | - if (! $test) { |
|
326 | + if (!$test) { |
|
327 | 327 | if (func_num_args() > 2) { |
328 | 328 | $args = func_get_args(); |
329 | 329 | array_shift($args); |
@@ -457,10 +457,10 @@ discard block |
||
457 | 457 | */ |
458 | 458 | public static function ord($char, $encoding = 'UTF-8') |
459 | 459 | { |
460 | - if (! $char && $char !== '0') { |
|
460 | + if (!$char && $char !== '0') { |
|
461 | 461 | return 0; |
462 | 462 | } |
463 | - if (! isset($char[1])) { |
|
463 | + if (!isset($char[1])) { |
|
464 | 464 | return ord($char); |
465 | 465 | } |
466 | 466 | if ($encoding !== 'UCS-4BE') { |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | ); |
539 | 539 | } |
540 | 540 | |
541 | - if (! preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) { |
|
541 | + if (!preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) { |
|
542 | 542 | return new Error( |
543 | 543 | sprintf('Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "%s" does not.', $name), |
544 | 544 | $node |
@@ -558,9 +558,9 @@ discard block |
||
558 | 558 | */ |
559 | 559 | public static function withErrorHandling(callable $fn, array &$errors) |
560 | 560 | { |
561 | - return static function () use ($fn, &$errors) { |
|
561 | + return static function() use ($fn, &$errors) { |
|
562 | 562 | // Catch custom errors (to report them in query results) |
563 | - set_error_handler(static function ($severity, $message, $file, $line) use (&$errors) { |
|
563 | + set_error_handler(static function($severity, $message, $file, $line) use (&$errors) { |
|
564 | 564 | $errors[] = new ErrorException($message, 0, $severity, $file, $line); |
565 | 565 | }); |
566 | 566 | |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | public static function quotedOrList(array $items) |
581 | 581 | { |
582 | 582 | $items = array_map( |
583 | - static function ($item) { |
|
583 | + static function($item) { |
|
584 | 584 | return sprintf('"%s"', $item); |
585 | 585 | }, |
586 | 586 | $items |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | |
610 | 610 | return array_reduce( |
611 | 611 | range(1, $selectedLength - 1), |
612 | - static function ($list, $index) use ($selected, $selectedLength) { |
|
612 | + static function($list, $index) use ($selected, $selectedLength) { |
|
613 | 613 | return $list . |
614 | 614 | ($selectedLength > 2 ? ', ' : ' ') . |
615 | 615 | ($index === $selectedLength - 1 ? 'or ' : '') . |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | { |
52 | 52 | return self::printFilteredSchema( |
53 | 53 | $schema, |
54 | - static function ($type) { |
|
55 | - return ! Directive::isSpecifiedDirective($type); |
|
54 | + static function($type) { |
|
55 | + return !Directive::isSpecifiedDirective($type); |
|
56 | 56 | }, |
57 | - static function ($type) { |
|
58 | - return ! Type::isBuiltInType($type); |
|
57 | + static function($type) { |
|
58 | + return !Type::isBuiltInType($type); |
|
59 | 59 | }, |
60 | 60 | $options |
61 | 61 | ); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $directives = array_filter( |
70 | 70 | $schema->getDirectives(), |
71 | - static function ($directive) use ($directiveFilter) { |
|
71 | + static function($directive) use ($directiveFilter) { |
|
72 | 72 | return $directiveFilter($directive); |
73 | 73 | } |
74 | 74 | ); |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | array_merge( |
86 | 86 | [self::printSchemaDefinition($schema)], |
87 | 87 | array_map( |
88 | - static function ($directive) use ($options) { |
|
88 | + static function($directive) use ($options) { |
|
89 | 89 | return self::printDirective($directive, $options); |
90 | 90 | }, |
91 | 91 | $directives |
92 | 92 | ), |
93 | 93 | array_map( |
94 | - static function ($type) use ($options) { |
|
94 | + static function($type) use ($options) { |
|
95 | 95 | return self::printType($type, $options); |
96 | 96 | }, |
97 | 97 | $types |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | private static function printDescription($options, $def, $indentation = '', $firstInBlock = true) : string |
168 | 168 | { |
169 | - if (! $def->description) { |
|
169 | + if (!$def->description) { |
|
170 | 170 | return ''; |
171 | 171 | } |
172 | 172 | $lines = self::descriptionLines($def->description, 120 - strlen($indentation)); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | return self::printDescriptionWithComments($lines, $indentation, $firstInBlock); |
175 | 175 | } |
176 | 176 | |
177 | - $description = $indentation && ! $firstInBlock |
|
177 | + $description = $indentation && !$firstInBlock |
|
178 | 178 | ? "\n" . $indentation . '"""' |
179 | 179 | : $indentation . '"""'; |
180 | 180 | |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | substr($lines[0], 0, 1) === ' ' || |
193 | 193 | substr($lines[0], 0, 1) === '\t' |
194 | 194 | ); |
195 | - if (! $hasLeadingSpace) { |
|
195 | + if (!$hasLeadingSpace) { |
|
196 | 196 | $description .= "\n"; |
197 | 197 | } |
198 | 198 | |
199 | 199 | $lineLength = count($lines); |
200 | 200 | for ($i = 0; $i < $lineLength; $i++) { |
201 | - if ($i !== 0 || ! $hasLeadingSpace) { |
|
201 | + if ($i !== 0 || !$hasLeadingSpace) { |
|
202 | 202 | $description .= $indentation; |
203 | 203 | } |
204 | 204 | $description .= self::escapeQuote($lines[$i]) . "\n"; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | private static function printDescriptionWithComments($lines, $indentation, $firstInBlock) : string |
249 | 249 | { |
250 | - $description = $indentation && ! $firstInBlock ? "\n" : ''; |
|
250 | + $description = $indentation && !$firstInBlock ? "\n" : ''; |
|
251 | 251 | foreach ($lines as $line) { |
252 | 252 | if ($line === '') { |
253 | 253 | $description .= $indentation . "#\n"; |
@@ -266,14 +266,14 @@ discard block |
||
266 | 266 | |
267 | 267 | private static function printArgs($options, $args, $indentation = '') : string |
268 | 268 | { |
269 | - if (! $args) { |
|
269 | + if (!$args) { |
|
270 | 270 | return ''; |
271 | 271 | } |
272 | 272 | |
273 | 273 | // If every arg does not have a description, print them on one line. |
274 | 274 | if (Utils::every( |
275 | 275 | $args, |
276 | - static function ($arg) { |
|
276 | + static function($arg) { |
|
277 | 277 | return empty($arg->description); |
278 | 278 | } |
279 | 279 | )) { |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | implode( |
286 | 286 | "\n", |
287 | 287 | array_map( |
288 | - static function ($arg, $i) use ($indentation, $options) { |
|
289 | - return self::printDescription($options, $arg, ' ' . $indentation, ! $i) . ' ' . $indentation . |
|
288 | + static function($arg, $i) use ($indentation, $options) { |
|
289 | + return self::printDescription($options, $arg, ' ' . $indentation, !$i) . ' ' . $indentation . |
|
290 | 290 | self::printInputValue($arg); |
291 | 291 | }, |
292 | 292 | $args, |
@@ -353,11 +353,11 @@ discard block |
||
353 | 353 | private static function printObject(ObjectType $type, array $options) : string |
354 | 354 | { |
355 | 355 | $interfaces = $type->getInterfaces(); |
356 | - $implementedInterfaces = ! empty($interfaces) |
|
356 | + $implementedInterfaces = !empty($interfaces) |
|
357 | 357 | ? ' implements ' . implode( |
358 | 358 | ' & ', |
359 | 359 | array_map( |
360 | - static function ($i) { |
|
360 | + static function($i) { |
|
361 | 361 | return $i->name; |
362 | 362 | }, |
363 | 363 | $interfaces |
@@ -379,8 +379,8 @@ discard block |
||
379 | 379 | return implode( |
380 | 380 | "\n", |
381 | 381 | array_map( |
382 | - static function ($f, $i) use ($options) { |
|
383 | - return self::printDescription($options, $f, ' ', ! $i) . ' ' . |
|
382 | + static function($f, $i) use ($options) { |
|
383 | + return self::printDescription($options, $f, ' ', !$i) . ' ' . |
|
384 | 384 | $f->name . self::printArgs($options, $f->args, ' ') . ': ' . |
385 | 385 | (string) $f->getType() . self::printDeprecated($f); |
386 | 386 | }, |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | return implode( |
440 | 440 | "\n", |
441 | 441 | array_map( |
442 | - static function ($value, $i) use ($options) { |
|
443 | - return self::printDescription($options, $value, ' ', ! $i) . ' ' . |
|
442 | + static function($value, $i) use ($options) { |
|
443 | + return self::printDescription($options, $value, ' ', !$i) . ' ' . |
|
444 | 444 | $value->name . self::printDeprecated($value); |
445 | 445 | }, |
446 | 446 | $values, |
@@ -463,8 +463,8 @@ discard block |
||
463 | 463 | implode( |
464 | 464 | "\n", |
465 | 465 | array_map( |
466 | - static function ($f, $i) use ($options) { |
|
467 | - return self::printDescription($options, $f, ' ', ! $i) . ' ' . self::printInputValue($f); |
|
466 | + static function($f, $i) use ($options) { |
|
467 | + return self::printDescription($options, $f, ' ', !$i) . ' ' . self::printInputValue($f); |
|
468 | 468 | }, |
469 | 469 | $fields, |
470 | 470 | array_keys($fields) |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function then(Promise $promise, ?callable $onFulfilled = null, ?callable $onRejected = null) : Promise |
39 | 39 | { |
40 | 40 | $deferred = new Deferred(); |
41 | - $onResolve = static function (?Throwable $reason, $value) use ($onFulfilled, $onRejected, $deferred) : void { |
|
41 | + $onResolve = static function(?Throwable $reason, $value) use ($onFulfilled, $onRejected, $deferred) : void { |
|
42 | 42 | if ($reason === null && $onFulfilled !== null) { |
43 | 43 | self::resolveWithCallable($deferred, $onFulfilled, $value); |
44 | 44 | } elseif ($reason === null) { |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | $deferred = new Deferred(); |
66 | 66 | |
67 | 67 | $resolver( |
68 | - static function ($value) use ($deferred) : void { |
|
68 | + static function($value) use ($deferred) : void { |
|
69 | 69 | $deferred->resolve($value); |
70 | 70 | }, |
71 | - static function (Throwable $exception) use ($deferred) : void { |
|
71 | + static function(Throwable $exception) use ($deferred) : void { |
|
72 | 72 | $deferred->fail($exception); |
73 | 73 | } |
74 | 74 | ); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $deferred = new Deferred(); |
115 | 115 | |
116 | - $onResolve = static function (?Throwable $reason, ?array $values) use ($promisesOrValues, $deferred) : void { |
|
116 | + $onResolve = static function(?Throwable $reason, ?array $values) use ($promisesOrValues, $deferred) : void { |
|
117 | 117 | if ($reason === null) { |
118 | 118 | $deferred->resolve(array_replace($promisesOrValues, $values)); |
119 | 119 |