@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | * @param ResolverInterface $resolver |
11 | 11 | */ |
12 | 12 | public function register( |
13 | - string $typeName, |
|
14 | - ResolverInterface $resolver |
|
13 | + string $typeName, |
|
14 | + ResolverInterface $resolver |
|
15 | 15 | ): void; |
16 | 16 | |
17 | 17 | /** |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * @return callable|null |
22 | 22 | */ |
23 | 23 | public function getFieldResolver( |
24 | - string $typeName, |
|
25 | - string $fieldName |
|
24 | + string $typeName, |
|
25 | + string $fieldName |
|
26 | 26 | ): ?callable; |
27 | 27 | |
28 | 28 | /** |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @inheritdoc |
45 | 45 | */ |
46 | 46 | public function register( |
47 | - string $typeName, |
|
48 | - ResolverInterface $resolver |
|
47 | + string $typeName, |
|
48 | + ResolverInterface $resolver |
|
49 | 49 | ): void { |
50 | 50 | $this->resolverMap[$typeName] = $resolver; |
51 | 51 | } |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * @inheritdoc |
55 | 55 | */ |
56 | 56 | public function getFieldResolver( |
57 | - string $typeName, |
|
58 | - string $fieldName |
|
57 | + string $typeName, |
|
58 | + string $fieldName |
|
59 | 59 | ): ?callable |
60 | 60 | { |
61 | 61 | $resolver = $this->getResolver($typeName); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | throw new ResolutionException(\sprintf('Failed to resolve field "%s" for type "%s".', |
72 | - $fieldName, $typeName)); |
|
72 | + $fieldName, $typeName)); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -96,6 +96,6 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | throw new ResolutionException(\sprintf('Failed to resolve type for "%s".', |
99 | - $typeName)); |
|
99 | + $typeName)); |
|
100 | 100 | } |
101 | 101 | } |
@@ -87,24 +87,24 @@ discard block |
||
87 | 87 | * @throws InvalidArgumentException |
88 | 88 | */ |
89 | 89 | public function __construct( |
90 | - array $typeDefinitionsMap, |
|
90 | + array $typeDefinitionsMap, |
|
91 | 91 | ?ResolverRegistryInterface $resolverRegistry = null, |
92 | 92 | ?callable $resolveTypeFunction = null, |
93 | - CacheInterface $cache |
|
93 | + CacheInterface $cache |
|
94 | 94 | ) { |
95 | 95 | $this->typeDefinitionsMap = $typeDefinitionsMap; |
96 | 96 | $this->resolverRegistry = $resolverRegistry; |
97 | 97 | $this->resolveTypeFunction = $resolveTypeFunction ?? [ |
98 | 98 | $this, |
99 | 99 | 'defaultTypeResolver', |
100 | - ]; |
|
100 | + ]; |
|
101 | 101 | $this->cache = $cache; |
102 | 102 | |
103 | 103 | $builtInTypes = keyMap( |
104 | - \array_merge(specifiedScalarTypes(), introspectionTypes()), |
|
105 | - function (NamedTypeInterface $type) { |
|
106 | - return $type->getName(); |
|
107 | - } |
|
104 | + \array_merge(specifiedScalarTypes(), introspectionTypes()), |
|
105 | + function (NamedTypeInterface $type) { |
|
106 | + return $type->getName(); |
|
107 | + } |
|
108 | 108 | ); |
109 | 109 | |
110 | 110 | foreach ($builtInTypes as $name => $type) { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | throw new LanguageException(\sprintf('Type kind "%s" not supported.', |
188 | - $node->getKind())); |
|
188 | + $node->getKind())); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -196,22 +196,22 @@ discard block |
||
196 | 196 | protected function buildObjectType(ObjectTypeDefinitionNode $node |
197 | 197 | ): ObjectType { |
198 | 198 | return newObjectType([ |
199 | - 'name' => $node->getNameValue(), |
|
200 | - 'description' => $node->getDescriptionValue(), |
|
201 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
202 | - return $this->buildFields($node); |
|
203 | - } : [], |
|
199 | + 'name' => $node->getNameValue(), |
|
200 | + 'description' => $node->getDescriptionValue(), |
|
201 | + 'fields' => $node->hasFields() ? function () use ($node) { |
|
202 | + return $this->buildFields($node); |
|
203 | + } : [], |
|
204 | 204 | // Note: While this could make early assertions to get the correctly |
205 | 205 | // typed values, that would throw immediately while type system |
206 | 206 | // validation with validateSchema() will produce more actionable results. |
207 | - 'interfaces' => function () use ($node) { |
|
208 | - return $node->hasInterfaces() ? \array_map(function ( |
|
207 | + 'interfaces' => function () use ($node) { |
|
208 | + return $node->hasInterfaces() ? \array_map(function ( |
|
209 | 209 | NodeInterface $interface |
210 | - ) { |
|
211 | - return $this->buildType($interface); |
|
212 | - }, $node->getInterfaces()) : []; |
|
213 | - }, |
|
214 | - 'astNode' => $node, |
|
210 | + ) { |
|
211 | + return $this->buildType($interface); |
|
212 | + }, $node->getInterfaces()) : []; |
|
213 | + }, |
|
214 | + 'astNode' => $node, |
|
215 | 215 | ]); |
216 | 216 | } |
217 | 217 | |
@@ -223,17 +223,17 @@ discard block |
||
223 | 223 | protected function buildFields($node): array |
224 | 224 | { |
225 | 225 | return keyValueMap( |
226 | - $node->getFields(), |
|
227 | - function ($value) { |
|
228 | - /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
|
229 | - return $value->getNameValue(); |
|
230 | - }, |
|
231 | - function ($value) use ($node) { |
|
232 | - /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
|
233 | - return $this->buildField($value, |
|
226 | + $node->getFields(), |
|
227 | + function ($value) { |
|
228 | + /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
|
229 | + return $value->getNameValue(); |
|
230 | + }, |
|
231 | + function ($value) use ($node) { |
|
232 | + /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
|
233 | + return $this->buildField($value, |
|
234 | 234 | $this->getFieldResolver($node->getNameValue(), |
235 | - $value->getNameValue())); |
|
236 | - } |
|
235 | + $value->getNameValue())); |
|
236 | + } |
|
237 | 237 | ); |
238 | 238 | } |
239 | 239 | |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | public function buildField($node, ?callable $resolve = null): array |
244 | 244 | { |
245 | 245 | return [ |
246 | - 'type' => $this->buildWrappedType($node->getType()), |
|
247 | - 'description' => $node->getDescriptionValue(), |
|
248 | - 'args' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
|
249 | - 'deprecationReason' => $this->getDeprecationReason($node), |
|
250 | - 'resolve' => $resolve, |
|
251 | - 'astNode' => $node, |
|
246 | + 'type' => $this->buildWrappedType($node->getType()), |
|
247 | + 'description' => $node->getDescriptionValue(), |
|
248 | + 'args' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
|
249 | + 'deprecationReason' => $this->getDeprecationReason($node), |
|
250 | + 'resolve' => $resolve, |
|
251 | + 'astNode' => $node, |
|
252 | 252 | ]; |
253 | 253 | } |
254 | 254 | |
@@ -290,22 +290,22 @@ discard block |
||
290 | 290 | protected function buildArguments(array $nodes): array |
291 | 291 | { |
292 | 292 | return keyValueMap( |
293 | - $nodes, |
|
294 | - function (InputValueDefinitionNode $value) { |
|
295 | - return $value->getNameValue(); |
|
296 | - }, |
|
297 | - function (InputValueDefinitionNode $value): array { |
|
298 | - $type = $this->buildWrappedType($value->getType()); |
|
299 | - $defaultValue = $value->getDefaultValue(); |
|
300 | - return [ |
|
293 | + $nodes, |
|
294 | + function (InputValueDefinitionNode $value) { |
|
295 | + return $value->getNameValue(); |
|
296 | + }, |
|
297 | + function (InputValueDefinitionNode $value): array { |
|
298 | + $type = $this->buildWrappedType($value->getType()); |
|
299 | + $defaultValue = $value->getDefaultValue(); |
|
300 | + return [ |
|
301 | 301 | 'type' => $type, |
302 | 302 | 'description' => $value->getDescriptionValue(), |
303 | 303 | 'defaultValue' => null !== $defaultValue |
304 | 304 | ? valueFromAST($defaultValue, $type) |
305 | 305 | : null, |
306 | 306 | 'astNode' => $value, |
307 | - ]; |
|
308 | - }); |
|
307 | + ]; |
|
308 | + }); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | * @return callable|null |
330 | 330 | */ |
331 | 331 | protected function getFieldResolver( |
332 | - string $typeName, |
|
333 | - string $fieldName |
|
332 | + string $typeName, |
|
333 | + string $fieldName |
|
334 | 334 | ): ?callable |
335 | 335 | { |
336 | 336 | return null !== $this->resolverRegistry |
@@ -346,13 +346,13 @@ discard block |
||
346 | 346 | protected function buildInterfaceType(InterfaceTypeDefinitionNode $node |
347 | 347 | ): InterfaceType { |
348 | 348 | return newInterfaceType([ |
349 | - 'name' => $node->getNameValue(), |
|
350 | - 'description' => $node->getDescriptionValue(), |
|
351 | - 'fields' => $node->hasFields() ? function () use ($node): array { |
|
352 | - return $this->buildFields($node); |
|
353 | - } : [], |
|
354 | - 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
|
355 | - 'astNode' => $node, |
|
349 | + 'name' => $node->getNameValue(), |
|
350 | + 'description' => $node->getDescriptionValue(), |
|
351 | + 'fields' => $node->hasFields() ? function () use ($node): array { |
|
352 | + return $this->buildFields($node); |
|
353 | + } : [], |
|
354 | + 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
|
355 | + 'astNode' => $node, |
|
356 | 356 | ]); |
357 | 357 | } |
358 | 358 | |
@@ -376,22 +376,22 @@ discard block |
||
376 | 376 | protected function buildEnumType(EnumTypeDefinitionNode $node): EnumType |
377 | 377 | { |
378 | 378 | return newEnumType([ |
379 | - 'name' => $node->getNameValue(), |
|
380 | - 'description' => $node->getDescriptionValue(), |
|
381 | - 'values' => $node->hasValues() ? keyValueMap( |
|
379 | + 'name' => $node->getNameValue(), |
|
380 | + 'description' => $node->getDescriptionValue(), |
|
381 | + 'values' => $node->hasValues() ? keyValueMap( |
|
382 | 382 | $node->getValues(), |
383 | 383 | function (EnumValueDefinitionNode $value): string { |
384 | 384 | return $value->getNameValue(); |
385 | 385 | }, |
386 | 386 | function (EnumValueDefinitionNode $value): array { |
387 | 387 | return [ |
388 | - 'description' => $value->getDescriptionValue(), |
|
389 | - 'deprecationReason' => $this->getDeprecationReason($value), |
|
390 | - 'astNode' => $value, |
|
388 | + 'description' => $value->getDescriptionValue(), |
|
389 | + 'deprecationReason' => $this->getDeprecationReason($value), |
|
390 | + 'astNode' => $value, |
|
391 | 391 | ]; |
392 | 392 | } |
393 | - ) : [], |
|
394 | - 'astNode' => $node, |
|
393 | + ) : [], |
|
394 | + 'astNode' => $node, |
|
395 | 395 | ]); |
396 | 396 | } |
397 | 397 | |
@@ -403,15 +403,15 @@ discard block |
||
403 | 403 | protected function buildUnionType(UnionTypeDefinitionNode $node): UnionType |
404 | 404 | { |
405 | 405 | return newUnionType([ |
406 | - 'name' => $node->getNameValue(), |
|
407 | - 'description' => $node->getDescriptionValue(), |
|
408 | - 'types' => $node->hasTypes() ? \array_map(function ( |
|
406 | + 'name' => $node->getNameValue(), |
|
407 | + 'description' => $node->getDescriptionValue(), |
|
408 | + 'types' => $node->hasTypes() ? \array_map(function ( |
|
409 | 409 | TypeNodeInterface $type |
410 | - ) { |
|
411 | - return $this->buildType($type); |
|
412 | - }, $node->getTypes()) : [], |
|
413 | - 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
|
414 | - 'astNode' => $node, |
|
410 | + ) { |
|
411 | + return $this->buildType($type); |
|
412 | + }, $node->getTypes()) : [], |
|
413 | + 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
|
414 | + 'astNode' => $node, |
|
415 | 415 | ]); |
416 | 416 | } |
417 | 417 | |
@@ -423,12 +423,12 @@ discard block |
||
423 | 423 | protected function buildScalarType(ScalarTypeDefinitionNode $node |
424 | 424 | ): ScalarType { |
425 | 425 | return newScalarType([ |
426 | - 'name' => $node->getNameValue(), |
|
427 | - 'description' => $node->getDescriptionValue(), |
|
428 | - 'serialize' => function ($value) { |
|
429 | - return $value; |
|
430 | - }, |
|
431 | - 'astNode' => $node, |
|
426 | + 'name' => $node->getNameValue(), |
|
427 | + 'description' => $node->getDescriptionValue(), |
|
428 | + 'serialize' => function ($value) { |
|
429 | + return $value; |
|
430 | + }, |
|
431 | + 'astNode' => $node, |
|
432 | 432 | ]); |
433 | 433 | } |
434 | 434 | |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | protected function buildInputObjectType(InputObjectTypeDefinitionNode $node |
441 | 441 | ): InputObjectType { |
442 | 442 | return newInputObjectType([ |
443 | - 'name' => $node->getNameValue(), |
|
444 | - 'description' => $node->getDescriptionValue(), |
|
445 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
446 | - return keyValueMap( |
|
443 | + 'name' => $node->getNameValue(), |
|
444 | + 'description' => $node->getDescriptionValue(), |
|
445 | + 'fields' => $node->hasFields() ? function () use ($node) { |
|
446 | + return keyValueMap( |
|
447 | 447 | $node->getFields(), |
448 | 448 | function (InputValueDefinitionNode $value): string { |
449 | 449 | return $value->getNameValue(); |
@@ -452,17 +452,17 @@ discard block |
||
452 | 452 | $type = $this->buildWrappedType($value->getType()); |
453 | 453 | $defaultValue = $value->getDefaultValue(); |
454 | 454 | return [ |
455 | - 'type' => $type, |
|
456 | - 'description' => $value->getDescriptionValue(), |
|
457 | - 'defaultValue' => null !== $defaultValue |
|
455 | + 'type' => $type, |
|
456 | + 'description' => $value->getDescriptionValue(), |
|
457 | + 'defaultValue' => null !== $defaultValue |
|
458 | 458 | ? valueFromAST($defaultValue, $type) |
459 | 459 | : null, |
460 | - 'astNode' => $value, |
|
460 | + 'astNode' => $value, |
|
461 | 461 | ]; |
462 | 462 | } |
463 | - ); |
|
464 | - } : [], |
|
465 | - 'astNode' => $node, |
|
463 | + ); |
|
464 | + } : [], |
|
465 | + 'astNode' => $node, |
|
466 | 466 | ]); |
467 | 467 | } |
468 | 468 | |
@@ -480,13 +480,13 @@ discard block |
||
480 | 480 | public function buildDirective(DirectiveDefinitionNode $node |
481 | 481 | ): DirectiveInterface { |
482 | 482 | return newDirective([ |
483 | - 'name' => $node->getNameValue(), |
|
484 | - 'description' => $node->getDescriptionValue(), |
|
485 | - 'locations' => \array_map(function (NameNode $node) { |
|
486 | - return $node->getValue(); |
|
487 | - }, $node->getLocations()), |
|
488 | - 'args' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
|
489 | - 'astNode' => $node, |
|
483 | + 'name' => $node->getNameValue(), |
|
484 | + 'description' => $node->getDescriptionValue(), |
|
485 | + 'locations' => \array_map(function (NameNode $node) { |
|
486 | + return $node->getValue(); |
|
487 | + }, $node->getLocations()), |
|
488 | + 'args' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
|
489 | + 'astNode' => $node, |
|
490 | 490 | ]); |
491 | 491 | } |
492 | 492 | |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | * @throws InvalidTypeException |
521 | 521 | */ |
522 | 522 | function buildWrappedType( |
523 | - TypeInterface $innerType, |
|
524 | - TypeNodeInterface $inputTypeNode |
|
523 | + TypeInterface $innerType, |
|
524 | + TypeNodeInterface $inputTypeNode |
|
525 | 525 | ): TypeInterface { |
526 | 526 | if ($inputTypeNode instanceof ListTypeNode) { |
527 | 527 | return newList(buildWrappedType($innerType, $inputTypeNode->getType())); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | $builtInTypes = keyMap( |
104 | 104 | \array_merge(specifiedScalarTypes(), introspectionTypes()), |
105 | - function (NamedTypeInterface $type) { |
|
105 | + function(NamedTypeInterface $type) { |
|
106 | 106 | return $type->getName(); |
107 | 107 | } |
108 | 108 | ); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function buildTypes(array $nodes): array |
119 | 119 | { |
120 | - return \array_map(function (NodeInterface $node) { |
|
120 | + return \array_map(function(NodeInterface $node) { |
|
121 | 121 | return $this->buildType($node); |
122 | 122 | }, $nodes); |
123 | 123 | } |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | return newObjectType([ |
199 | 199 | 'name' => $node->getNameValue(), |
200 | 200 | 'description' => $node->getDescriptionValue(), |
201 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
201 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
202 | 202 | return $this->buildFields($node); |
203 | 203 | } : [], |
204 | 204 | // Note: While this could make early assertions to get the correctly |
205 | 205 | // typed values, that would throw immediately while type system |
206 | 206 | // validation with validateSchema() will produce more actionable results. |
207 | - 'interfaces' => function () use ($node) { |
|
208 | - return $node->hasInterfaces() ? \array_map(function ( |
|
207 | + 'interfaces' => function() use ($node) { |
|
208 | + return $node->hasInterfaces() ? \array_map(function( |
|
209 | 209 | NodeInterface $interface |
210 | 210 | ) { |
211 | 211 | return $this->buildType($interface); |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | { |
225 | 225 | return keyValueMap( |
226 | 226 | $node->getFields(), |
227 | - function ($value) { |
|
227 | + function($value) { |
|
228 | 228 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
229 | 229 | return $value->getNameValue(); |
230 | 230 | }, |
231 | - function ($value) use ($node) { |
|
231 | + function($value) use ($node) { |
|
232 | 232 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
233 | 233 | return $this->buildField($value, |
234 | 234 | $this->getFieldResolver($node->getNameValue(), |
@@ -291,10 +291,10 @@ discard block |
||
291 | 291 | { |
292 | 292 | return keyValueMap( |
293 | 293 | $nodes, |
294 | - function (InputValueDefinitionNode $value) { |
|
294 | + function(InputValueDefinitionNode $value) { |
|
295 | 295 | return $value->getNameValue(); |
296 | 296 | }, |
297 | - function (InputValueDefinitionNode $value): array { |
|
297 | + function(InputValueDefinitionNode $value): array { |
|
298 | 298 | $type = $this->buildWrappedType($value->getType()); |
299 | 299 | $defaultValue = $value->getDefaultValue(); |
300 | 300 | return [ |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | return newInterfaceType([ |
349 | 349 | 'name' => $node->getNameValue(), |
350 | 350 | 'description' => $node->getDescriptionValue(), |
351 | - 'fields' => $node->hasFields() ? function () use ($node): array { |
|
351 | + 'fields' => $node->hasFields() ? function() use ($node) : array { |
|
352 | 352 | return $this->buildFields($node); |
353 | 353 | } : [], |
354 | 354 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -380,10 +380,10 @@ discard block |
||
380 | 380 | 'description' => $node->getDescriptionValue(), |
381 | 381 | 'values' => $node->hasValues() ? keyValueMap( |
382 | 382 | $node->getValues(), |
383 | - function (EnumValueDefinitionNode $value): string { |
|
383 | + function(EnumValueDefinitionNode $value): string { |
|
384 | 384 | return $value->getNameValue(); |
385 | 385 | }, |
386 | - function (EnumValueDefinitionNode $value): array { |
|
386 | + function(EnumValueDefinitionNode $value): array { |
|
387 | 387 | return [ |
388 | 388 | 'description' => $value->getDescriptionValue(), |
389 | 389 | 'deprecationReason' => $this->getDeprecationReason($value), |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | return newUnionType([ |
406 | 406 | 'name' => $node->getNameValue(), |
407 | 407 | 'description' => $node->getDescriptionValue(), |
408 | - 'types' => $node->hasTypes() ? \array_map(function ( |
|
408 | + 'types' => $node->hasTypes() ? \array_map(function( |
|
409 | 409 | TypeNodeInterface $type |
410 | 410 | ) { |
411 | 411 | return $this->buildType($type); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | return newScalarType([ |
426 | 426 | 'name' => $node->getNameValue(), |
427 | 427 | 'description' => $node->getDescriptionValue(), |
428 | - 'serialize' => function ($value) { |
|
428 | + 'serialize' => function($value) { |
|
429 | 429 | return $value; |
430 | 430 | }, |
431 | 431 | 'astNode' => $node, |
@@ -442,13 +442,13 @@ discard block |
||
442 | 442 | return newInputObjectType([ |
443 | 443 | 'name' => $node->getNameValue(), |
444 | 444 | 'description' => $node->getDescriptionValue(), |
445 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
445 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
446 | 446 | return keyValueMap( |
447 | 447 | $node->getFields(), |
448 | - function (InputValueDefinitionNode $value): string { |
|
448 | + function(InputValueDefinitionNode $value): string { |
|
449 | 449 | return $value->getNameValue(); |
450 | 450 | }, |
451 | - function (InputValueDefinitionNode $value): array { |
|
451 | + function(InputValueDefinitionNode $value): array { |
|
452 | 452 | $type = $this->buildWrappedType($value->getType()); |
453 | 453 | $defaultValue = $value->getDefaultValue(); |
454 | 454 | return [ |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | return newDirective([ |
483 | 483 | 'name' => $node->getNameValue(), |
484 | 484 | 'description' => $node->getDescriptionValue(), |
485 | - 'locations' => \array_map(function (NameNode $node) { |
|
485 | + 'locations' => \array_map(function(NameNode $node) { |
|
486 | 486 | return $node->getValue(); |
487 | 487 | }, $node->getLocations()), |
488 | 488 | 'args' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
@@ -69,8 +69,8 @@ |
||
69 | 69 | public function toArray(): array |
70 | 70 | { |
71 | 71 | return [ |
72 | - 'start' => $this->start, |
|
73 | - 'end' => $this->end, |
|
72 | + 'start' => $this->start, |
|
73 | + 'end' => $this->end, |
|
74 | 74 | ]; |
75 | 75 | } |
76 | 76 |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | |
118 | 118 | if ($pos >= $bodyLength) { |
119 | 119 | return new Token(TokenKindEnum::EOF, $bodyLength, $bodyLength, |
120 | - $line, $col, $prev); |
|
120 | + $line, $col, $prev); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $code = charCodeAt($body, $pos); |
124 | 124 | |
125 | 125 | if (isSourceCharacter($code)) { |
126 | 126 | throw new SyntaxErrorException( |
127 | - $this->source, |
|
128 | - $pos, |
|
129 | - sprintf('Cannot contain the invalid character %s', |
|
127 | + $this->source, |
|
128 | + $pos, |
|
129 | + sprintf('Cannot contain the invalid character %s', |
|
130 | 130 | printCharCode($code)) |
131 | 131 | ); |
132 | 132 | } |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | * @return int |
142 | 142 | */ |
143 | 143 | protected function positionAfterWhitespace( |
144 | - string $body, |
|
145 | - int $startPosition |
|
144 | + string $body, |
|
145 | + int $startPosition |
|
146 | 146 | ): int { |
147 | 147 | $bodyLength = mb_strlen($body); |
148 | 148 | $pos = $startPosition; |
@@ -193,18 +193,18 @@ discard block |
||
193 | 193 | * @throws SyntaxErrorException |
194 | 194 | */ |
195 | 195 | public function read( |
196 | - int $code, |
|
197 | - int $pos, |
|
198 | - int $line, |
|
199 | - int $col, |
|
200 | - Token $prev |
|
196 | + int $code, |
|
197 | + int $pos, |
|
198 | + int $line, |
|
199 | + int $col, |
|
200 | + Token $prev |
|
201 | 201 | ): Token { |
202 | 202 | if (($reader = $this->getReader($code, $pos)) !== null) { |
203 | 203 | return $reader->read($code, $pos, $line, $col, $prev); |
204 | 204 | } |
205 | 205 | |
206 | 206 | throw new SyntaxErrorException($this->source, $pos, |
207 | - $this->unexpectedCharacterMessage($code)); |
|
207 | + $this->unexpectedCharacterMessage($code)); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | return sprintf('Cannot parse the unexpected character %s', |
241 | - printCharCode($code)); |
|
241 | + printCharCode($code)); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -21,10 +21,10 @@ |
||
21 | 21 | $selectionSet = $this->printNode($node->getSelectionSet()); |
22 | 22 | |
23 | 23 | return implode(' ', [ |
24 | - '...', |
|
25 | - wrap('on ', $typeCondition), |
|
26 | - implode(' ', $directives), |
|
27 | - $selectionSet, |
|
24 | + '...', |
|
25 | + wrap('on ', $typeCondition), |
|
26 | + implode(' ', $directives), |
|
27 | + $selectionSet, |
|
28 | 28 | ]); |
29 | 29 | } |
30 | 30 |
@@ -14,30 +14,30 @@ |
||
14 | 14 | * @var array |
15 | 15 | */ |
16 | 16 | private static $supportedWriters = [ |
17 | - ArgumentWriter::class, |
|
18 | - BooleanValueWriter::class, |
|
19 | - DirectiveWriter::class, |
|
20 | - DocumentWriter::class, |
|
21 | - EnumValueWriter::class, |
|
22 | - FieldWriter::class, |
|
23 | - FloatValueWriter::class, |
|
24 | - FragmentDefinitionWriter::class, |
|
25 | - FragmentSpreadWriter::class, |
|
26 | - InlineFragmentWriter::class, |
|
27 | - IntValueWriter::class, |
|
28 | - ListTypeWriter::class, |
|
29 | - ListValueWriter::class, |
|
30 | - NamedTypeWriter::class, |
|
31 | - NameWriter::class, |
|
32 | - NullTypeWriter::class, |
|
33 | - NullValueWriter::class, |
|
34 | - ObjectFieldWriter::class, |
|
35 | - ObjectValueWriter::class, |
|
36 | - OperationDefinitionWriter::class, |
|
37 | - SelectionSetWriter::class, |
|
38 | - StringValueWriter::class, |
|
39 | - VariableDefinitionWriter::class, |
|
40 | - VariableWriter::class, |
|
17 | + ArgumentWriter::class, |
|
18 | + BooleanValueWriter::class, |
|
19 | + DirectiveWriter::class, |
|
20 | + DocumentWriter::class, |
|
21 | + EnumValueWriter::class, |
|
22 | + FieldWriter::class, |
|
23 | + FloatValueWriter::class, |
|
24 | + FragmentDefinitionWriter::class, |
|
25 | + FragmentSpreadWriter::class, |
|
26 | + InlineFragmentWriter::class, |
|
27 | + IntValueWriter::class, |
|
28 | + ListTypeWriter::class, |
|
29 | + ListValueWriter::class, |
|
30 | + NamedTypeWriter::class, |
|
31 | + NameWriter::class, |
|
32 | + NullTypeWriter::class, |
|
33 | + NullValueWriter::class, |
|
34 | + ObjectFieldWriter::class, |
|
35 | + ObjectValueWriter::class, |
|
36 | + OperationDefinitionWriter::class, |
|
37 | + SelectionSetWriter::class, |
|
38 | + StringValueWriter::class, |
|
39 | + VariableDefinitionWriter::class, |
|
40 | + VariableWriter::class, |
|
41 | 41 | // TODO: Add support for printing Type System Definitions (SDL). |
42 | 42 | ]; |
43 | 43 |
@@ -23,10 +23,10 @@ |
||
23 | 23 | $selectionSet = $this->printNode($node->getSelectionSet()); |
24 | 24 | |
25 | 25 | return implode(' ', [ |
26 | - wrap('', $alias, ': ') . $name . wrap('(', implode(', ', $arguments), |
|
26 | + wrap('', $alias, ': ') . $name . wrap('(', implode(', ', $arguments), |
|
27 | 27 | ')'), |
28 | - implode(' ', $directives), |
|
29 | - $selectionSet, |
|
28 | + implode(' ', $directives), |
|
29 | + $selectionSet, |
|
30 | 30 | ]); |
31 | 31 | } |
32 | 32 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $name . wrap('(', implode(', ', $variablesDefinitions), ')'), |
32 | 32 | implode(' ', $directives), |
33 | 33 | $selectionSet, |
34 | - ]); |
|
34 | + ]); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |