@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | protected static function getExtensionASTNodes(NamedType $type) : ?array |
| 59 | 59 | { |
| 60 | - if (! $type instanceof Type) { |
|
| 60 | + if (!$type instanceof Type) { |
|
| 61 | 61 | return null; |
| 62 | 62 | } |
| 63 | 63 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | switch (true) { |
| 82 | 82 | case $node instanceof ObjectTypeExtensionNode: |
| 83 | - if (! ($type instanceof ObjectType)) { |
|
| 83 | + if (!($type instanceof ObjectType)) { |
|
| 84 | 84 | throw new Error( |
| 85 | 85 | 'Cannot extend non-object type "' . $type->name . '".', |
| 86 | 86 | [$node] |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | break; |
| 90 | 90 | case $node instanceof InterfaceTypeExtensionNode: |
| 91 | - if (! ($type instanceof InterfaceType)) { |
|
| 91 | + if (!($type instanceof InterfaceType)) { |
|
| 92 | 92 | throw new Error( |
| 93 | 93 | 'Cannot extend non-interface type "' . $type->name . '".', |
| 94 | 94 | [$node] |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | break; |
| 98 | 98 | case $node instanceof EnumTypeExtensionNode: |
| 99 | - if (! ($type instanceof EnumType)) { |
|
| 99 | + if (!($type instanceof EnumType)) { |
|
| 100 | 100 | throw new Error( |
| 101 | 101 | 'Cannot extend non-enum type "' . $type->name . '".', |
| 102 | 102 | [$node] |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | break; |
| 106 | 106 | case $node instanceof UnionTypeExtensionNode: |
| 107 | - if (! ($type instanceof UnionType)) { |
|
| 107 | + if (!($type instanceof UnionType)) { |
|
| 108 | 108 | throw new Error( |
| 109 | 109 | 'Cannot extend non-union type "' . $type->name . '".', |
| 110 | 110 | [$node] |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | break; |
| 114 | 114 | case $node instanceof InputObjectTypeExtensionNode: |
| 115 | - if (! ($type instanceof InputObjectType)) { |
|
| 115 | + if (!($type instanceof InputObjectType)) { |
|
| 116 | 116 | throw new Error( |
| 117 | 117 | 'Cannot extend non-input object type "' . $type->name . '".', |
| 118 | 118 | [$node] |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | return new UnionType([ |
| 141 | 141 | 'name' => $type->name, |
| 142 | 142 | 'description' => $type->description, |
| 143 | - 'types' => static function () use ($type) { |
|
| 143 | + 'types' => static function() use ($type) { |
|
| 144 | 144 | return static::extendPossibleTypes($type); |
| 145 | 145 | }, |
| 146 | 146 | 'astNode' => $type->astNode, |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | return new InputObjectType([ |
| 166 | 166 | 'name' => $type->name, |
| 167 | 167 | 'description' => $type->description, |
| 168 | - 'fields' => static function () use ($type) { |
|
| 168 | + 'fields' => static function() use ($type) { |
|
| 169 | 169 | return static::extendInputFieldMap($type); |
| 170 | 170 | }, |
| 171 | 171 | 'astNode' => $type->astNode, |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | 'astNode' => $field->astNode, |
| 188 | 188 | ]; |
| 189 | 189 | |
| 190 | - if (! $field->defaultValueExists()) { |
|
| 190 | + if (!$field->defaultValueExists()) { |
|
| 191 | 191 | continue; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | protected static function extendPossibleTypes(UnionType $type) : array |
| 256 | 256 | { |
| 257 | - $possibleTypes = array_map(static function ($type) { |
|
| 257 | + $possibleTypes = array_map(static function($type) { |
|
| 258 | 258 | return static::extendNamedType($type); |
| 259 | 259 | }, $type->getTypes()); |
| 260 | 260 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | protected static function extendImplementedInterfaces(ObjectType $type) : array |
| 277 | 277 | { |
| 278 | - $interfaces = array_map(static function (InterfaceType $interfaceType) { |
|
| 278 | + $interfaces = array_map(static function(InterfaceType $interfaceType) { |
|
| 279 | 279 | return static::extendNamedType($interfaceType); |
| 280 | 280 | }, $type->getInterfaces()); |
| 281 | 281 | |
@@ -314,10 +314,10 @@ discard block |
||
| 314 | 314 | { |
| 315 | 315 | return Utils::keyValMap( |
| 316 | 316 | $args, |
| 317 | - static function (FieldArgument $arg) { |
|
| 317 | + static function(FieldArgument $arg) { |
|
| 318 | 318 | return $arg->name; |
| 319 | 319 | }, |
| 320 | - static function (FieldArgument $arg) { |
|
| 320 | + static function(FieldArgument $arg) { |
|
| 321 | 321 | $def = [ |
| 322 | 322 | 'type' => static::extendType($arg->getType()), |
| 323 | 323 | 'description' => $arg->description, |
@@ -381,10 +381,10 @@ discard block |
||
| 381 | 381 | return new ObjectType([ |
| 382 | 382 | 'name' => $type->name, |
| 383 | 383 | 'description' => $type->description, |
| 384 | - 'interfaces' => static function () use ($type) { |
|
| 384 | + 'interfaces' => static function() use ($type) { |
|
| 385 | 385 | return static::extendImplementedInterfaces($type); |
| 386 | 386 | }, |
| 387 | - 'fields' => static function () use ($type) { |
|
| 387 | + 'fields' => static function() use ($type) { |
|
| 388 | 388 | return static::extendFieldMap($type); |
| 389 | 389 | }, |
| 390 | 390 | 'astNode' => $type->astNode, |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | return new InterfaceType([ |
| 399 | 399 | 'name' => $type->name, |
| 400 | 400 | 'description' => $type->description, |
| 401 | - 'fields' => static function () use ($type) { |
|
| 401 | + 'fields' => static function() use ($type) { |
|
| 402 | 402 | return static::extendFieldMap($type); |
| 403 | 403 | }, |
| 404 | 404 | 'astNode' => $type->astNode, |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | $name = $type->name; |
| 429 | - if (! isset(static::$extendTypeCache[$name])) { |
|
| 429 | + if (!isset(static::$extendTypeCache[$name])) { |
|
| 430 | 430 | if ($type instanceof CustomScalarType) { |
| 431 | 431 | static::$extendTypeCache[$name] = static::extendCustomScalarType($type); |
| 432 | 432 | } elseif ($type instanceof ObjectType) { |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | */ |
| 465 | 465 | protected static function getMergedDirectives(Schema $schema, array $directiveDefinitions) : array |
| 466 | 466 | { |
| 467 | - $existingDirectives = array_map(static function (Directive $directive) { |
|
| 467 | + $existingDirectives = array_map(static function(Directive $directive) { |
|
| 468 | 468 | return static::extendDirective($directive); |
| 469 | 469 | }, $schema->getDirectives()); |
| 470 | 470 | |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | |
| 473 | 473 | return array_merge( |
| 474 | 474 | $existingDirectives, |
| 475 | - array_map(static function (DirectiveDefinitionNode $directive) { |
|
| 475 | + array_map(static function(DirectiveDefinitionNode $directive) { |
|
| 476 | 476 | return static::$astBuilder->buildDirective($directive); |
| 477 | 477 | }, $directiveDefinitions) |
| 478 | 478 | ); |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | */ |
| 495 | 495 | public static function extend(Schema $schema, DocumentNode $documentAST, ?array $options = null) : Schema |
| 496 | 496 | { |
| 497 | - if ($options === null || ! (isset($options['assumeValid']) || isset($options['assumeValidSDL']))) { |
|
| 497 | + if ($options === null || !(isset($options['assumeValid']) || isset($options['assumeValidSDL']))) { |
|
| 498 | 498 | DocumentValidator::assertValidSDLExtension($documentAST, $schema); |
| 499 | 499 | } |
| 500 | 500 | |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | static::$astBuilder = new ASTDefinitionBuilder( |
| 563 | 563 | $typeDefinitionMap, |
| 564 | 564 | $options, |
| 565 | - static function (string $typeName) use ($schema) { |
|
| 565 | + static function(string $typeName) use ($schema) { |
|
| 566 | 566 | /** @var NamedType $existingType */ |
| 567 | 567 | $existingType = $schema->getType($typeName); |
| 568 | 568 | if ($existingType !== null) { |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | foreach ($schemaExtensions as $schemaExtension) { |
| 598 | - if (! $schemaExtension->operationTypes) { |
|
| 598 | + if (!$schemaExtension->operationTypes) { |
|
| 599 | 599 | continue; |
| 600 | 600 | } |
| 601 | 601 | |
@@ -613,10 +613,10 @@ discard block |
||
| 613 | 613 | : $schema->extensionASTNodes; |
| 614 | 614 | |
| 615 | 615 | $types = array_merge( |
| 616 | - array_map(static function ($type) { |
|
| 616 | + array_map(static function($type) { |
|
| 617 | 617 | return static::extendType($type); |
| 618 | 618 | }, array_values($schema->getTypeMap())), |
| 619 | - array_map(static function ($type) { |
|
| 619 | + array_map(static function($type) { |
|
| 620 | 620 | return static::$astBuilder->buildType($type); |
| 621 | 621 | }, array_values($typeDefinitionMap)) |
| 622 | 622 | ); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | case $definition instanceof UnionTypeDefinitionNode: |
| 121 | 121 | case $definition instanceof InputObjectTypeDefinitionNode: |
| 122 | 122 | $typeName = $definition->name->value; |
| 123 | - if (! empty($this->nodeMap[$typeName])) { |
|
| 123 | + if (!empty($this->nodeMap[$typeName])) { |
|
| 124 | 124 | throw new Error(sprintf('Type "%s" was defined more than once.', $typeName)); |
| 125 | 125 | } |
| 126 | 126 | $typeDefs[] = $definition; |
@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | $DefinitionBuilder = new ASTDefinitionBuilder( |
| 144 | 144 | $this->nodeMap, |
| 145 | 145 | $this->options, |
| 146 | - static function ($typeName) { |
|
| 146 | + static function($typeName) { |
|
| 147 | 147 | throw new Error('Type "' . $typeName . '" not found in document.'); |
| 148 | 148 | }, |
| 149 | 149 | $this->typeConfigDecorator |
| 150 | 150 | ); |
| 151 | 151 | |
| 152 | 152 | $directives = array_map( |
| 153 | - static function ($def) use ($DefinitionBuilder) { |
|
| 153 | + static function($def) use ($DefinitionBuilder) { |
|
| 154 | 154 | return $DefinitionBuilder->buildDirective($def); |
| 155 | 155 | }, |
| 156 | 156 | $directiveDefs |
@@ -159,31 +159,31 @@ discard block |
||
| 159 | 159 | // If specified directives were not explicitly declared, add them. |
| 160 | 160 | $skip = array_reduce( |
| 161 | 161 | $directives, |
| 162 | - static function ($hasSkip, $directive) { |
|
| 162 | + static function($hasSkip, $directive) { |
|
| 163 | 163 | return $hasSkip || $directive->name === 'skip'; |
| 164 | 164 | } |
| 165 | 165 | ); |
| 166 | - if (! $skip) { |
|
| 166 | + if (!$skip) { |
|
| 167 | 167 | $directives[] = Directive::skipDirective(); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $include = array_reduce( |
| 171 | 171 | $directives, |
| 172 | - static function ($hasInclude, $directive) { |
|
| 172 | + static function($hasInclude, $directive) { |
|
| 173 | 173 | return $hasInclude || $directive->name === 'include'; |
| 174 | 174 | } |
| 175 | 175 | ); |
| 176 | - if (! $include) { |
|
| 176 | + if (!$include) { |
|
| 177 | 177 | $directives[] = Directive::includeDirective(); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $deprecated = array_reduce( |
| 181 | 181 | $directives, |
| 182 | - static function ($hasDeprecated, $directive) { |
|
| 182 | + static function($hasDeprecated, $directive) { |
|
| 183 | 183 | return $hasDeprecated || $directive->name === 'deprecated'; |
| 184 | 184 | } |
| 185 | 185 | ); |
| 186 | - if (! $deprecated) { |
|
| 186 | + if (!$deprecated) { |
|
| 187 | 187 | $directives[] = Directive::deprecatedDirective(); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | 'subscription' => isset($operationTypes['subscription']) |
| 202 | 202 | ? $DefinitionBuilder->buildType($operationTypes['subscription']) |
| 203 | 203 | : null, |
| 204 | - 'typeLoader' => static function ($name) use ($DefinitionBuilder) { |
|
| 204 | + 'typeLoader' => static function($name) use ($DefinitionBuilder) { |
|
| 205 | 205 | return $DefinitionBuilder->buildType($name); |
| 206 | 206 | }, |
| 207 | 207 | 'directives' => $directives, |
| 208 | 208 | 'astNode' => $schemaDef, |
| 209 | - 'types' => function () use ($DefinitionBuilder) { |
|
| 209 | + 'types' => function() use ($DefinitionBuilder) { |
|
| 210 | 210 | $types = []; |
| 211 | 211 | foreach ($this->nodeMap as $name => $def) { |
| 212 | 212 | $types[] = $DefinitionBuilder->buildType($def->name->value); |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | throw new Error(sprintf('Must provide only one %s type in schema.', $operation)); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - if (! isset($this->nodeMap[$typeName])) { |
|
| 239 | + if (!isset($this->nodeMap[$typeName])) { |
|
| 240 | 240 | throw new Error(sprintf('Specified %s type "%s" not found in document.', $operation, $typeName)); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $fieldName = $fieldNode->name->value; |
| 123 | 123 | |
| 124 | 124 | $argumentValueMap = null; |
| 125 | - if (! empty($fieldNode->arguments)) { |
|
| 125 | + if (!empty($fieldNode->arguments)) { |
|
| 126 | 126 | foreach ($fieldNode->arguments as $argumentNode) { |
| 127 | 127 | $argumentValueMap = $argumentValueMap ?? []; |
| 128 | 128 | $argumentValueMap[$argumentNode->name->value] = $argumentNode->value; |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if ($fieldName !== Introspection::TYPE_NAME_FIELD_NAME && |
| 133 | - ! ($runtimeType === $this->schema->getQueryType() && ($fieldName === Introspection::SCHEMA_FIELD_NAME || $fieldName === Introspection::TYPE_FIELD_NAME)) && |
|
| 134 | - ! $runtimeType->hasField($fieldName) |
|
| 133 | + !($runtimeType === $this->schema->getQueryType() && ($fieldName === Introspection::SCHEMA_FIELD_NAME || $fieldName === Introspection::TYPE_FIELD_NAME)) && |
|
| 134 | + !$runtimeType->hasField($fieldName) |
|
| 135 | 135 | ) { |
| 136 | 136 | // do not emit error |
| 137 | 137 | continue; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | foreach ($selectionSet->selections as $selection) { |
| 151 | 151 | /** @var FieldNode|FragmentSpreadNode|InlineFragmentNode $selection */ |
| 152 | 152 | |
| 153 | - if (! empty($selection->directives)) { |
|
| 153 | + if (!empty($selection->directives)) { |
|
| 154 | 154 | foreach ($selection->directives as $directiveNode) { |
| 155 | 155 | if ($directiveNode->name->value === Directive::SKIP_NAME) { |
| 156 | 156 | /** @var ValueNode|null $condition */ |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | $resultName = $selection->alias ? $selection->alias->value : $selection->name->value; |
| 203 | 203 | |
| 204 | - if (! isset($this->fields[$resultName])) { |
|
| 204 | + if (!isset($this->fields[$resultName])) { |
|
| 205 | 205 | $this->fields[$resultName] = []; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -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 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | if ($selection->typeCondition !== null) { |
| 256 | 256 | $conditionTypeName = $selection->typeCondition->name->value; |
| 257 | 257 | |
| 258 | - if (! $this->schema->hasType($conditionTypeName)) { |
|
| 258 | + if (!$this->schema->hasType($conditionTypeName)) { |
|
| 259 | 259 | $this->runtime->addError(new Error( |
| 260 | 260 | sprintf('Cannot spread inline fragment, type "%s" does not exist.', $conditionTypeName), |
| 261 | 261 | $selection |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | continue; |
| 271 | 271 | } |
| 272 | 272 | } elseif ($conditionType instanceof AbstractType) { |
| 273 | - if (! $this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
| 273 | + if (!$this->schema->isPossibleType($conditionType, $runtimeType)) { |
|
| 274 | 274 | continue; |
| 275 | 275 | } |
| 276 | 276 | } |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | Visitor::visitWithTypeInfo( |
| 129 | 129 | $typeInfo, |
| 130 | 130 | [ |
| 131 | - NodeKind::VARIABLE_DEFINITION => static function () { |
|
| 131 | + NodeKind::VARIABLE_DEFINITION => static function() { |
|
| 132 | 132 | return false; |
| 133 | 133 | }, |
| 134 | - NodeKind::VARIABLE => static function (VariableNode $variable) use ( |
|
| 134 | + NodeKind::VARIABLE => static function(VariableNode $variable) use ( |
|
| 135 | 135 | &$newUsages, |
| 136 | 136 | $typeInfo |
| 137 | 137 | ) { |
@@ -158,19 +158,19 @@ discard block |
||
| 158 | 158 | $fragments = []; |
| 159 | 159 | $collectedNames = []; |
| 160 | 160 | $nodesToVisit = [$operation]; |
| 161 | - while (! empty($nodesToVisit)) { |
|
| 161 | + while (!empty($nodesToVisit)) { |
|
| 162 | 162 | $node = array_pop($nodesToVisit); |
| 163 | 163 | $spreads = $this->getFragmentSpreads($node); |
| 164 | 164 | foreach ($spreads as $spread) { |
| 165 | 165 | $fragName = $spread->name->value; |
| 166 | 166 | |
| 167 | - if (! empty($collectedNames[$fragName])) { |
|
| 167 | + if (!empty($collectedNames[$fragName])) { |
|
| 168 | 168 | continue; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $collectedNames[$fragName] = true; |
| 172 | 172 | $fragment = $this->getFragment($fragName); |
| 173 | - if (! $fragment) { |
|
| 173 | + if (!$fragment) { |
|
| 174 | 174 | continue; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $spreads = []; |
| 195 | 195 | /** @var SelectionSetNode[] $setsToVisit */ |
| 196 | 196 | $setsToVisit = [$node->selectionSet]; |
| 197 | - while (! empty($setsToVisit)) { |
|
| 197 | + while (!empty($setsToVisit)) { |
|
| 198 | 198 | $set = array_pop($setsToVisit); |
| 199 | 199 | |
| 200 | 200 | for ($i = 0, $selectionCount = count($set->selections); $i < $selectionCount; $i++) { |
@@ -220,10 +220,10 @@ discard block |
||
| 220 | 220 | public function getFragment($name) |
| 221 | 221 | { |
| 222 | 222 | $fragments = $this->fragments; |
| 223 | - if (! $fragments) { |
|
| 223 | + if (!$fragments) { |
|
| 224 | 224 | $fragments = []; |
| 225 | 225 | foreach ($this->getDocument()->definitions as $statement) { |
| 226 | - if (! ($statement instanceof FragmentDefinitionNode)) { |
|
| 226 | + if (!($statement instanceof FragmentDefinitionNode)) { |
|
| 227 | 227 | continue; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $schemaDefinitionsCount = 0; |
| 30 | 30 | |
| 31 | 31 | return [ |
| 32 | - NodeKind::SCHEMA_DEFINITION => static function (SchemaDefinitionNode $node) use ($alreadyDefined, $context, &$schemaDefinitionsCount) { |
|
| 32 | + NodeKind::SCHEMA_DEFINITION => static function(SchemaDefinitionNode $node) use ($alreadyDefined, $context, &$schemaDefinitionsCount) { |
|
| 33 | 33 | if ($alreadyDefined !== false) { |
| 34 | 34 | $context->reportError(new Error('Cannot define a new schema within a schema extension.', $node)); |
| 35 | 35 | |
@@ -26,17 +26,17 @@ |
||
| 26 | 26 | $operationCount = 0; |
| 27 | 27 | |
| 28 | 28 | return [ |
| 29 | - NodeKind::DOCUMENT => static function (DocumentNode $node) use (&$operationCount) { |
|
| 29 | + NodeKind::DOCUMENT => static function(DocumentNode $node) use (&$operationCount) { |
|
| 30 | 30 | $tmp = Utils::filter( |
| 31 | 31 | $node->definitions, |
| 32 | - static function (Node $definition) { |
|
| 32 | + static function(Node $definition) { |
|
| 33 | 33 | return $definition instanceof OperationDefinitionNode; |
| 34 | 34 | } |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | $operationCount = count($tmp); |
| 38 | 38 | }, |
| 39 | - NodeKind::OPERATION_DEFINITION => static function (OperationDefinitionNode $node) use ( |
|
| 39 | + NodeKind::OPERATION_DEFINITION => static function(OperationDefinitionNode $node) use ( |
|
| 40 | 40 | &$operationCount, |
| 41 | 41 | $context |
| 42 | 42 | ) { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | return $this->invokeIfNeeded( |
| 58 | 58 | $context, |
| 59 | 59 | [ |
| 60 | - NodeKind::SELECTION_SET => function (SelectionSetNode $selectionSet) use ($context) { |
|
| 60 | + NodeKind::SELECTION_SET => function(SelectionSetNode $selectionSet) use ($context) { |
|
| 61 | 61 | $this->fieldNodeAndDefs = $this->collectFieldASTsAndDefs( |
| 62 | 62 | $context, |
| 63 | 63 | $context->getParentType(), |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | $this->fieldNodeAndDefs |
| 67 | 67 | ); |
| 68 | 68 | }, |
| 69 | - NodeKind::VARIABLE_DEFINITION => function ($def) { |
|
| 69 | + NodeKind::VARIABLE_DEFINITION => function($def) { |
|
| 70 | 70 | $this->variableDefs[] = $def; |
| 71 | 71 | |
| 72 | 72 | return Visitor::skipNode(); |
| 73 | 73 | }, |
| 74 | 74 | NodeKind::OPERATION_DEFINITION => [ |
| 75 | - 'leave' => function (OperationDefinitionNode $operationDefinition) use ($context, &$complexity) { |
|
| 75 | + 'leave' => function(OperationDefinitionNode $operationDefinition) use ($context, &$complexity) { |
|
| 76 | 76 | $errors = $context->getErrors(); |
| 77 | 77 | |
| 78 | - if (! empty($errors)) { |
|
| 78 | + if (!empty($errors)) { |
|
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | $this->variableDefs, |
| 189 | 189 | $this->getRawVariableValues() |
| 190 | 190 | ); |
| 191 | - if (! empty($errors)) { |
|
| 191 | + if (!empty($errors)) { |
|
| 192 | 192 | throw new Error(implode( |
| 193 | 193 | "\n\n", |
| 194 | 194 | array_map( |
| 195 | - static function ($error) { |
|
| 195 | + static function($error) { |
|
| 196 | 196 | return $error->getMessage(); |
| 197 | 197 | }, |
| 198 | 198 | $errors |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | /** @var bool $directiveArgsIf */ |
| 205 | 205 | $directiveArgsIf = Values::getArgumentValues($directive, $directiveNode, $variableValues)['if']; |
| 206 | 206 | |
| 207 | - return ! $directiveArgsIf; |
|
| 207 | + return !$directiveArgsIf; |
|
| 208 | 208 | } |
| 209 | 209 | $directive = Directive::skipDirective(); |
| 210 | 210 | $directiveArgsIf = Values::getArgumentValues($directive, $directiveNode, $variableValues); |
@@ -241,11 +241,11 @@ discard block |
||
| 241 | 241 | $rawVariableValues |
| 242 | 242 | ); |
| 243 | 243 | |
| 244 | - if (! empty($errors)) { |
|
| 244 | + if (!empty($errors)) { |
|
| 245 | 245 | throw new Error(implode( |
| 246 | 246 | "\n\n", |
| 247 | 247 | array_map( |
| 248 | - static function ($error) { |
|
| 248 | + static function($error) { |
|
| 249 | 249 | return $error->getMessage(); |
| 250 | 250 | }, |
| 251 | 251 | $errors |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | return [ |
| 54 | 54 | NodeKind::FIELD => [ |
| 55 | - 'enter' => static function (FieldNode $node) use (&$fieldName) { |
|
| 55 | + 'enter' => static function(FieldNode $node) use (&$fieldName) { |
|
| 56 | 56 | $fieldName = $node->name->value; |
| 57 | 57 | }, |
| 58 | 58 | ], |
| 59 | - NodeKind::NULL => static function (NullValueNode $node) use ($context, &$fieldName) { |
|
| 59 | + NodeKind::NULL => static function(NullValueNode $node) use ($context, &$fieldName) { |
|
| 60 | 60 | $type = $context->getInputType(); |
| 61 | - if (! ($type instanceof NonNull)) { |
|
| 61 | + if (!($type instanceof NonNull)) { |
|
| 62 | 62 | return; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -69,21 +69,21 @@ discard block |
||
| 69 | 69 | ) |
| 70 | 70 | ); |
| 71 | 71 | }, |
| 72 | - NodeKind::LST => function (ListValueNode $node) use ($context, &$fieldName) { |
|
| 72 | + NodeKind::LST => function(ListValueNode $node) use ($context, &$fieldName) { |
|
| 73 | 73 | // Note: TypeInfo will traverse into a list's item type, so look to the |
| 74 | 74 | // parent input type to check if it is a list. |
| 75 | 75 | $type = Type::getNullableType($context->getParentInputType()); |
| 76 | - if (! $type instanceof ListOfType) { |
|
| 76 | + if (!$type instanceof ListOfType) { |
|
| 77 | 77 | $this->isValidScalar($context, $node, $fieldName); |
| 78 | 78 | |
| 79 | 79 | return Visitor::skipNode(); |
| 80 | 80 | } |
| 81 | 81 | }, |
| 82 | - NodeKind::OBJECT => function (ObjectValueNode $node) use ($context, &$fieldName) { |
|
| 82 | + NodeKind::OBJECT => function(ObjectValueNode $node) use ($context, &$fieldName) { |
|
| 83 | 83 | // Note: TypeInfo will traverse into a list's item type, so look to the |
| 84 | 84 | // parent input type to check if it is a list. |
| 85 | 85 | $type = Type::getNamedType($context->getInputType()); |
| 86 | - if (! $type instanceof InputObjectType) { |
|
| 86 | + if (!$type instanceof InputObjectType) { |
|
| 87 | 87 | $this->isValidScalar($context, $node, $fieldName); |
| 88 | 88 | |
| 89 | 89 | return Visitor::skipNode(); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $nodeFields = iterator_to_array($node->fields); |
| 95 | 95 | $fieldNodeMap = array_combine( |
| 96 | 96 | array_map( |
| 97 | - static function ($field) { |
|
| 97 | + static function($field) { |
|
| 98 | 98 | return $field->name->value; |
| 99 | 99 | }, |
| 100 | 100 | $nodeFields |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | ); |
| 104 | 104 | foreach ($inputFields as $fieldName => $fieldDef) { |
| 105 | 105 | $fieldType = $fieldDef->getType(); |
| 106 | - if (isset($fieldNodeMap[$fieldName]) || ! ($fieldType instanceof NonNull)) { |
|
| 106 | + if (isset($fieldNodeMap[$fieldName]) || !($fieldType instanceof NonNull)) { |
|
| 107 | 107 | continue; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | ); |
| 116 | 116 | } |
| 117 | 117 | }, |
| 118 | - NodeKind::OBJECT_FIELD => static function (ObjectFieldNode $node) use ($context) { |
|
| 118 | + NodeKind::OBJECT_FIELD => static function(ObjectFieldNode $node) use ($context) { |
|
| 119 | 119 | $parentType = Type::getNamedType($context->getParentInputType()); |
| 120 | 120 | $fieldType = $context->getInputType(); |
| 121 | - if ($fieldType || ! ($parentType instanceof InputObjectType)) { |
|
| 121 | + if ($fieldType || !($parentType instanceof InputObjectType)) { |
|
| 122 | 122 | return; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $node->name->value, |
| 127 | 127 | array_keys($parentType->getFields()) |
| 128 | 128 | ); |
| 129 | - $didYouMean = $suggestions |
|
| 129 | + $didYouMean = $suggestions |
|
| 130 | 130 | ? 'Did you mean ' . Utils::orList($suggestions) . '?' |
| 131 | 131 | : null; |
| 132 | 132 | |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | ) |
| 138 | 138 | ); |
| 139 | 139 | }, |
| 140 | - NodeKind::ENUM => function (EnumValueNode $node) use ($context, &$fieldName) { |
|
| 140 | + NodeKind::ENUM => function(EnumValueNode $node) use ($context, &$fieldName) { |
|
| 141 | 141 | $type = Type::getNamedType($context->getInputType()); |
| 142 | - if (! $type instanceof EnumType) { |
|
| 142 | + if (!$type instanceof EnumType) { |
|
| 143 | 143 | $this->isValidScalar($context, $node, $fieldName); |
| 144 | - } elseif (! $type->getValue($node->value)) { |
|
| 144 | + } elseif (!$type->getValue($node->value)) { |
|
| 145 | 145 | $context->reportError( |
| 146 | 146 | new Error( |
| 147 | 147 | self::getBadValueMessage( |
@@ -156,16 +156,16 @@ discard block |
||
| 156 | 156 | ); |
| 157 | 157 | } |
| 158 | 158 | }, |
| 159 | - NodeKind::INT => function (IntValueNode $node) use ($context, &$fieldName) { |
|
| 159 | + NodeKind::INT => function(IntValueNode $node) use ($context, &$fieldName) { |
|
| 160 | 160 | $this->isValidScalar($context, $node, $fieldName); |
| 161 | 161 | }, |
| 162 | - NodeKind::FLOAT => function (FloatValueNode $node) use ($context, &$fieldName) { |
|
| 162 | + NodeKind::FLOAT => function(FloatValueNode $node) use ($context, &$fieldName) { |
|
| 163 | 163 | $this->isValidScalar($context, $node, $fieldName); |
| 164 | 164 | }, |
| 165 | - NodeKind::STRING => function (StringValueNode $node) use ($context, &$fieldName) { |
|
| 165 | + NodeKind::STRING => function(StringValueNode $node) use ($context, &$fieldName) { |
|
| 166 | 166 | $this->isValidScalar($context, $node, $fieldName); |
| 167 | 167 | }, |
| 168 | - NodeKind::BOOLEAN => function (BooleanValueNode $node) use ($context, &$fieldName) { |
|
| 168 | + NodeKind::BOOLEAN => function(BooleanValueNode $node) use ($context, &$fieldName) { |
|
| 169 | 169 | $this->isValidScalar($context, $node, $fieldName); |
| 170 | 170 | }, |
| 171 | 171 | ]; |
@@ -182,13 +182,13 @@ discard block |
||
| 182 | 182 | // Report any error at the full type expected by the location. |
| 183 | 183 | $locationType = $context->getInputType(); |
| 184 | 184 | |
| 185 | - if (! $locationType) { |
|
| 185 | + if (!$locationType) { |
|
| 186 | 186 | return; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $type = Type::getNamedType($locationType); |
| 190 | 190 | |
| 191 | - if (! $type instanceof ScalarType) { |
|
| 191 | + if (!$type instanceof ScalarType) { |
|
| 192 | 192 | $context->reportError( |
| 193 | 193 | new Error( |
| 194 | 194 | self::getBadValueMessage( |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $suggestions = Utils::suggestionList( |
| 247 | 247 | Printer::doPrint($node), |
| 248 | 248 | array_map( |
| 249 | - static function (EnumValueDefinition $value) { |
|
| 249 | + static function(EnumValueDefinition $value) { |
|
| 250 | 250 | return $value->name; |
| 251 | 251 | }, |
| 252 | 252 | $type->getValues() |