@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $queryComplexity->setRawVariableValues($variableValues); |
| 139 | 139 | } else { |
| 140 | 140 | foreach ($validationRules as $rule) { |
| 141 | - if (! ($rule instanceof QueryComplexity)) { |
|
| 141 | + if (!($rule instanceof QueryComplexity)) { |
|
| 142 | 142 | continue; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | $validationErrors = DocumentValidator::validate($schema, $documentNode, $validationRules); |
| 150 | 150 | |
| 151 | - if (! empty($validationErrors)) { |
|
| 151 | + if (!empty($validationErrors)) { |
|
| 152 | 152 | return $promiseAdapter->createFulfilled( |
| 153 | 153 | new ExecutionResult(null, $validationErrors) |
| 154 | 154 | ); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | if ($promiseAdapter instanceof SyncPromiseAdapter) { |
| 209 | 209 | $result = $promiseAdapter->wait($result)->toArray(); |
| 210 | 210 | } else { |
| 211 | - $result = $result->then(static function (ExecutionResult $r) { |
|
| 211 | + $result = $result->then(static function(ExecutionResult $r) { |
|
| 212 | 212 | return $r->toArray(); |
| 213 | 213 | }); |
| 214 | 214 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $fieldName = $fieldNode->name->value; |
| 121 | 121 | |
| 122 | 122 | $argumentValueMap = null; |
| 123 | - if (! empty($fieldNode->arguments)) { |
|
| 123 | + if (!empty($fieldNode->arguments)) { |
|
| 124 | 124 | foreach ($fieldNode->arguments as $argumentNode) { |
| 125 | 125 | $argumentValueMap = $argumentValueMap ?? []; |
| 126 | 126 | $argumentValueMap[$argumentNode->name->value] = $argumentNode->value; |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if ($fieldName !== Introspection::TYPE_NAME_FIELD_NAME && |
| 131 | - ! ($runtimeType === $this->schema->getQueryType() && ($fieldName === Introspection::SCHEMA_FIELD_NAME || $fieldName === Introspection::TYPE_FIELD_NAME)) && |
|
| 132 | - ! $runtimeType->hasField($fieldName) |
|
| 131 | + !($runtimeType === $this->schema->getQueryType() && ($fieldName === Introspection::SCHEMA_FIELD_NAME || $fieldName === Introspection::TYPE_FIELD_NAME)) && |
|
| 132 | + !$runtimeType->hasField($fieldName) |
|
| 133 | 133 | ) { |
| 134 | 134 | // do not emit error |
| 135 | 135 | continue; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | foreach ($selectionSet->selections as $selection) { |
| 149 | 149 | /** @var FieldNode|FragmentSpreadNode|InlineFragmentNode $selection */ |
| 150 | 150 | |
| 151 | - if (! empty($selection->directives)) { |
|
| 151 | + if (!empty($selection->directives)) { |
|
| 152 | 152 | foreach ($selection->directives as $directiveNode) { |
| 153 | 153 | if ($directiveNode->name->value === Directive::SKIP_NAME) { |
| 154 | 154 | /** @var ValueNode|null $condition */ |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | $resultName = $selection->alias ? $selection->alias->value : $selection->name->value; |
| 201 | 201 | |
| 202 | - if (! isset($this->fields[$resultName])) { |
|
| 202 | + if (!isset($this->fields[$resultName])) { |
|
| 203 | 203 | $this->fields[$resultName] = []; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | if (isset($this->visitedFragments[$fragmentName])) { |
| 213 | 213 | continue; |
| 214 | - } elseif (! isset($this->fragments[$fragmentName])) { |
|
| 214 | + } elseif (!isset($this->fragments[$fragmentName])) { |
|
| 215 | 215 | $this->runtime->addError(new Error( |
| 216 | 216 | sprintf('Fragment "%s" does not exist.', $fragmentName), |
| 217 | 217 | $selection |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $fragmentDefinition = $this->fragments[$fragmentName]; |
| 225 | 225 | $conditionTypeName = $fragmentDefinition->typeCondition->name->value; |
| 226 | 226 | |
| 227 | - if (! $this->schema->hasType($conditionTypeName)) { |
|
| 227 | + if (!$this->schema->hasType($conditionTypeName)) { |
|
| 228 | 228 | $this->runtime->addError(new Error( |
| 229 | 229 | sprintf('Cannot spread fragment "%s", type "%s" does not exist.', $fragmentName, $conditionTypeName), |
| 230 | 230 | $selection |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | continue; |
| 240 | 240 | } |
| 241 | 241 | } elseif ($conditionType instanceof AbstractType) { |
| 242 | - if (! $this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
| 242 | + if (!$this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
| 243 | 243 | continue; |
| 244 | 244 | } |
| 245 | 245 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | if ($selection->typeCondition !== null) { |
| 252 | 252 | $conditionTypeName = $selection->typeCondition->name->value; |
| 253 | 253 | |
| 254 | - if (! $this->schema->hasType($conditionTypeName)) { |
|
| 254 | + if (!$this->schema->hasType($conditionTypeName)) { |
|
| 255 | 255 | $this->runtime->addError(new Error( |
| 256 | 256 | sprintf('Cannot spread inline fragment, type "%s" does not exist.', $conditionTypeName), |
| 257 | 257 | $selection |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | continue; |
| 267 | 267 | } |
| 268 | 268 | } elseif ($conditionType instanceof AbstractType) { |
| 269 | - if (! $this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
| 269 | + if (!$this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
| 270 | 270 | continue; |
| 271 | 271 | } |
| 272 | 272 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $this->collector = new Collector($this->schema, $this); |
| 173 | 173 | $this->collector->initialize($this->documentNode, $this->operationName); |
| 174 | 174 | |
| 175 | - if (! empty($this->errors)) { |
|
| 175 | + if (!empty($this->errors)) { |
|
| 176 | 176 | return $this->promiseAdapter->createFulfilled($this->finishExecute(null, $this->errors)); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $this->rawVariableValues ?: [] |
| 183 | 183 | ); |
| 184 | 184 | |
| 185 | - if (! empty($errors)) { |
|
| 185 | + if (!empty($errors)) { |
|
| 186 | 186 | return $this->promiseAdapter->createFulfilled($this->finishExecute(null, $errors)); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -203,11 +203,11 @@ discard block |
||
| 203 | 203 | ); |
| 204 | 204 | |
| 205 | 205 | $fieldDefinition = $this->findFieldDefinition($ctx); |
| 206 | - if (! $fieldDefinition->getType() instanceof NonNull) { |
|
| 206 | + if (!$fieldDefinition->getType() instanceof NonNull) { |
|
| 207 | 207 | $ctx->nullFence = [$shared->resultName]; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if ($this->collector->operation->operation === 'mutation' && ! $this->queue->isEmpty()) { |
|
| 210 | + if ($this->collector->operation->operation === 'mutation' && !$this->queue->isEmpty()) { |
|
| 211 | 211 | $this->schedule->enqueue($ctx); |
| 212 | 212 | } else { |
| 213 | 213 | $this->queue->enqueue(new Strand($this->spawn($ctx))); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $this->run(); |
| 218 | 218 | |
| 219 | 219 | if ($this->pending > 0) { |
| 220 | - return $this->promiseAdapter->create(function (callable $resolve) { |
|
| 220 | + return $this->promiseAdapter->create(function(callable $resolve) { |
|
| 221 | 221 | $this->doResolve = $resolve; |
| 222 | 222 | }); |
| 223 | 223 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | private function run() |
| 266 | 266 | { |
| 267 | 267 | RUN: |
| 268 | - while (! $this->queue->isEmpty()) { |
|
| 268 | + while (!$this->queue->isEmpty()) { |
|
| 269 | 269 | /** @var Strand $strand */ |
| 270 | 270 | $strand = $this->queue->dequeue(); |
| 271 | 271 | |
@@ -298,13 +298,13 @@ discard block |
||
| 298 | 298 | $this->promiseAdapter |
| 299 | 299 | ->convertThenable($value) |
| 300 | 300 | ->then( |
| 301 | - function ($value) use ($strand) { |
|
| 301 | + function($value) use ($strand) { |
|
| 302 | 302 | $strand->success = true; |
| 303 | 303 | $strand->value = $value; |
| 304 | 304 | $this->queue->enqueue($strand); |
| 305 | 305 | $this->done(); |
| 306 | 306 | }, |
| 307 | - function (Throwable $throwable) use ($strand) { |
|
| 307 | + function(Throwable $throwable) use ($strand) { |
|
| 308 | 308 | $strand->success = false; |
| 309 | 309 | $strand->value = $throwable; |
| 310 | 310 | $this->queue->enqueue($strand); |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | |
| 417 | 417 | $value = $resolve($ctx->value, $arguments, $this->contextValue, $ctx->resolveInfo); |
| 418 | 418 | |
| 419 | - if (! $this->completeValueFast($ctx, $returnType, $value, $ctx->path, $returnValue)) { |
|
| 419 | + if (!$this->completeValueFast($ctx, $returnType, $value, $ctx->path, $returnValue)) { |
|
| 420 | 420 | $returnValue = yield $this->completeValue( |
| 421 | 421 | $ctx, |
| 422 | 422 | $returnType, |
@@ -438,12 +438,12 @@ discard block |
||
| 438 | 438 | if ($returnValue !== self::$undefined) { |
| 439 | 439 | $ctx->result->{$ctx->shared->resultName} = $returnValue; |
| 440 | 440 | } elseif ($ctx->resolveInfo !== null && $ctx->resolveInfo->returnType instanceof NonNull) { // !!! $ctx->resolveInfo might not have been initialized yet |
| 441 | - $result =& $this->rootResult; |
|
| 441 | + $result = & $this->rootResult; |
|
| 442 | 442 | foreach ($ctx->nullFence ?? [] as $key) { |
| 443 | 443 | if (is_string($key)) { |
| 444 | - $result =& $result->{$key}; |
|
| 444 | + $result = & $result->{$key}; |
|
| 445 | 445 | } else { |
| 446 | - $result =& $result[$key]; |
|
| 446 | + $result = & $result[$key]; |
|
| 447 | 447 | } |
| 448 | 448 | } |
| 449 | 449 | $result = null; |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | $type = $type->getWrappedType(); |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - if (! $type instanceof LeafType) { |
|
| 488 | + if (!$type instanceof LeafType) { |
|
| 489 | 489 | return false; |
| 490 | 490 | } |
| 491 | 491 | |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | $itemPath[] = $index; // !!! use arrays COW semantics |
| 618 | 618 | |
| 619 | 619 | try { |
| 620 | - if (! $this->completeValueFast($ctx, $itemType, $itemValue, $itemPath, $itemReturnValue)) { |
|
| 620 | + if (!$this->completeValueFast($ctx, $itemType, $itemValue, $itemPath, $itemReturnValue)) { |
|
| 621 | 621 | $itemReturnValue = yield $this->completeValue($ctx, $itemType, $itemValue, $itemPath, $nullFence); |
| 622 | 622 | } |
| 623 | 623 | } catch (Throwable $reason) { |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | |
| 709 | 709 | $returnValue = self::$undefined; |
| 710 | 710 | goto CHECKED_RETURN; |
| 711 | - } elseif (! $objectType instanceof ObjectType) { |
|
| 711 | + } elseif (!$objectType instanceof ObjectType) { |
|
| 712 | 712 | $this->addError(Error::createLocatedError( |
| 713 | 713 | new InvariantViolation(sprintf( |
| 714 | 714 | 'Abstract type %s must resolve to an Object type at ' . |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | |
| 729 | 729 | $returnValue = null; |
| 730 | 730 | goto CHECKED_RETURN; |
| 731 | - } elseif (! $this->schema->isPossibleType($type, $objectType)) { |
|
| 731 | + } elseif (!$this->schema->isPossibleType($type, $objectType)) { |
|
| 732 | 732 | $this->addError(Error::createLocatedError( |
| 733 | 733 | new InvariantViolation(sprintf( |
| 734 | 734 | 'Runtime Object type "%s" is not a possible type for "%s".', |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | if ($typeCheck !== null) { |
| 781 | 781 | // !!! $objectType->isTypeOf() might return promise, yield to resolve |
| 782 | 782 | $typeCheck = yield $typeCheck; |
| 783 | - if (! $typeCheck) { |
|
| 783 | + if (!$typeCheck) { |
|
| 784 | 784 | $this->addError(Error::createLocatedError( |
| 785 | 785 | sprintf('Expected value of type "%s" but got: %s.', $type->name, Utils::printSafe($value)), |
| 786 | 786 | $ctx->shared->fieldNodes, |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | case NodeKind::UNION_TYPE_DEFINITION: |
| 116 | 116 | case NodeKind::INPUT_OBJECT_TYPE_DEFINITION: |
| 117 | 117 | $typeName = $d->name->value; |
| 118 | - if (! empty($this->nodeMap[$typeName])) { |
|
| 118 | + if (!empty($this->nodeMap[$typeName])) { |
|
| 119 | 119 | throw new Error(sprintf('Type "%s" was defined more than once.', $typeName)); |
| 120 | 120 | } |
| 121 | 121 | $typeDefs[] = $d; |
@@ -138,14 +138,14 @@ discard block |
||
| 138 | 138 | $DefinitionBuilder = new ASTDefinitionBuilder( |
| 139 | 139 | $this->nodeMap, |
| 140 | 140 | $this->options, |
| 141 | - static function ($typeName) { |
|
| 141 | + static function($typeName) { |
|
| 142 | 142 | throw new Error('Type "' . $typeName . '" not found in document.'); |
| 143 | 143 | }, |
| 144 | 144 | $this->typeConfigDecorator |
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | 147 | $directives = array_map( |
| 148 | - static function ($def) use ($DefinitionBuilder) { |
|
| 148 | + static function($def) use ($DefinitionBuilder) { |
|
| 149 | 149 | return $DefinitionBuilder->buildDirective($def); |
| 150 | 150 | }, |
| 151 | 151 | $directiveDefs |
@@ -154,31 +154,31 @@ discard block |
||
| 154 | 154 | // If specified directives were not explicitly declared, add them. |
| 155 | 155 | $skip = array_reduce( |
| 156 | 156 | $directives, |
| 157 | - static function ($hasSkip, $directive) { |
|
| 157 | + static function($hasSkip, $directive) { |
|
| 158 | 158 | return $hasSkip || $directive->name === 'skip'; |
| 159 | 159 | } |
| 160 | 160 | ); |
| 161 | - if (! $skip) { |
|
| 161 | + if (!$skip) { |
|
| 162 | 162 | $directives[] = Directive::skipDirective(); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $include = array_reduce( |
| 166 | 166 | $directives, |
| 167 | - static function ($hasInclude, $directive) { |
|
| 167 | + static function($hasInclude, $directive) { |
|
| 168 | 168 | return $hasInclude || $directive->name === 'include'; |
| 169 | 169 | } |
| 170 | 170 | ); |
| 171 | - if (! $include) { |
|
| 171 | + if (!$include) { |
|
| 172 | 172 | $directives[] = Directive::includeDirective(); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $deprecated = array_reduce( |
| 176 | 176 | $directives, |
| 177 | - static function ($hasDeprecated, $directive) { |
|
| 177 | + static function($hasDeprecated, $directive) { |
|
| 178 | 178 | return $hasDeprecated || $directive->name === 'deprecated'; |
| 179 | 179 | } |
| 180 | 180 | ); |
| 181 | - if (! $deprecated) { |
|
| 181 | + if (!$deprecated) { |
|
| 182 | 182 | $directives[] = Directive::deprecatedDirective(); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -196,12 +196,12 @@ discard block |
||
| 196 | 196 | 'subscription' => isset($operationTypes['subscription']) |
| 197 | 197 | ? $DefinitionBuilder->buildType($operationTypes['subscription']) |
| 198 | 198 | : null, |
| 199 | - 'typeLoader' => static function ($name) use ($DefinitionBuilder) { |
|
| 199 | + 'typeLoader' => static function($name) use ($DefinitionBuilder) { |
|
| 200 | 200 | return $DefinitionBuilder->buildType($name); |
| 201 | 201 | }, |
| 202 | 202 | 'directives' => $directives, |
| 203 | 203 | 'astNode' => $schemaDef, |
| 204 | - 'types' => function () use ($DefinitionBuilder) { |
|
| 204 | + 'types' => function() use ($DefinitionBuilder) { |
|
| 205 | 205 | $types = []; |
| 206 | 206 | foreach ($this->nodeMap as $name => $def) { |
| 207 | 207 | $types[] = $DefinitionBuilder->buildType($def->name->value); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | throw new Error(sprintf('Must provide only one %s type in schema.', $operation)); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - if (! isset($this->nodeMap[$typeName])) { |
|
| 234 | + if (!isset($this->nodeMap[$typeName])) { |
|
| 235 | 235 | throw new Error(sprintf('Specified %s type "%s" not found in document.', $operation, $typeName)); |
| 236 | 236 | } |
| 237 | 237 | |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | public static function assign($obj, array $vars, array $requiredKeys = []) |
| 85 | 85 | { |
| 86 | 86 | foreach ($requiredKeys as $key) { |
| 87 | - if (! isset($vars[$key])) { |
|
| 87 | + if (!isset($vars[$key])) { |
|
| 88 | 88 | throw new InvalidArgumentException(sprintf('Key %s is expected to be set and not to be null', $key)); |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | foreach ($vars as $key => $value) { |
| 93 | - if (! property_exists($obj, $key)) { |
|
| 93 | + if (!property_exists($obj, $key)) { |
|
| 94 | 94 | $cls = get_class($obj); |
| 95 | 95 | Warning::warn( |
| 96 | 96 | sprintf("Trying to set non-existing property '%s' on class '%s'", $key, $cls), |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | $result = []; |
| 142 | 142 | $assoc = false; |
| 143 | 143 | foreach ($traversable as $key => $value) { |
| 144 | - if (! $assoc && ! is_int($key)) { |
|
| 144 | + if (!$assoc && !is_int($key)) { |
|
| 145 | 145 | $assoc = true; |
| 146 | 146 | } |
| 147 | - if (! $predicate($value, $key)) { |
|
| 147 | + if (!$predicate($value, $key)) { |
|
| 148 | 148 | continue; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $map = []; |
| 217 | 217 | foreach ($traversable as $key => $value) { |
| 218 | 218 | $newKey = $keyFn($value, $key); |
| 219 | - if (! is_scalar($newKey)) { |
|
| 219 | + if (!is_scalar($newKey)) { |
|
| 220 | 220 | continue; |
| 221 | 221 | } |
| 222 | 222 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | public static function every($traversable, callable $predicate) |
| 296 | 296 | { |
| 297 | 297 | foreach ($traversable as $key => $value) { |
| 298 | - if (! $predicate($value, $key)) { |
|
| 298 | + if (!$predicate($value, $key)) { |
|
| 299 | 299 | return false; |
| 300 | 300 | } |
| 301 | 301 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | public static function invariant($test, $message = '') |
| 311 | 311 | { |
| 312 | - if (! $test) { |
|
| 312 | + if (!$test) { |
|
| 313 | 313 | if (func_num_args() > 2) { |
| 314 | 314 | $args = func_get_args(); |
| 315 | 315 | array_shift($args); |
@@ -446,10 +446,10 @@ discard block |
||
| 446 | 446 | */ |
| 447 | 447 | public static function ord($char, $encoding = 'UTF-8') |
| 448 | 448 | { |
| 449 | - if (! $char && $char !== '0') { |
|
| 449 | + if (!$char && $char !== '0') { |
|
| 450 | 450 | return 0; |
| 451 | 451 | } |
| 452 | - if (! isset($char[1])) { |
|
| 452 | + if (!isset($char[1])) { |
|
| 453 | 453 | return ord($char); |
| 454 | 454 | } |
| 455 | 455 | if ($encoding !== 'UCS-4BE') { |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | ); |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - if (! preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) { |
|
| 530 | + if (!preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) { |
|
| 531 | 531 | return new Error( |
| 532 | 532 | sprintf('Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "%s" does not.', $name), |
| 533 | 533 | $node |
@@ -547,9 +547,9 @@ discard block |
||
| 547 | 547 | */ |
| 548 | 548 | public static function withErrorHandling(callable $fn, array &$errors) |
| 549 | 549 | { |
| 550 | - return static function () use ($fn, &$errors) { |
|
| 550 | + return static function() use ($fn, &$errors) { |
|
| 551 | 551 | // Catch custom errors (to report them in query results) |
| 552 | - set_error_handler(static function ($severity, $message, $file, $line) use (&$errors) { |
|
| 552 | + set_error_handler(static function($severity, $message, $file, $line) use (&$errors) { |
|
| 553 | 553 | $errors[] = new ErrorException($message, 0, $severity, $file, $line); |
| 554 | 554 | }); |
| 555 | 555 | |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | public static function quotedOrList(array $items) |
| 570 | 570 | { |
| 571 | 571 | $items = array_map( |
| 572 | - static function ($item) { |
|
| 572 | + static function($item) { |
|
| 573 | 573 | return sprintf('"%s"', $item); |
| 574 | 574 | }, |
| 575 | 575 | $items |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | |
| 599 | 599 | return array_reduce( |
| 600 | 600 | range(1, $selectedLength - 1), |
| 601 | - static function ($list, $index) use ($selected, $selectedLength) { |
|
| 601 | + static function($list, $index) use ($selected, $selectedLength) { |
|
| 602 | 602 | return $list . |
| 603 | 603 | ($selectedLength > 2 ? ', ' : ' ') . |
| 604 | 604 | ($index === $selectedLength - 1 ? 'or ' : '') . |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $breakingChanges = []; |
| 122 | 122 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 123 | - if (! isset($newTypeMap[$typeName])) { |
|
| 123 | + if (!isset($newTypeMap[$typeName])) { |
|
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | $newType = $newTypeMap[$typeName]; |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | $breakingChanges = []; |
| 187 | 187 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 188 | 188 | $newType = $newTypeMap[$typeName] ?? null; |
| 189 | - if (! ($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
| 190 | - ! ($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
| 191 | - ! ($newType instanceof $oldType) |
|
| 189 | + if (!($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
| 190 | + !($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
| 191 | + !($newType instanceof $oldType) |
|
| 192 | 192 | ) { |
| 193 | 193 | continue; |
| 194 | 194 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $newTypeFieldsDef = $newType->getFields(); |
| 198 | 198 | foreach ($oldTypeFieldsDef as $fieldName => $fieldDefinition) { |
| 199 | 199 | // Check if the field is missing on the type in the new schema. |
| 200 | - if (! isset($newTypeFieldsDef[$fieldName])) { |
|
| 200 | + if (!isset($newTypeFieldsDef[$fieldName])) { |
|
| 201 | 201 | $breakingChanges[] = [ |
| 202 | 202 | 'type' => self::BREAKING_CHANGE_FIELD_REMOVED, |
| 203 | 203 | 'description' => "${typeName}.${fieldName} was removed.", |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $oldFieldType, |
| 210 | 210 | $newFieldType |
| 211 | 211 | ); |
| 212 | - if (! $isSafe) { |
|
| 212 | + if (!$isSafe) { |
|
| 213 | 213 | $oldFieldTypeString = $oldFieldType instanceof NamedType |
| 214 | 214 | ? $oldFieldType->name |
| 215 | 215 | : $oldFieldType; |
@@ -279,14 +279,14 @@ discard block |
||
| 279 | 279 | $dangerousChanges = []; |
| 280 | 280 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 281 | 281 | $newType = $newTypeMap[$typeName] ?? null; |
| 282 | - if (! ($oldType instanceof InputObjectType) || ! ($newType instanceof InputObjectType)) { |
|
| 282 | + if (!($oldType instanceof InputObjectType) || !($newType instanceof InputObjectType)) { |
|
| 283 | 283 | continue; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | $oldTypeFieldsDef = $oldType->getFields(); |
| 287 | 287 | $newTypeFieldsDef = $newType->getFields(); |
| 288 | 288 | foreach (array_keys($oldTypeFieldsDef) as $fieldName) { |
| 289 | - if (! isset($newTypeFieldsDef[$fieldName])) { |
|
| 289 | + if (!isset($newTypeFieldsDef[$fieldName])) { |
|
| 290 | 290 | $breakingChanges[] = [ |
| 291 | 291 | 'type' => self::BREAKING_CHANGE_FIELD_REMOVED, |
| 292 | 292 | 'description' => "${typeName}.${fieldName} was removed.", |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | $oldFieldType, |
| 300 | 300 | $newFieldType |
| 301 | 301 | ); |
| 302 | - if (! $isSafe) { |
|
| 302 | + if (!$isSafe) { |
|
| 303 | 303 | $oldFieldTypeString = $oldFieldType instanceof NamedType |
| 304 | 304 | ? $oldFieldType->name |
| 305 | 305 | : $oldFieldType; |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | $newType->getWrappedType() |
| 371 | 371 | )) || |
| 372 | 372 | // moving from non-null to nullable of the same underlying type is safe |
| 373 | - ! ($newType instanceof NonNull) && |
|
| 373 | + !($newType instanceof NonNull) && |
|
| 374 | 374 | self::isChangeSafeForInputObjectFieldOrFieldArg($oldType->getWrappedType(), $newType); |
| 375 | 375 | } |
| 376 | 376 | |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | $typesRemovedFromUnion = []; |
| 394 | 394 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 395 | 395 | $newType = $newTypeMap[$typeName] ?? null; |
| 396 | - if (! ($oldType instanceof UnionType) || ! ($newType instanceof UnionType)) { |
|
| 396 | + if (!($oldType instanceof UnionType) || !($newType instanceof UnionType)) { |
|
| 397 | 397 | continue; |
| 398 | 398 | } |
| 399 | 399 | $typeNamesInNewUnion = []; |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | $valuesRemovedFromEnums = []; |
| 432 | 432 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 433 | 433 | $newType = $newTypeMap[$typeName] ?? null; |
| 434 | - if (! ($oldType instanceof EnumType) || ! ($newType instanceof EnumType)) { |
|
| 434 | + if (!($oldType instanceof EnumType) || !($newType instanceof EnumType)) { |
|
| 435 | 435 | continue; |
| 436 | 436 | } |
| 437 | 437 | $valuesInNewEnum = []; |
@@ -473,9 +473,9 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 475 | 475 | $newType = $newTypeMap[$typeName] ?? null; |
| 476 | - if (! ($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
| 477 | - ! ($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
| 478 | - ! ($newType instanceof $oldType) |
|
| 476 | + if (!($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
| 477 | + !($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
| 478 | + !($newType instanceof $oldType) |
|
| 479 | 479 | ) { |
| 480 | 480 | continue; |
| 481 | 481 | } |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | $newTypeFields = $newType->getFields(); |
| 485 | 485 | |
| 486 | 486 | foreach ($oldTypeFields as $fieldName => $oldField) { |
| 487 | - if (! isset($newTypeFields[$fieldName])) { |
|
| 487 | + if (!isset($newTypeFields[$fieldName])) { |
|
| 488 | 488 | continue; |
| 489 | 489 | } |
| 490 | 490 | |
@@ -492,18 +492,18 @@ discard block |
||
| 492 | 492 | $newArgs = $newTypeFields[$fieldName]->args; |
| 493 | 493 | $newArgDef = Utils::find( |
| 494 | 494 | $newArgs, |
| 495 | - static function ($arg) use ($oldArgDef) { |
|
| 495 | + static function($arg) use ($oldArgDef) { |
|
| 496 | 496 | return $arg->name === $oldArgDef->name; |
| 497 | 497 | } |
| 498 | 498 | ); |
| 499 | 499 | if ($newArgDef !== null) { |
| 500 | - $isSafe = self::isChangeSafeForInputObjectFieldOrFieldArg( |
|
| 500 | + $isSafe = self::isChangeSafeForInputObjectFieldOrFieldArg( |
|
| 501 | 501 | $oldArgDef->getType(), |
| 502 | 502 | $newArgDef->getType() |
| 503 | 503 | ); |
| 504 | 504 | $oldArgType = $oldArgDef->getType(); |
| 505 | 505 | $oldArgName = $oldArgDef->name; |
| 506 | - if (! $isSafe) { |
|
| 506 | + if (!$isSafe) { |
|
| 507 | 507 | $newArgType = $newArgDef->getType(); |
| 508 | 508 | $breakingChanges[] = [ |
| 509 | 509 | 'type' => self::BREAKING_CHANGE_ARG_CHANGED_KIND, |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | $oldArgs = $oldTypeFields[$fieldName]->args; |
| 532 | 532 | $oldArgDef = Utils::find( |
| 533 | 533 | $oldArgs, |
| 534 | - static function ($arg) use ($newArgDef) { |
|
| 534 | + static function($arg) use ($newArgDef) { |
|
| 535 | 535 | return $arg->name === $newArgDef->name; |
| 536 | 536 | } |
| 537 | 537 | ); |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 579 | 579 | $newType = $newTypeMap[$typeName] ?? null; |
| 580 | - if (! ($oldType instanceof ObjectType) || ! ($newType instanceof ObjectType)) { |
|
| 580 | + if (!($oldType instanceof ObjectType) || !($newType instanceof ObjectType)) { |
|
| 581 | 581 | continue; |
| 582 | 582 | } |
| 583 | 583 | |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | foreach ($oldInterfaces as $oldInterface) { |
| 587 | 587 | $interface = Utils::find( |
| 588 | 588 | $newInterfaces, |
| 589 | - static function (InterfaceType $interface) use ($oldInterface) : bool { |
|
| 589 | + static function(InterfaceType $interface) use ($oldInterface) : bool { |
|
| 590 | 590 | return $interface->name === $oldInterface->name; |
| 591 | 591 | } |
| 592 | 592 | ); |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | { |
| 631 | 631 | return Utils::keyMap( |
| 632 | 632 | $schema->getDirectives(), |
| 633 | - static function ($dir) { |
|
| 633 | + static function($dir) { |
|
| 634 | 634 | return $dir->name; |
| 635 | 635 | } |
| 636 | 636 | ); |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
| 643 | 643 | |
| 644 | 644 | foreach ($newSchema->getDirectives() as $newDirective) { |
| 645 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 645 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 646 | 646 | continue; |
| 647 | 647 | } |
| 648 | 648 | |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | { |
| 680 | 680 | return Utils::keyMap( |
| 681 | 681 | $directive->args ?: [], |
| 682 | - static function ($arg) { |
|
| 682 | + static function($arg) { |
|
| 683 | 683 | return $arg->name; |
| 684 | 684 | } |
| 685 | 685 | ); |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
| 692 | 692 | |
| 693 | 693 | foreach ($newSchema->getDirectives() as $newDirective) { |
| 694 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 694 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 695 | 695 | continue; |
| 696 | 696 | } |
| 697 | 697 | |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | $oldSchemaDirectiveMap[$newDirective->name], |
| 700 | 700 | $newDirective |
| 701 | 701 | ) as $arg) { |
| 702 | - if (! $arg->getType() instanceof NonNull) { |
|
| 702 | + if (!$arg->getType() instanceof NonNull) { |
|
| 703 | 703 | continue; |
| 704 | 704 | } |
| 705 | 705 | $addedNonNullableArgs[] = [ |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
| 744 | 744 | |
| 745 | 745 | foreach ($newSchema->getDirectives() as $newDirective) { |
| 746 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 746 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
| 747 | 747 | continue; |
| 748 | 748 | } |
| 749 | 749 | |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | $valuesAddedToEnums = []; |
| 810 | 810 | foreach ($oldTypeMap as $typeName => $oldType) { |
| 811 | 811 | $newType = $newTypeMap[$typeName] ?? null; |
| 812 | - if (! ($oldType instanceof EnumType) || ! ($newType instanceof EnumType)) { |
|
| 812 | + if (!($oldType instanceof EnumType) || !($newType instanceof EnumType)) { |
|
| 813 | 813 | continue; |
| 814 | 814 | } |
| 815 | 815 | $valuesInOldEnum = []; |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | |
| 845 | 845 | foreach ($newTypeMap as $typeName => $newType) { |
| 846 | 846 | $oldType = $oldTypeMap[$typeName] ?? null; |
| 847 | - if (! ($oldType instanceof ObjectType) || ! ($newType instanceof ObjectType)) { |
|
| 847 | + if (!($oldType instanceof ObjectType) || !($newType instanceof ObjectType)) { |
|
| 848 | 848 | continue; |
| 849 | 849 | } |
| 850 | 850 | |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | foreach ($newInterfaces as $newInterface) { |
| 854 | 854 | $interface = Utils::find( |
| 855 | 855 | $oldInterfaces, |
| 856 | - static function (InterfaceType $interface) use ($newInterface) : bool { |
|
| 856 | + static function(InterfaceType $interface) use ($newInterface) : bool { |
|
| 857 | 857 | return $interface->name === $newInterface->name; |
| 858 | 858 | } |
| 859 | 859 | ); |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | $typesAddedToUnion = []; |
| 893 | 893 | foreach ($newTypeMap as $typeName => $newType) { |
| 894 | 894 | $oldType = $oldTypeMap[$typeName] ?? null; |
| 895 | - if (! ($oldType instanceof UnionType) || ! ($newType instanceof UnionType)) { |
|
| 895 | + if (!($oldType instanceof UnionType) || !($newType instanceof UnionType)) { |
|
| 896 | 896 | continue; |
| 897 | 897 | } |
| 898 | 898 | |
@@ -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 |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | private static function printDescription($options, $def, $indentation = '', $firstInBlock = true) : string |
| 171 | 171 | { |
| 172 | - if (! $def->description) { |
|
| 172 | + if (!$def->description) { |
|
| 173 | 173 | return ''; |
| 174 | 174 | } |
| 175 | 175 | $lines = self::descriptionLines($def->description, 120 - strlen($indentation)); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | return self::printDescriptionWithComments($lines, $indentation, $firstInBlock); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $description = $indentation && ! $firstInBlock |
|
| 180 | + $description = $indentation && !$firstInBlock |
|
| 181 | 181 | ? "\n" . $indentation . '"""' |
| 182 | 182 | : $indentation . '"""'; |
| 183 | 183 | |
@@ -195,13 +195,13 @@ discard block |
||
| 195 | 195 | substr($lines[0], 0, 1) === ' ' || |
| 196 | 196 | substr($lines[0], 0, 1) === '\t' |
| 197 | 197 | ); |
| 198 | - if (! $hasLeadingSpace) { |
|
| 198 | + if (!$hasLeadingSpace) { |
|
| 199 | 199 | $description .= "\n"; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | $lineLength = count($lines); |
| 203 | 203 | for ($i = 0; $i < $lineLength; $i++) { |
| 204 | - if ($i !== 0 || ! $hasLeadingSpace) { |
|
| 204 | + if ($i !== 0 || !$hasLeadingSpace) { |
|
| 205 | 205 | $description .= $indentation; |
| 206 | 206 | } |
| 207 | 207 | $description .= self::escapeQuote($lines[$i]) . "\n"; |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | private static function printDescriptionWithComments($lines, $indentation, $firstInBlock) : string |
| 252 | 252 | { |
| 253 | - $description = $indentation && ! $firstInBlock ? "\n" : ''; |
|
| 253 | + $description = $indentation && !$firstInBlock ? "\n" : ''; |
|
| 254 | 254 | foreach ($lines as $line) { |
| 255 | 255 | if ($line === '') { |
| 256 | 256 | $description .= $indentation . "#\n"; |
@@ -269,14 +269,14 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | private static function printArgs($options, $args, $indentation = '') : string |
| 271 | 271 | { |
| 272 | - if (! $args) { |
|
| 272 | + if (!$args) { |
|
| 273 | 273 | return ''; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | // If every arg does not have a description, print them on one line. |
| 277 | 277 | if (Utils::every( |
| 278 | 278 | $args, |
| 279 | - static function ($arg) { |
|
| 279 | + static function($arg) { |
|
| 280 | 280 | return empty($arg->description); |
| 281 | 281 | } |
| 282 | 282 | )) { |
@@ -288,8 +288,8 @@ discard block |
||
| 288 | 288 | implode( |
| 289 | 289 | "\n", |
| 290 | 290 | array_map( |
| 291 | - static function ($arg, $i) use ($indentation, $options) { |
|
| 292 | - return self::printDescription($options, $arg, ' ' . $indentation, ! $i) . ' ' . $indentation . |
|
| 291 | + static function($arg, $i) use ($indentation, $options) { |
|
| 292 | + return self::printDescription($options, $arg, ' ' . $indentation, !$i) . ' ' . $indentation . |
|
| 293 | 293 | self::printInputValue($arg); |
| 294 | 294 | }, |
| 295 | 295 | $args, |
@@ -356,11 +356,11 @@ discard block |
||
| 356 | 356 | private static function printObject(ObjectType $type, array $options) : string |
| 357 | 357 | { |
| 358 | 358 | $interfaces = $type->getInterfaces(); |
| 359 | - $implementedInterfaces = ! empty($interfaces) ? |
|
| 359 | + $implementedInterfaces = !empty($interfaces) ? |
|
| 360 | 360 | ' implements ' . implode( |
| 361 | 361 | ' & ', |
| 362 | 362 | array_map( |
| 363 | - static function ($i) { |
|
| 363 | + static function($i) { |
|
| 364 | 364 | return $i->name; |
| 365 | 365 | }, |
| 366 | 366 | $interfaces |
@@ -381,8 +381,8 @@ discard block |
||
| 381 | 381 | return implode( |
| 382 | 382 | "\n", |
| 383 | 383 | array_map( |
| 384 | - static function ($f, $i) use ($options) { |
|
| 385 | - return self::printDescription($options, $f, ' ', ! $i) . ' ' . |
|
| 384 | + static function($f, $i) use ($options) { |
|
| 385 | + return self::printDescription($options, $f, ' ', !$i) . ' ' . |
|
| 386 | 386 | $f->name . self::printArgs($options, $f->args, ' ') . ': ' . |
| 387 | 387 | (string) $f->getType() . self::printDeprecated($f); |
| 388 | 388 | }, |
@@ -441,8 +441,8 @@ discard block |
||
| 441 | 441 | return implode( |
| 442 | 442 | "\n", |
| 443 | 443 | array_map( |
| 444 | - static function ($value, $i) use ($options) { |
|
| 445 | - return self::printDescription($options, $value, ' ', ! $i) . ' ' . |
|
| 444 | + static function($value, $i) use ($options) { |
|
| 445 | + return self::printDescription($options, $value, ' ', !$i) . ' ' . |
|
| 446 | 446 | $value->name . self::printDeprecated($value); |
| 447 | 447 | }, |
| 448 | 448 | $values, |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | implode( |
| 466 | 466 | "\n", |
| 467 | 467 | array_map( |
| 468 | - static function ($f, $i) use ($options) { |
|
| 469 | - return self::printDescription($options, $f, ' ', ! $i) . ' ' . self::printInputValue($f); |
|
| 468 | + static function($f, $i) use ($options) { |
|
| 469 | + return self::printDescription($options, $f, ' ', !$i) . ' ' . self::printInputValue($f); |
|
| 470 | 470 | }, |
| 471 | 471 | $fields, |
| 472 | 472 | array_keys($fields) |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | 'description' => $this->getDescription($directiveNode), |
| 85 | 85 | 'locations' => Utils::map( |
| 86 | 86 | $directiveNode->locations, |
| 87 | - static function ($node) { |
|
| 87 | + static function($node) { |
|
| 88 | 88 | return $node->value; |
| 89 | 89 | } |
| 90 | 90 | ), |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | private function getLeadingCommentBlock($node) |
| 115 | 115 | { |
| 116 | 116 | $loc = $node->loc; |
| 117 | - if (! $loc || ! $loc->startToken) { |
|
| 117 | + if (!$loc || !$loc->startToken) { |
|
| 118 | 118 | return null; |
| 119 | 119 | } |
| 120 | 120 | $comments = []; |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | { |
| 138 | 138 | return Utils::keyValMap( |
| 139 | 139 | $values, |
| 140 | - static function ($value) { |
|
| 140 | + static function($value) { |
|
| 141 | 141 | return $value->name->value; |
| 142 | 142 | }, |
| 143 | - function ($value) { |
|
| 143 | + function($value) { |
|
| 144 | 144 | // Note: While this could make assertions to get the correctly typed |
| 145 | 145 | // value, that would throw immediately while type system validation |
| 146 | 146 | // with validateSchema() will produce more actionable results. |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | private function internalBuildType($typeName, $typeNode = null) |
| 200 | 200 | { |
| 201 | - if (! isset($this->cache[$typeName])) { |
|
| 201 | + if (!isset($this->cache[$typeName])) { |
|
| 202 | 202 | if (isset($this->typeDefinitionsMap[$typeName])) { |
| 203 | 203 | $type = $this->makeSchemaDef($this->typeDefinitionsMap[$typeName]); |
| 204 | 204 | if ($this->typeConfigDecorator) { |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $e |
| 217 | 217 | ); |
| 218 | 218 | } |
| 219 | - if (! is_array($config) || isset($config[0])) { |
|
| 219 | + if (!is_array($config) || isset($config[0])) { |
|
| 220 | 220 | throw new Error( |
| 221 | 221 | sprintf( |
| 222 | 222 | 'Type config decorator passed to %s is expected to return an array, but got %s', |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | private function makeSchemaDef($def) |
| 248 | 248 | { |
| 249 | - if (! $def) { |
|
| 249 | + if (!$def) { |
|
| 250 | 250 | throw new Error('def must be defined.'); |
| 251 | 251 | } |
| 252 | 252 | switch ($def->kind) { |
@@ -274,10 +274,10 @@ discard block |
||
| 274 | 274 | return new ObjectType([ |
| 275 | 275 | 'name' => $typeName, |
| 276 | 276 | 'description' => $this->getDescription($def), |
| 277 | - 'fields' => function () use ($def) { |
|
| 277 | + 'fields' => function() use ($def) { |
|
| 278 | 278 | return $this->makeFieldDefMap($def); |
| 279 | 279 | }, |
| 280 | - 'interfaces' => function () use ($def) { |
|
| 280 | + 'interfaces' => function() use ($def) { |
|
| 281 | 281 | return $this->makeImplementedInterfaces($def); |
| 282 | 282 | }, |
| 283 | 283 | 'astNode' => $def, |
@@ -289,10 +289,10 @@ discard block |
||
| 289 | 289 | return $def->fields |
| 290 | 290 | ? Utils::keyValMap( |
| 291 | 291 | $def->fields, |
| 292 | - static function ($field) { |
|
| 292 | + static function($field) { |
|
| 293 | 293 | return $field->name->value; |
| 294 | 294 | }, |
| 295 | - function ($field) { |
|
| 295 | + function($field) { |
|
| 296 | 296 | return $this->buildField($field); |
| 297 | 297 | } |
| 298 | 298 | ) |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | // validation with validateSchema() will produce more actionable results. |
| 337 | 337 | return Utils::map( |
| 338 | 338 | $def->interfaces, |
| 339 | - function ($iface) { |
|
| 339 | + function($iface) { |
|
| 340 | 340 | return $this->buildType($iface); |
| 341 | 341 | } |
| 342 | 342 | ); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | return new InterfaceType([ |
| 353 | 353 | 'name' => $typeName, |
| 354 | 354 | 'description' => $this->getDescription($def), |
| 355 | - 'fields' => function () use ($def) { |
|
| 355 | + 'fields' => function() use ($def) { |
|
| 356 | 356 | return $this->makeFieldDefMap($def); |
| 357 | 357 | }, |
| 358 | 358 | 'astNode' => $def, |
@@ -367,10 +367,10 @@ discard block |
||
| 367 | 367 | 'values' => $def->values |
| 368 | 368 | ? Utils::keyValMap( |
| 369 | 369 | $def->values, |
| 370 | - static function ($enumValue) { |
|
| 370 | + static function($enumValue) { |
|
| 371 | 371 | return $enumValue->name->value; |
| 372 | 372 | }, |
| 373 | - function ($enumValue) { |
|
| 373 | + function($enumValue) { |
|
| 374 | 374 | return [ |
| 375 | 375 | 'description' => $this->getDescription($enumValue), |
| 376 | 376 | 'deprecationReason' => $this->getDeprecationReason($enumValue), |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | 'types' => $def->types |
| 395 | 395 | ? Utils::map( |
| 396 | 396 | $def->types, |
| 397 | - function ($typeNode) { |
|
| 397 | + function($typeNode) { |
|
| 398 | 398 | return $this->buildType($typeNode); |
| 399 | 399 | } |
| 400 | 400 | ) : |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | 'name' => $def->name->value, |
| 410 | 410 | 'description' => $this->getDescription($def), |
| 411 | 411 | 'astNode' => $def, |
| 412 | - 'serialize' => static function ($value) { |
|
| 412 | + 'serialize' => static function($value) { |
|
| 413 | 413 | return $value; |
| 414 | 414 | }, |
| 415 | 415 | ]); |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | return new InputObjectType([ |
| 421 | 421 | 'name' => $def->name->value, |
| 422 | 422 | 'description' => $this->getDescription($def), |
| 423 | - 'fields' => function () use ($def) { |
|
| 423 | + 'fields' => function() use ($def) { |
|
| 424 | 424 | return $def->fields |
| 425 | 425 | ? $this->makeInputValues($def->fields) |
| 426 | 426 | : []; |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | */ |
| 440 | 440 | private function makeSchemaDefFromConfig($def, array $config) |
| 441 | 441 | { |
| 442 | - if (! $def) { |
|
| 442 | + if (!$def) { |
|
| 443 | 443 | throw new Error('def must be defined.'); |
| 444 | 444 | } |
| 445 | 445 | switch ($def->kind) { |
@@ -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(); |
@@ -219,13 +219,13 @@ discard block |
||
| 219 | 219 | $fieldExists = property_exists($value, $fieldName); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if (! $fieldExists) { |
|
| 222 | + if (!$fieldExists) { |
|
| 223 | 223 | continue; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $fieldNode = self::astFromValue($fieldValue, $field->getType()); |
| 227 | 227 | |
| 228 | - if (! $fieldNode) { |
|
| 228 | + if (!$fieldNode) { |
|
| 229 | 229 | continue; |
| 230 | 230 | } |
| 231 | 231 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | if ($valueNode instanceof VariableNode) { |
| 350 | 350 | $variableName = $valueNode->name->value; |
| 351 | 351 | |
| 352 | - if (! $variables || ! array_key_exists($variableName, $variables)) { |
|
| 352 | + if (!$variables || !array_key_exists($variableName, $variables)) { |
|
| 353 | 353 | // No valid return value. |
| 354 | 354 | return $undefined; |
| 355 | 355 | } |
@@ -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 | |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | private static function isMissingVariable($valueNode, $variables) |
| 481 | 481 | { |
| 482 | 482 | return $valueNode instanceof VariableNode && |
| 483 | - (count($variables) === 0 || ! array_key_exists($valueNode->name->value, $variables)); |
|
| 483 | + (count($variables) === 0 || !array_key_exists($valueNode->name->value, $variables)); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | /** |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | return $valueNode->value; |
| 524 | 524 | case $valueNode instanceof ListValueNode: |
| 525 | 525 | return array_map( |
| 526 | - static function ($node) use ($variables) { |
|
| 526 | + static function($node) use ($variables) { |
|
| 527 | 527 | return self::valueFromASTUntyped($node, $variables); |
| 528 | 528 | }, |
| 529 | 529 | iterator_to_array($valueNode->values) |
@@ -531,13 +531,13 @@ discard block |
||
| 531 | 531 | case $valueNode instanceof ObjectValueNode: |
| 532 | 532 | return array_combine( |
| 533 | 533 | array_map( |
| 534 | - static function ($field) { |
|
| 534 | + static function($field) { |
|
| 535 | 535 | return $field->name->value; |
| 536 | 536 | }, |
| 537 | 537 | iterator_to_array($valueNode->fields) |
| 538 | 538 | ), |
| 539 | 539 | array_map( |
| 540 | - static function ($field) use ($variables) { |
|
| 540 | + static function($field) use ($variables) { |
|
| 541 | 541 | return self::valueFromASTUntyped($field->value, $variables); |
| 542 | 542 | }, |
| 543 | 543 | iterator_to_array($valueNode->fields) |
@@ -597,11 +597,11 @@ discard block |
||
| 597 | 597 | { |
| 598 | 598 | if ($document->definitions) { |
| 599 | 599 | foreach ($document->definitions as $def) { |
| 600 | - if (! ($def instanceof OperationDefinitionNode)) { |
|
| 600 | + if (!($def instanceof OperationDefinitionNode)) { |
|
| 601 | 601 | continue; |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - if (! $operationName || (isset($def->name->value) && $def->name->value === $operationName)) { |
|
| 604 | + if (!$operationName || (isset($def->name->value) && $def->name->value === $operationName)) { |
|
| 605 | 605 | return $def->operation; |
| 606 | 606 | } |
| 607 | 607 | } |