@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $queryComplexity->setRawVariableValues($variableValues); |
| 142 | 142 | } else { |
| 143 | 143 | foreach ($validationRules as $rule) { |
| 144 | - if (! ($rule instanceof QueryComplexity)) { |
|
| 144 | + if (!($rule instanceof QueryComplexity)) { |
|
| 145 | 145 | continue; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | $validationErrors = DocumentValidator::validate($schema, $documentNode, $validationRules); |
| 153 | 153 | |
| 154 | - if (! empty($validationErrors)) { |
|
| 154 | + if (!empty($validationErrors)) { |
|
| 155 | 155 | return $promiseAdapter->createFulfilled( |
| 156 | 156 | new ExecutionResult(null, $validationErrors) |
| 157 | 157 | ); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | if ($promiseAdapter instanceof SyncPromiseAdapter) { |
| 214 | 214 | $result = $promiseAdapter->wait($result)->toArray(); |
| 215 | 215 | } else { |
| 216 | - $result = $result->then(static function (ExecutionResult $r) { |
|
| 216 | + $result = $result->then(static function(ExecutionResult $r) { |
|
| 217 | 217 | return $r->toArray(); |
| 218 | 218 | }); |
| 219 | 219 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $fieldName = $fieldNode->name->value; |
| 128 | 128 | |
| 129 | 129 | $argumentValueMap = null; |
| 130 | - if (! empty($fieldNode->arguments)) { |
|
| 130 | + if (!empty($fieldNode->arguments)) { |
|
| 131 | 131 | foreach ($fieldNode->arguments as $argumentNode) { |
| 132 | 132 | $argumentValueMap = $argumentValueMap ?? []; |
| 133 | 133 | $argumentValueMap[$argumentNode->name->value] = $argumentNode->value; |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if ($fieldName !== Introspection::TYPE_NAME_FIELD_NAME && |
| 138 | - ! ($runtimeType === $this->schema->getQueryType() && ($fieldName === Introspection::SCHEMA_FIELD_NAME || $fieldName === Introspection::TYPE_FIELD_NAME)) && |
|
| 139 | - ! $runtimeType->hasField($fieldName) |
|
| 138 | + !($runtimeType === $this->schema->getQueryType() && ($fieldName === Introspection::SCHEMA_FIELD_NAME || $fieldName === Introspection::TYPE_FIELD_NAME)) && |
|
| 139 | + !$runtimeType->hasField($fieldName) |
|
| 140 | 140 | ) { |
| 141 | 141 | // do not emit error |
| 142 | 142 | continue; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | foreach ($selectionSet->selections as $selection) { |
| 156 | 156 | /** @var FieldNode|FragmentSpreadNode|InlineFragmentNode $selection */ |
| 157 | - if (! empty($selection->directives)) { |
|
| 157 | + if (!empty($selection->directives)) { |
|
| 158 | 158 | foreach ($selection->directives as $directiveNode) { |
| 159 | 159 | if ($directiveNode->name->value === Directive::SKIP_NAME) { |
| 160 | 160 | /** @var VariableNode|NullValueNode|IntValueNode|FloatValueNode|StringValueNode|BooleanValueNode|EnumValueNode|ListValueNode|ObjectValueNode|null $condition */ |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | if ($selection instanceof FieldNode) { |
| 204 | 204 | $resultName = $selection->alias === null ? $selection->name->value : $selection->alias->value; |
| 205 | 205 | |
| 206 | - if (! isset($this->fields[$resultName])) { |
|
| 206 | + if (!isset($this->fields[$resultName])) { |
|
| 207 | 207 | $this->fields[$resultName] = []; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | continue; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - if (! isset($this->fragments[$fragmentName])) { |
|
| 218 | + if (!isset($this->fragments[$fragmentName])) { |
|
| 219 | 219 | $this->runtime->addError(new Error( |
| 220 | 220 | sprintf('Fragment "%s" does not exist.', $fragmentName), |
| 221 | 221 | $selection |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $fragmentDefinition = $this->fragments[$fragmentName]; |
| 229 | 229 | $conditionTypeName = $fragmentDefinition->typeCondition->name->value; |
| 230 | 230 | |
| 231 | - if (! $this->schema->hasType($conditionTypeName)) { |
|
| 231 | + if (!$this->schema->hasType($conditionTypeName)) { |
|
| 232 | 232 | $this->runtime->addError(new Error( |
| 233 | 233 | sprintf('Cannot spread fragment "%s", type "%s" does not exist.', $fragmentName, $conditionTypeName), |
| 234 | 234 | $selection |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | continue; |
| 244 | 244 | } |
| 245 | 245 | } elseif ($conditionType instanceof AbstractType) { |
| 246 | - if (! $this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
| 246 | + if (!$this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
| 247 | 247 | continue; |
| 248 | 248 | } |
| 249 | 249 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | if ($selection->typeCondition !== null) { |
| 254 | 254 | $conditionTypeName = $selection->typeCondition->name->value; |
| 255 | 255 | |
| 256 | - if (! $this->schema->hasType($conditionTypeName)) { |
|
| 256 | + if (!$this->schema->hasType($conditionTypeName)) { |
|
| 257 | 257 | $this->runtime->addError(new Error( |
| 258 | 258 | sprintf('Cannot spread inline fragment, type "%s" does not exist.', $conditionTypeName), |
| 259 | 259 | $selection |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | continue; |
| 269 | 269 | } |
| 270 | 270 | } elseif ($conditionType instanceof AbstractType) { |
| 271 | - if (! $this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
| 271 | + if (!$this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
| 272 | 272 | continue; |
| 273 | 273 | } |
| 274 | 274 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $this->collector = new Collector($this->schema, $this); |
| 182 | 182 | $this->collector->initialize($this->documentNode, $this->operationName); |
| 183 | 183 | |
| 184 | - if (! empty($this->errors)) { |
|
| 184 | + if (!empty($this->errors)) { |
|
| 185 | 185 | return $this->promiseAdapter->createFulfilled($this->finishExecute(null, $this->errors)); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $this->rawVariableValues ?: [] |
| 192 | 192 | ); |
| 193 | 193 | |
| 194 | - if (! empty($errors)) { |
|
| 194 | + if (!empty($errors)) { |
|
| 195 | 195 | return $this->promiseAdapter->createFulfilled($this->finishExecute(null, $errors)); |
| 196 | 196 | } |
| 197 | 197 | |
@@ -212,11 +212,11 @@ discard block |
||
| 212 | 212 | ); |
| 213 | 213 | |
| 214 | 214 | $fieldDefinition = $this->findFieldDefinition($ctx); |
| 215 | - if (! $fieldDefinition->getType() instanceof NonNull) { |
|
| 215 | + if (!$fieldDefinition->getType() instanceof NonNull) { |
|
| 216 | 216 | $ctx->nullFence = [$shared->resultName]; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - if ($this->collector->operation->operation === 'mutation' && ! $this->queue->isEmpty()) { |
|
| 219 | + if ($this->collector->operation->operation === 'mutation' && !$this->queue->isEmpty()) { |
|
| 220 | 220 | $this->schedule->enqueue($ctx); |
| 221 | 221 | } else { |
| 222 | 222 | $this->queue->enqueue(new Strand($this->spawn($ctx))); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $this->run(); |
| 227 | 227 | |
| 228 | 228 | if ($this->pending > 0) { |
| 229 | - return $this->promiseAdapter->create(function (callable $resolve) { |
|
| 229 | + return $this->promiseAdapter->create(function(callable $resolve) { |
|
| 230 | 230 | $this->doResolve = $resolve; |
| 231 | 231 | }); |
| 232 | 232 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | private function run() |
| 277 | 277 | { |
| 278 | 278 | RUN: |
| 279 | - while (! $this->queue->isEmpty()) { |
|
| 279 | + while (!$this->queue->isEmpty()) { |
|
| 280 | 280 | /** @var Strand $strand */ |
| 281 | 281 | $strand = $this->queue->dequeue(); |
| 282 | 282 | |
@@ -306,20 +306,20 @@ discard block |
||
| 306 | 306 | // !!! increment pending before calling ->then() as it may invoke the callback right away |
| 307 | 307 | ++$this->pending; |
| 308 | 308 | |
| 309 | - if (! $value instanceof Promise) { |
|
| 309 | + if (!$value instanceof Promise) { |
|
| 310 | 310 | $value = $this->promiseAdapter->convertThenable($value); |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | $this->promiseAdapter |
| 314 | 314 | ->then( |
| 315 | 315 | $value, |
| 316 | - function ($value) use ($strand) { |
|
| 316 | + function($value) use ($strand) { |
|
| 317 | 317 | $strand->success = true; |
| 318 | 318 | $strand->value = $value; |
| 319 | 319 | $this->queue->enqueue($strand); |
| 320 | 320 | $this->done(); |
| 321 | 321 | }, |
| 322 | - function (Throwable $throwable) use ($strand) { |
|
| 322 | + function(Throwable $throwable) use ($strand) { |
|
| 323 | 323 | $strand->success = false; |
| 324 | 324 | $strand->value = $throwable; |
| 325 | 325 | $this->queue->enqueue($strand); |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | |
| 432 | 432 | $value = $resolve($ctx->value, $arguments, $this->contextValue, $ctx->resolveInfo); |
| 433 | 433 | |
| 434 | - if (! $this->completeValueFast($ctx, $returnType, $value, $ctx->path, $returnValue)) { |
|
| 434 | + if (!$this->completeValueFast($ctx, $returnType, $value, $ctx->path, $returnValue)) { |
|
| 435 | 435 | $returnValue = yield $this->completeValue( |
| 436 | 436 | $ctx, |
| 437 | 437 | $returnType, |
@@ -453,12 +453,12 @@ discard block |
||
| 453 | 453 | if ($returnValue !== self::$undefined) { |
| 454 | 454 | $ctx->result->{$ctx->shared->resultName} = $returnValue; |
| 455 | 455 | } elseif ($ctx->resolveInfo !== null && $ctx->resolveInfo->returnType instanceof NonNull) { // !!! $ctx->resolveInfo might not have been initialized yet |
| 456 | - $result =& $this->rootResult; |
|
| 456 | + $result = & $this->rootResult; |
|
| 457 | 457 | foreach ($ctx->nullFence ?? [] as $key) { |
| 458 | 458 | if (is_string($key)) { |
| 459 | - $result =& $result->{$key}; |
|
| 459 | + $result = & $result->{$key}; |
|
| 460 | 460 | } else { |
| 461 | - $result =& $result[$key]; |
|
| 461 | + $result = & $result[$key]; |
|
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | 464 | $result = null; |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | $type = $type->getWrappedType(); |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - if (! $type instanceof LeafType) { |
|
| 503 | + if (!$type instanceof LeafType) { |
|
| 504 | 504 | return false; |
| 505 | 505 | } |
| 506 | 506 | |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | $ctx->resolveInfo->path = $itemPath; |
| 634 | 634 | |
| 635 | 635 | try { |
| 636 | - if (! $this->completeValueFast($ctx, $itemType, $itemValue, $itemPath, $itemReturnValue)) { |
|
| 636 | + if (!$this->completeValueFast($ctx, $itemType, $itemValue, $itemPath, $itemReturnValue)) { |
|
| 637 | 637 | $itemReturnValue = yield $this->completeValue($ctx, $itemType, $itemValue, $itemPath, $nullFence); |
| 638 | 638 | } |
| 639 | 639 | } catch (Throwable $reason) { |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | |
| 725 | 725 | $returnValue = self::$undefined; |
| 726 | 726 | goto CHECKED_RETURN; |
| 727 | - } elseif (! $objectType instanceof ObjectType) { |
|
| 727 | + } elseif (!$objectType instanceof ObjectType) { |
|
| 728 | 728 | $this->addError(Error::createLocatedError( |
| 729 | 729 | new InvariantViolation(sprintf( |
| 730 | 730 | 'Abstract type %s must resolve to an Object type at ' . |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | |
| 745 | 745 | $returnValue = null; |
| 746 | 746 | goto CHECKED_RETURN; |
| 747 | - } elseif (! $this->schema->isPossibleType($type, $objectType)) { |
|
| 747 | + } elseif (!$this->schema->isPossibleType($type, $objectType)) { |
|
| 748 | 748 | $this->addError(Error::createLocatedError( |
| 749 | 749 | new InvariantViolation(sprintf( |
| 750 | 750 | 'Runtime Object type "%s" is not a possible type for "%s".', |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | if ($typeCheck !== null) { |
| 797 | 797 | // !!! $objectType->isTypeOf() might return promise, yield to resolve |
| 798 | 798 | $typeCheck = yield $typeCheck; |
| 799 | - if (! $typeCheck) { |
|
| 799 | + if (!$typeCheck) { |
|
| 800 | 800 | $this->addError(Error::createLocatedError( |
| 801 | 801 | sprintf('Expected value of type "%s" but got: %s.', $type->name, Utils::printSafe($value)), |
| 802 | 802 | $ctx->shared->fieldNodes, |
@@ -947,7 +947,7 @@ discard block |
||
| 947 | 947 | $selectedType = null; |
| 948 | 948 | foreach ($possibleTypes as $type) { |
| 949 | 949 | $typeCheck = yield $type->isTypeOf($value, $this->contextValue, $ctx->resolveInfo); |
| 950 | - if ($selectedType !== null || ! $typeCheck) { |
|
| 950 | + if ($selectedType !== null || !$typeCheck) { |
|
| 951 | 951 | continue; |
| 952 | 952 | } |
| 953 | 953 | |
@@ -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 |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $subscriptionType = $schema->getSubscriptionType(); |
| 156 | 156 | |
| 157 | - return ! $subscriptionType || $subscriptionType->name === 'Subscription'; |
|
| 157 | + return !$subscriptionType || $subscriptionType->name === 'Subscription'; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | private static function printDirective($directive, $options) : string |
@@ -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) |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $breakingChanges = []; |
| 122 | 122 | foreach ($schemaATypeMap as $typeName => $schemaAType) { |
| 123 | - if (! isset($schemaBTypeMap[$typeName])) { |
|
| 123 | + if (!isset($schemaBTypeMap[$typeName])) { |
|
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | $schemaBType = $schemaBTypeMap[$typeName]; |
@@ -190,9 +190,9 @@ discard block |
||
| 190 | 190 | $breakingChanges = []; |
| 191 | 191 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 192 | 192 | $newType = $newTypeMap[$typeName] ?? null; |
| 193 | - if (! ($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
| 194 | - ! ($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
| 195 | - ! ($newType instanceof $oldType) |
|
| 193 | + if (!($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
| 194 | + !($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
| 195 | + !($newType instanceof $oldType) |
|
| 196 | 196 | ) { |
| 197 | 197 | continue; |
| 198 | 198 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $newTypeFieldsDef = $newType->getFields(); |
| 202 | 202 | foreach ($oldTypeFieldsDef as $fieldName => $fieldDefinition) { |
| 203 | 203 | // Check if the field is missing on the type in the new schema. |
| 204 | - if (! isset($newTypeFieldsDef[$fieldName])) { |
|
| 204 | + if (!isset($newTypeFieldsDef[$fieldName])) { |
|
| 205 | 205 | $breakingChanges[] = [ |
| 206 | 206 | 'type' => self::BREAKING_CHANGE_FIELD_REMOVED, |
| 207 | 207 | 'description' => "${typeName}.${fieldName} was removed.", |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $oldFieldType, |
| 214 | 214 | $newFieldType |
| 215 | 215 | ); |
| 216 | - if (! $isSafe) { |
|
| 216 | + if (!$isSafe) { |
|
| 217 | 217 | $oldFieldTypeString = $oldFieldType instanceof NamedType && $oldFieldType instanceof Type |
| 218 | 218 | ? $oldFieldType->name |
| 219 | 219 | : $oldFieldType; |
@@ -283,14 +283,14 @@ discard block |
||
| 283 | 283 | $dangerousChanges = []; |
| 284 | 284 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 285 | 285 | $newType = $newTypeMap[$typeName] ?? null; |
| 286 | - if (! ($oldType instanceof InputObjectType) || ! ($newType instanceof InputObjectType)) { |
|
| 286 | + if (!($oldType instanceof InputObjectType) || !($newType instanceof InputObjectType)) { |
|
| 287 | 287 | continue; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | $oldTypeFieldsDef = $oldType->getFields(); |
| 291 | 291 | $newTypeFieldsDef = $newType->getFields(); |
| 292 | 292 | foreach (array_keys($oldTypeFieldsDef) as $fieldName) { |
| 293 | - if (! isset($newTypeFieldsDef[$fieldName])) { |
|
| 293 | + if (!isset($newTypeFieldsDef[$fieldName])) { |
|
| 294 | 294 | $breakingChanges[] = [ |
| 295 | 295 | 'type' => self::BREAKING_CHANGE_FIELD_REMOVED, |
| 296 | 296 | 'description' => "${typeName}.${fieldName} was removed.", |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $oldFieldType, |
| 304 | 304 | $newFieldType |
| 305 | 305 | ); |
| 306 | - if (! $isSafe) { |
|
| 306 | + if (!$isSafe) { |
|
| 307 | 307 | if ($oldFieldType instanceof NamedType) { |
| 308 | 308 | $oldFieldTypeString = $oldFieldType->name; |
| 309 | 309 | } else { |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | Type $newType |
| 357 | 357 | ) { |
| 358 | 358 | if ($oldType instanceof NamedType) { |
| 359 | - if (! $newType instanceof NamedType) { |
|
| 359 | + if (!$newType instanceof NamedType) { |
|
| 360 | 360 | return false; |
| 361 | 361 | } |
| 362 | 362 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | $newType->getWrappedType() |
| 383 | 383 | )) || |
| 384 | 384 | // moving from non-null to nullable of the same underlying type is safe |
| 385 | - ! ($newType instanceof NonNull) && |
|
| 385 | + !($newType instanceof NonNull) && |
|
| 386 | 386 | self::isChangeSafeForInputObjectFieldOrFieldArg($oldType->getWrappedType(), $newType); |
| 387 | 387 | } |
| 388 | 388 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | $typesRemovedFromUnion = []; |
| 406 | 406 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 407 | 407 | $newType = $newTypeMap[$typeName] ?? null; |
| 408 | - if (! ($oldType instanceof UnionType) || ! ($newType instanceof UnionType)) { |
|
| 408 | + if (!($oldType instanceof UnionType) || !($newType instanceof UnionType)) { |
|
| 409 | 409 | continue; |
| 410 | 410 | } |
| 411 | 411 | $typeNamesInNewUnion = []; |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | $valuesRemovedFromEnums = []; |
| 444 | 444 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 445 | 445 | $newType = $newTypeMap[$typeName] ?? null; |
| 446 | - if (! ($oldType instanceof EnumType) || ! ($newType instanceof EnumType)) { |
|
| 446 | + if (!($oldType instanceof EnumType) || !($newType instanceof EnumType)) { |
|
| 447 | 447 | continue; |
| 448 | 448 | } |
| 449 | 449 | $valuesInNewEnum = []; |
@@ -485,9 +485,9 @@ discard block |
||
| 485 | 485 | |
| 486 | 486 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 487 | 487 | $newType = $newTypeMap[$typeName] ?? null; |
| 488 | - if (! ($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
| 489 | - ! ($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
| 490 | - ! ($newType instanceof $oldType) |
|
| 488 | + if (!($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
| 489 | + !($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
| 490 | + !($newType instanceof $oldType) |
|
| 491 | 491 | ) { |
| 492 | 492 | continue; |
| 493 | 493 | } |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | $newTypeFields = $newType->getFields(); |
| 497 | 497 | |
| 498 | 498 | foreach ($oldTypeFields as $fieldName => $oldField) { |
| 499 | - if (! isset($newTypeFields[$fieldName])) { |
|
| 499 | + if (!isset($newTypeFields[$fieldName])) { |
|
| 500 | 500 | continue; |
| 501 | 501 | } |
| 502 | 502 | |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | $newArgs = $newTypeFields[$fieldName]->args; |
| 505 | 505 | $newArgDef = Utils::find( |
| 506 | 506 | $newArgs, |
| 507 | - static function ($arg) use ($oldArgDef) { |
|
| 507 | + static function($arg) use ($oldArgDef) { |
|
| 508 | 508 | return $arg->name === $oldArgDef->name; |
| 509 | 509 | } |
| 510 | 510 | ); |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | /** @var ScalarType|EnumType|InputObjectType|ListOfType|NonNull $oldArgType */ |
| 517 | 517 | $oldArgType = $oldArgDef->getType(); |
| 518 | 518 | $oldArgName = $oldArgDef->name; |
| 519 | - if (! $isSafe) { |
|
| 519 | + if (!$isSafe) { |
|
| 520 | 520 | $newArgType = $newArgDef->getType(); |
| 521 | 521 | $breakingChanges[] = [ |
| 522 | 522 | 'type' => self::BREAKING_CHANGE_ARG_CHANGED_KIND, |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | $oldArgs = $oldTypeFields[$fieldName]->args; |
| 545 | 545 | $oldArgDef = Utils::find( |
| 546 | 546 | $oldArgs, |
| 547 | - static function ($arg) use ($newTypeFieldArgDef) { |
|
| 547 | + static function($arg) use ($newTypeFieldArgDef) { |
|
| 548 | 548 | return $arg->name === $newTypeFieldArgDef->name; |
| 549 | 549 | } |
| 550 | 550 | ); |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 592 | 592 | $newType = $newTypeMap[$typeName] ?? null; |
| 593 | - if (! ($oldType instanceof ObjectType) || ! ($newType instanceof ObjectType)) { |
|
| 593 | + if (!($oldType instanceof ObjectType) || !($newType instanceof ObjectType)) { |
|
| 594 | 594 | continue; |
| 595 | 595 | } |
| 596 | 596 | |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | foreach ($oldInterfaces as $oldInterface) { |
| 600 | 600 | $interface = Utils::find( |
| 601 | 601 | $newInterfaces, |
| 602 | - static function (InterfaceType $interface) use ($oldInterface) : bool { |
|
| 602 | + static function(InterfaceType $interface) use ($oldInterface) : bool { |
|
| 603 | 603 | return $interface->name === $oldInterface->name; |
| 604 | 604 | } |
| 605 | 605 | ); |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | { |
| 644 | 644 | return Utils::keyMap( |
| 645 | 645 | $schema->getDirectives(), |
| 646 | - static function ($dir) { |
|
| 646 | + static function($dir) { |
|
| 647 | 647 | return $dir->name; |
| 648 | 648 | } |
| 649 | 649 | ); |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
| 656 | 656 | |
| 657 | 657 | foreach ($newSchema->getDirectives() as $newDirective) { |
| 658 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 658 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 659 | 659 | continue; |
| 660 | 660 | } |
| 661 | 661 | |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | { |
| 693 | 693 | return Utils::keyMap( |
| 694 | 694 | $directive->args ?: [], |
| 695 | - static function ($arg) { |
|
| 695 | + static function($arg) { |
|
| 696 | 696 | return $arg->name; |
| 697 | 697 | } |
| 698 | 698 | ); |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
| 705 | 705 | |
| 706 | 706 | foreach ($newSchema->getDirectives() as $newDirective) { |
| 707 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 707 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 708 | 708 | continue; |
| 709 | 709 | } |
| 710 | 710 | |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | $oldSchemaDirectiveMap[$newDirective->name], |
| 713 | 713 | $newDirective |
| 714 | 714 | ) as $arg) { |
| 715 | - if (! $arg->getType() instanceof NonNull) { |
|
| 715 | + if (!$arg->getType() instanceof NonNull) { |
|
| 716 | 716 | continue; |
| 717 | 717 | } |
| 718 | 718 | $addedNonNullableArgs[] = [ |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
| 757 | 757 | |
| 758 | 758 | foreach ($newSchema->getDirectives() as $newDirective) { |
| 759 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 759 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 760 | 760 | continue; |
| 761 | 761 | } |
| 762 | 762 | |
@@ -822,7 +822,7 @@ discard block |
||
| 822 | 822 | $valuesAddedToEnums = []; |
| 823 | 823 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 824 | 824 | $newType = $newTypeMap[$typeName] ?? null; |
| 825 | - if (! ($oldType instanceof EnumType) || ! ($newType instanceof EnumType)) { |
|
| 825 | + if (!($oldType instanceof EnumType) || !($newType instanceof EnumType)) { |
|
| 826 | 826 | continue; |
| 827 | 827 | } |
| 828 | 828 | $valuesInOldEnum = []; |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | |
| 858 | 858 | foreach ($newTypeMap as $typeName => $newType) { |
| 859 | 859 | $oldType = $oldTypeMap[$typeName] ?? null; |
| 860 | - if (! ($oldType instanceof ObjectType) || ! ($newType instanceof ObjectType)) { |
|
| 860 | + if (!($oldType instanceof ObjectType) || !($newType instanceof ObjectType)) { |
|
| 861 | 861 | continue; |
| 862 | 862 | } |
| 863 | 863 | |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | foreach ($newInterfaces as $newInterface) { |
| 867 | 867 | $interface = Utils::find( |
| 868 | 868 | $oldInterfaces, |
| 869 | - static function (InterfaceType $interface) use ($newInterface) : bool { |
|
| 869 | + static function(InterfaceType $interface) use ($newInterface) : bool { |
|
| 870 | 870 | return $interface->name === $newInterface->name; |
| 871 | 871 | } |
| 872 | 872 | ); |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | $typesAddedToUnion = []; |
| 906 | 906 | foreach ($newTypeMap as $typeName => $newType) { |
| 907 | 907 | $oldType = $oldTypeMap[$typeName] ?? null; |
| 908 | - if (! ($oldType instanceof UnionType) || ! ($newType instanceof UnionType)) { |
|
| 908 | + if (!($oldType instanceof UnionType) || !($newType instanceof UnionType)) { |
|
| 909 | 909 | continue; |
| 910 | 910 | } |
| 911 | 911 | |
@@ -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 ($traversable 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 ($traversable 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 | |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | public static function every($traversable, callable $predicate) |
| 295 | 295 | { |
| 296 | 296 | foreach ($traversable as $key => $value) { |
| 297 | - if (! $predicate($value, $key)) { |
|
| 297 | + if (!$predicate($value, $key)) { |
|
| 298 | 298 | return false; |
| 299 | 299 | } |
| 300 | 300 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | */ |
| 325 | 325 | public static function invariant($test, $message = '') |
| 326 | 326 | { |
| 327 | - if (! $test) { |
|
| 327 | + if (!$test) { |
|
| 328 | 328 | if (func_num_args() > 2) { |
| 329 | 329 | $args = func_get_args(); |
| 330 | 330 | array_shift($args); |
@@ -458,10 +458,10 @@ discard block |
||
| 458 | 458 | */ |
| 459 | 459 | public static function ord($char, $encoding = 'UTF-8') |
| 460 | 460 | { |
| 461 | - if (! $char && $char !== '0') { |
|
| 461 | + if (!$char && $char !== '0') { |
|
| 462 | 462 | return 0; |
| 463 | 463 | } |
| 464 | - if (! isset($char[1])) { |
|
| 464 | + if (!isset($char[1])) { |
|
| 465 | 465 | return ord($char); |
| 466 | 466 | } |
| 467 | 467 | if ($encoding !== 'UCS-4BE') { |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | ); |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - if (! preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) { |
|
| 542 | + if (!preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) { |
|
| 543 | 543 | return new Error( |
| 544 | 544 | sprintf('Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "%s" does not.', $name), |
| 545 | 545 | $node |
@@ -559,9 +559,9 @@ discard block |
||
| 559 | 559 | */ |
| 560 | 560 | public static function withErrorHandling(callable $fn, array &$errors) |
| 561 | 561 | { |
| 562 | - return static function () use ($fn, &$errors) { |
|
| 562 | + return static function() use ($fn, &$errors) { |
|
| 563 | 563 | // Catch custom errors (to report them in query results) |
| 564 | - set_error_handler(static function ($severity, $message, $file, $line) use (&$errors) { |
|
| 564 | + set_error_handler(static function($severity, $message, $file, $line) use (&$errors) { |
|
| 565 | 565 | $errors[] = new ErrorException($message, 0, $severity, $file, $line); |
| 566 | 566 | }); |
| 567 | 567 | |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | public static function quotedOrList(array $items) |
| 582 | 582 | { |
| 583 | 583 | $items = array_map( |
| 584 | - static function ($item) { |
|
| 584 | + static function($item) { |
|
| 585 | 585 | return sprintf('"%s"', $item); |
| 586 | 586 | }, |
| 587 | 587 | $items |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | |
| 611 | 611 | return array_reduce( |
| 612 | 612 | range(1, $selectedLength - 1), |
| 613 | - static function ($list, $index) use ($selected, $selectedLength) { |
|
| 613 | + static function($list, $index) use ($selected, $selectedLength) { |
|
| 614 | 614 | return $list . |
| 615 | 615 | ($selectedLength > 2 ? ', ' : ' ') . |
| 616 | 616 | ($index === $selectedLength - 1 ? 'or ' : '') . |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | case $definition instanceof UnionTypeDefinitionNode: |
| 123 | 123 | case $definition instanceof InputObjectTypeDefinitionNode: |
| 124 | 124 | $typeName = $definition->name->value; |
| 125 | - if (! empty($this->nodeMap[$typeName])) { |
|
| 125 | + if (!empty($this->nodeMap[$typeName])) { |
|
| 126 | 126 | throw new Error(sprintf('Type "%s" was defined more than once.', $typeName)); |
| 127 | 127 | } |
| 128 | 128 | $typeDefs[] = $definition; |
@@ -145,14 +145,14 @@ discard block |
||
| 145 | 145 | $DefinitionBuilder = new ASTDefinitionBuilder( |
| 146 | 146 | $this->nodeMap, |
| 147 | 147 | $this->options, |
| 148 | - static function ($typeName) { |
|
| 148 | + static function($typeName) { |
|
| 149 | 149 | throw new Error('Type "' . $typeName . '" not found in document.'); |
| 150 | 150 | }, |
| 151 | 151 | $this->typeConfigDecorator |
| 152 | 152 | ); |
| 153 | 153 | |
| 154 | 154 | $directives = array_map( |
| 155 | - static function ($def) use ($DefinitionBuilder) { |
|
| 155 | + static function($def) use ($DefinitionBuilder) { |
|
| 156 | 156 | return $DefinitionBuilder->buildDirective($def); |
| 157 | 157 | }, |
| 158 | 158 | $directiveDefs |
@@ -161,17 +161,17 @@ discard block |
||
| 161 | 161 | // If specified directives were not explicitly declared, add them. |
| 162 | 162 | $directivesByName = Utils::groupBy( |
| 163 | 163 | $directives, |
| 164 | - static function (Directive $directive) : string { |
|
| 164 | + static function(Directive $directive) : string { |
|
| 165 | 165 | return $directive->name; |
| 166 | 166 | } |
| 167 | 167 | ); |
| 168 | - if (! isset($directivesByName['skip'])) { |
|
| 168 | + if (!isset($directivesByName['skip'])) { |
|
| 169 | 169 | $directives[] = Directive::skipDirective(); |
| 170 | 170 | } |
| 171 | - if (! isset($directivesByName['include'])) { |
|
| 171 | + if (!isset($directivesByName['include'])) { |
|
| 172 | 172 | $directives[] = Directive::includeDirective(); |
| 173 | 173 | } |
| 174 | - if (! isset($directivesByName['deprecated'])) { |
|
| 174 | + if (!isset($directivesByName['deprecated'])) { |
|
| 175 | 175 | $directives[] = Directive::deprecatedDirective(); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -189,12 +189,12 @@ discard block |
||
| 189 | 189 | 'subscription' => isset($operationTypes['subscription']) |
| 190 | 190 | ? $DefinitionBuilder->buildType($operationTypes['subscription']) |
| 191 | 191 | : null, |
| 192 | - 'typeLoader' => static function ($name) use ($DefinitionBuilder) { |
|
| 192 | + 'typeLoader' => static function($name) use ($DefinitionBuilder) { |
|
| 193 | 193 | return $DefinitionBuilder->buildType($name); |
| 194 | 194 | }, |
| 195 | 195 | 'directives' => $directives, |
| 196 | 196 | 'astNode' => $schemaDef, |
| 197 | - 'types' => function () use ($DefinitionBuilder) { |
|
| 197 | + 'types' => function() use ($DefinitionBuilder) { |
|
| 198 | 198 | $types = []; |
| 199 | 199 | /** @var ScalarTypeDefinitionNode|ObjectTypeDefinitionNode|InterfaceTypeDefinitionNode|UnionTypeDefinitionNode|EnumTypeDefinitionNode|InputObjectTypeDefinitionNode $def */ |
| 200 | 200 | foreach ($this->nodeMap as $name => $def) { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | throw new Error(sprintf('Must provide only one %s type in schema.', $operation)); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - if (! isset($this->nodeMap[$typeName])) { |
|
| 228 | + if (!isset($this->nodeMap[$typeName])) { |
|
| 229 | 229 | throw new Error(sprintf('Specified %s type "%s" not found in document.', $operation, $typeName)); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $suggestions = Utils::suggestionList( |
| 91 | 91 | Utils::printSafe($value), |
| 92 | 92 | array_map( |
| 93 | - static function ($enumValue) { |
|
| 93 | + static function($enumValue) { |
|
| 94 | 94 | return $enumValue->name; |
| 95 | 95 | }, |
| 96 | 96 | $type->getValues() |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | if ($type instanceof InputObjectType) { |
| 142 | - if (! is_object($value) && ! is_array($value) && ! $value instanceof Traversable) { |
|
| 142 | + if (!is_object($value) && !is_array($value) && !$value instanceof Traversable) { |
|
| 143 | 143 | return self::ofErrors([ |
| 144 | 144 | self::coercionError( |
| 145 | 145 | sprintf('Expected type %s to be an object', $type->name), |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $pathStr = ''; |
| 268 | 268 | $currentPath = $path; |
| 269 | 269 | while ($currentPath) { |
| 270 | - $pathStr = |
|
| 270 | + $pathStr = |
|
| 271 | 271 | (is_string($currentPath['key']) |
| 272 | 272 | ? '.' . $currentPath['key'] |
| 273 | 273 | : '[' . $currentPath['key'] . ']') . $pathStr; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | protected static function getExtensionASTNodes(NamedType $type) : ?array |
| 60 | 60 | { |
| 61 | - if (! $type instanceof Type) { |
|
| 61 | + if (!$type instanceof Type) { |
|
| 62 | 62 | return null; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | switch (true) { |
| 83 | 83 | case $node instanceof ObjectTypeExtensionNode: |
| 84 | - if (! ($type instanceof ObjectType)) { |
|
| 84 | + if (!($type instanceof ObjectType)) { |
|
| 85 | 85 | throw new Error( |
| 86 | 86 | 'Cannot extend non-object type "' . $type->name . '".', |
| 87 | 87 | [$node] |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | break; |
| 91 | 91 | case $node instanceof InterfaceTypeExtensionNode: |
| 92 | - if (! ($type instanceof InterfaceType)) { |
|
| 92 | + if (!($type instanceof InterfaceType)) { |
|
| 93 | 93 | throw new Error( |
| 94 | 94 | 'Cannot extend non-interface type "' . $type->name . '".', |
| 95 | 95 | [$node] |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | break; |
| 99 | 99 | case $node instanceof EnumTypeExtensionNode: |
| 100 | - if (! ($type instanceof EnumType)) { |
|
| 100 | + if (!($type instanceof EnumType)) { |
|
| 101 | 101 | throw new Error( |
| 102 | 102 | 'Cannot extend non-enum type "' . $type->name . '".', |
| 103 | 103 | [$node] |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | break; |
| 107 | 107 | case $node instanceof UnionTypeExtensionNode: |
| 108 | - if (! ($type instanceof UnionType)) { |
|
| 108 | + if (!($type instanceof UnionType)) { |
|
| 109 | 109 | throw new Error( |
| 110 | 110 | 'Cannot extend non-union type "' . $type->name . '".', |
| 111 | 111 | [$node] |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | break; |
| 115 | 115 | case $node instanceof InputObjectTypeExtensionNode: |
| 116 | - if (! ($type instanceof InputObjectType)) { |
|
| 116 | + if (!($type instanceof InputObjectType)) { |
|
| 117 | 117 | throw new Error( |
| 118 | 118 | 'Cannot extend non-input object type "' . $type->name . '".', |
| 119 | 119 | [$node] |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | return new UnionType([ |
| 142 | 142 | 'name' => $type->name, |
| 143 | 143 | 'description' => $type->description, |
| 144 | - 'types' => static function () use ($type) { |
|
| 144 | + 'types' => static function() use ($type) { |
|
| 145 | 145 | return static::extendPossibleTypes($type); |
| 146 | 146 | }, |
| 147 | 147 | 'astNode' => $type->astNode, |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | return new InputObjectType([ |
| 167 | 167 | 'name' => $type->name, |
| 168 | 168 | 'description' => $type->description, |
| 169 | - 'fields' => static function () use ($type) { |
|
| 169 | + 'fields' => static function() use ($type) { |
|
| 170 | 170 | return static::extendInputFieldMap($type); |
| 171 | 171 | }, |
| 172 | 172 | 'astNode' => $type->astNode, |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | 'astNode' => $field->astNode, |
| 189 | 189 | ]; |
| 190 | 190 | |
| 191 | - if (! $field->defaultValueExists()) { |
|
| 191 | + if (!$field->defaultValueExists()) { |
|
| 192 | 192 | continue; |
| 193 | 193 | } |
| 194 | 194 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | protected static function extendPossibleTypes(UnionType $type) : array |
| 257 | 257 | { |
| 258 | - $possibleTypes = array_map(static function ($type) { |
|
| 258 | + $possibleTypes = array_map(static function($type) { |
|
| 259 | 259 | return static::extendNamedType($type); |
| 260 | 260 | }, $type->getTypes()); |
| 261 | 261 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | protected static function extendImplementedInterfaces(ObjectType $type) : array |
| 278 | 278 | { |
| 279 | - $interfaces = array_map(static function (InterfaceType $interfaceType) { |
|
| 279 | + $interfaces = array_map(static function(InterfaceType $interfaceType) { |
|
| 280 | 280 | return static::extendNamedType($interfaceType); |
| 281 | 281 | }, $type->getInterfaces()); |
| 282 | 282 | |
@@ -315,10 +315,10 @@ discard block |
||
| 315 | 315 | { |
| 316 | 316 | return Utils::keyValMap( |
| 317 | 317 | $args, |
| 318 | - static function (FieldArgument $arg) { |
|
| 318 | + static function(FieldArgument $arg) { |
|
| 319 | 319 | return $arg->name; |
| 320 | 320 | }, |
| 321 | - static function (FieldArgument $arg) { |
|
| 321 | + static function(FieldArgument $arg) { |
|
| 322 | 322 | $def = [ |
| 323 | 323 | 'type' => static::extendType($arg->getType()), |
| 324 | 324 | 'description' => $arg->description, |
@@ -382,10 +382,10 @@ discard block |
||
| 382 | 382 | return new ObjectType([ |
| 383 | 383 | 'name' => $type->name, |
| 384 | 384 | 'description' => $type->description, |
| 385 | - 'interfaces' => static function () use ($type) { |
|
| 385 | + 'interfaces' => static function() use ($type) { |
|
| 386 | 386 | return static::extendImplementedInterfaces($type); |
| 387 | 387 | }, |
| 388 | - 'fields' => static function () use ($type) { |
|
| 388 | + 'fields' => static function() use ($type) { |
|
| 389 | 389 | return static::extendFieldMap($type); |
| 390 | 390 | }, |
| 391 | 391 | 'astNode' => $type->astNode, |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | return new InterfaceType([ |
| 400 | 400 | 'name' => $type->name, |
| 401 | 401 | 'description' => $type->description, |
| 402 | - 'fields' => static function () use ($type) { |
|
| 402 | + 'fields' => static function() use ($type) { |
|
| 403 | 403 | return static::extendFieldMap($type); |
| 404 | 404 | }, |
| 405 | 405 | 'astNode' => $type->astNode, |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | $name = $type->name; |
| 430 | - if (! isset(static::$extendTypeCache[$name])) { |
|
| 430 | + if (!isset(static::$extendTypeCache[$name])) { |
|
| 431 | 431 | if ($type instanceof ScalarType) { |
| 432 | 432 | static::$extendTypeCache[$name] = static::extendScalarType($type); |
| 433 | 433 | } elseif ($type instanceof ObjectType) { |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | protected static function getMergedDirectives(Schema $schema, array $directiveDefinitions) : array |
| 467 | 467 | { |
| 468 | - $existingDirectives = array_map(static function (Directive $directive) { |
|
| 468 | + $existingDirectives = array_map(static function(Directive $directive) { |
|
| 469 | 469 | return static::extendDirective($directive); |
| 470 | 470 | }, $schema->getDirectives()); |
| 471 | 471 | |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | return array_merge( |
| 475 | 475 | $existingDirectives, |
| 476 | - array_map(static function (DirectiveDefinitionNode $directive) { |
|
| 476 | + array_map(static function(DirectiveDefinitionNode $directive) { |
|
| 477 | 477 | return static::$astBuilder->buildDirective($directive); |
| 478 | 478 | }, $directiveDefinitions) |
| 479 | 479 | ); |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | */ |
| 496 | 496 | public static function extend(Schema $schema, DocumentNode $documentAST, ?array $options = null) : Schema |
| 497 | 497 | { |
| 498 | - if ($options === null || ! (isset($options['assumeValid']) || isset($options['assumeValidSDL']))) { |
|
| 498 | + if ($options === null || !(isset($options['assumeValid']) || isset($options['assumeValidSDL']))) { |
|
| 499 | 499 | DocumentValidator::assertValidSDLExtension($documentAST, $schema); |
| 500 | 500 | } |
| 501 | 501 | |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | static::$astBuilder = new ASTDefinitionBuilder( |
| 564 | 564 | $typeDefinitionMap, |
| 565 | 565 | $options, |
| 566 | - static function (string $typeName) use ($schema) { |
|
| 566 | + static function(string $typeName) use ($schema) { |
|
| 567 | 567 | /** @var ScalarType|ObjectType|InterfaceType|UnionType|EnumType|InputObjectType $existingType */ |
| 568 | 568 | $existingType = $schema->getType($typeName); |
| 569 | 569 | if ($existingType !== null) { |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | foreach ($schemaExtensions as $schemaExtension) { |
| 599 | - if (! $schemaExtension->operationTypes) { |
|
| 599 | + if (!$schemaExtension->operationTypes) { |
|
| 600 | 600 | continue; |
| 601 | 601 | } |
| 602 | 602 | |
@@ -618,11 +618,11 @@ discard block |
||
| 618 | 618 | $types = array_merge( |
| 619 | 619 | // Iterate through all types, getting the type definition for each, ensuring |
| 620 | 620 | // that any type not directly referenced by a field will get created. |
| 621 | - array_map(static function ($type) { |
|
| 621 | + array_map(static function($type) { |
|
| 622 | 622 | return static::extendNamedType($type); |
| 623 | 623 | }, array_values($schema->getTypeMap())), |
| 624 | 624 | // Do the same with new types. |
| 625 | - array_map(static function ($type) { |
|
| 625 | + array_map(static function($type) { |
|
| 626 | 626 | return static::$astBuilder->buildType($type); |
| 627 | 627 | }, array_values($typeDefinitionMap)) |
| 628 | 628 | ); |