@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $isEdited = $isLeaving && count($edits) !== 0; |
202 | 202 | |
203 | 203 | if ($isLeaving) { |
204 | - $key = ! $ancestors ? $UNDEFINED : $path[count($path) - 1]; |
|
204 | + $key = !$ancestors ? $UNDEFINED : $path[count($path) - 1]; |
|
205 | 205 | $node = $parent; |
206 | 206 | $parent = array_pop($ancestors); |
207 | 207 | |
@@ -255,8 +255,8 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | $result = null; |
258 | - if (! $node instanceof NodeList && ! is_array($node)) { |
|
259 | - if (! ($node instanceof Node)) { |
|
258 | + if (!$node instanceof NodeList && !is_array($node)) { |
|
259 | + if (!($node instanceof Node)) { |
|
260 | 260 | throw new \Exception('Invalid AST Node: ' . json_encode($node)); |
261 | 261 | } |
262 | 262 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | if ($result->doBreak) { |
271 | 271 | break; |
272 | 272 | } |
273 | - if (! $isLeaving && $result->doContinue) { |
|
273 | + if (!$isLeaving && $result->doContinue) { |
|
274 | 274 | array_pop($path); |
275 | 275 | continue; |
276 | 276 | } |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | } |
283 | 283 | |
284 | 284 | $edits[] = [$key, $editValue]; |
285 | - if (! $isLeaving) { |
|
286 | - if (! ($editValue instanceof Node)) { |
|
285 | + if (!$isLeaving) { |
|
286 | + if (!($editValue instanceof Node)) { |
|
287 | 287 | array_pop($path); |
288 | 288 | continue; |
289 | 289 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | if ($isLeaving) { |
302 | 302 | array_pop($path); |
303 | 303 | } else { |
304 | - $stack = [ |
|
304 | + $stack = [ |
|
305 | 305 | 'inArray' => $inArray, |
306 | 306 | 'index' => $index, |
307 | 307 | 'keys' => $keys, |
@@ -379,9 +379,9 @@ discard block |
||
379 | 379 | $skipping = new \SplFixedArray($visitorsCount); |
380 | 380 | |
381 | 381 | return [ |
382 | - 'enter' => function (Node $node) use ($visitors, $skipping, $visitorsCount) { |
|
382 | + 'enter' => function(Node $node) use ($visitors, $skipping, $visitorsCount) { |
|
383 | 383 | for ($i = 0; $i < $visitorsCount; $i++) { |
384 | - if (! empty($skipping[$i])) { |
|
384 | + if (!empty($skipping[$i])) { |
|
385 | 385 | continue; |
386 | 386 | } |
387 | 387 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | false |
392 | 392 | ); |
393 | 393 | |
394 | - if (! $fn) { |
|
394 | + if (!$fn) { |
|
395 | 395 | continue; |
396 | 396 | } |
397 | 397 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | } |
411 | 411 | } |
412 | 412 | }, |
413 | - 'leave' => function (Node $node) use ($visitors, $skipping, $visitorsCount) { |
|
413 | + 'leave' => function(Node $node) use ($visitors, $skipping, $visitorsCount) { |
|
414 | 414 | for ($i = 0; $i < $visitorsCount; $i++) { |
415 | 415 | if (empty($skipping[$i])) { |
416 | 416 | $fn = self::getVisitFn( |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | public static function visitWithTypeInfo(TypeInfo $typeInfo, $visitor) |
447 | 447 | { |
448 | 448 | return [ |
449 | - 'enter' => function (Node $node) use ($typeInfo, $visitor) { |
|
449 | + 'enter' => function(Node $node) use ($typeInfo, $visitor) { |
|
450 | 450 | $typeInfo->enter($node); |
451 | 451 | $fn = self::getVisitFn($visitor, $node->kind, false); |
452 | 452 | |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | |
465 | 465 | return null; |
466 | 466 | }, |
467 | - 'leave' => function (Node $node) use ($typeInfo, $visitor) { |
|
467 | + 'leave' => function(Node $node) use ($typeInfo, $visitor) { |
|
468 | 468 | $fn = self::getVisitFn($visitor, $node->kind, true); |
469 | 469 | $result = $fn ? call_user_func_array($fn, func_get_args()) : null; |
470 | 470 | $typeInfo->leave($node); |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | |
489 | 489 | $kindVisitor = $visitor[$kind] ?? null; |
490 | 490 | |
491 | - if (! $isLeaving && is_callable($kindVisitor)) { |
|
491 | + if (!$isLeaving && is_callable($kindVisitor)) { |
|
492 | 492 | // { Kind() {} } |
493 | 493 | return $kindVisitor; |
494 | 494 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function getVisitor(ValidationContext $context) |
27 | 27 | { |
28 | 28 | return [ |
29 | - NodeKind::ARGUMENT => function (ArgumentNode $node, $key, $parent, $path, $ancestors) use ($context) { |
|
29 | + NodeKind::ARGUMENT => function(ArgumentNode $node, $key, $parent, $path, $ancestors) use ($context) { |
|
30 | 30 | /** @var NodeList|Node[] $ancestors */ |
31 | 31 | $argDef = $context->getArgument(); |
32 | 32 | if ($argDef !== null) { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | Utils::suggestionList( |
47 | 47 | $node->name->value, |
48 | 48 | array_map( |
49 | - function ($arg) { |
|
49 | + function($arg) { |
|
50 | 50 | return $arg->name; |
51 | 51 | }, |
52 | 52 | $fieldDef->args |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | Utils::suggestionList( |
67 | 67 | $node->name->value, |
68 | 68 | array_map( |
69 | - function ($arg) { |
|
69 | + function($arg) { |
|
70 | 70 | return $arg->name; |
71 | 71 | }, |
72 | 72 | $directive->args |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public static function unknownArgMessage($argName, $fieldName, $typeName, array $suggestedArgs) |
88 | 88 | { |
89 | 89 | $message = sprintf('Unknown argument "%s" on field "%s" of type "%s".', $argName, $fieldName, $typeName); |
90 | - if (! empty($suggestedArgs)) { |
|
90 | + if (!empty($suggestedArgs)) { |
|
91 | 91 | $message .= sprintf(' Did you mean %s?', Utils::quotedOrList($suggestedArgs)); |
92 | 92 | } |
93 | 93 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | public static function unknownDirectiveArgMessage($argName, $directiveName, array $suggestedArgs) |
101 | 101 | { |
102 | 102 | $message = sprintf('Unknown argument "%s" on directive "@%s".', $argName, $directiveName); |
103 | - if (! empty($suggestedArgs)) { |
|
103 | + if (!empty($suggestedArgs)) { |
|
104 | 104 | $message .= sprintf(' Did you mean %s?', Utils::quotedOrList($suggestedArgs)); |
105 | 105 | } |
106 | 106 |
@@ -26,17 +26,17 @@ |
||
26 | 26 | $operationCount = 0; |
27 | 27 | |
28 | 28 | return [ |
29 | - NodeKind::DOCUMENT => function (DocumentNode $node) use (&$operationCount) { |
|
29 | + NodeKind::DOCUMENT => function(DocumentNode $node) use (&$operationCount) { |
|
30 | 30 | $tmp = Utils::filter( |
31 | 31 | $node->definitions, |
32 | - function (Node $definition) { |
|
32 | + function(Node $definition) { |
|
33 | 33 | return $definition->kind === NodeKind::OPERATION_DEFINITION; |
34 | 34 | } |
35 | 35 | ); |
36 | 36 | |
37 | 37 | $operationCount = count($tmp); |
38 | 38 | }, |
39 | - NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) use ( |
|
39 | + NodeKind::OPERATION_DEFINITION => function(OperationDefinitionNode $node) use ( |
|
40 | 40 | &$operationCount, |
41 | 41 | $context |
42 | 42 | ) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function fromArray(array $node) : Node |
86 | 86 | { |
87 | - if (! isset($node['kind']) || ! isset(NodeKind::$classMap[$node['kind']])) { |
|
87 | + if (!isset($node['kind']) || !isset(NodeKind::$classMap[$node['kind']])) { |
|
88 | 88 | throw new InvariantViolation('Unexpected node structure: ' . Utils::printSafeJson($node)); |
89 | 89 | } |
90 | 90 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $valuesNodes = []; |
170 | 170 | foreach ($value as $item) { |
171 | 171 | $itemNode = self::astFromValue($item, $itemType); |
172 | - if (! $itemNode) { |
|
172 | + if (!$itemNode) { |
|
173 | 173 | continue; |
174 | 174 | } |
175 | 175 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | if ($type instanceof InputObjectType) { |
188 | 188 | $isArray = is_array($value); |
189 | 189 | $isArrayLike = $isArray || $value instanceof \ArrayAccess; |
190 | - if ($value === null || (! $isArrayLike && ! is_object($value))) { |
|
190 | + if ($value === null || (!$isArrayLike && !is_object($value))) { |
|
191 | 191 | return null; |
192 | 192 | } |
193 | 193 | $fields = $type->getFields(); |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | $fieldExists = property_exists($value, $fieldName); |
213 | 213 | } |
214 | 214 | |
215 | - if (! $fieldExists) { |
|
215 | + if (!$fieldExists) { |
|
216 | 216 | continue; |
217 | 217 | } |
218 | 218 | |
219 | 219 | $fieldNode = self::astFromValue($fieldValue, $field->getType()); |
220 | 220 | |
221 | - if (! $fieldNode) { |
|
221 | + if (!$fieldNode) { |
|
222 | 222 | continue; |
223 | 223 | } |
224 | 224 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | if ($valueNode instanceof VariableNode) { |
342 | 342 | $variableName = $valueNode->name->value; |
343 | 343 | |
344 | - if (! $variables || ! array_key_exists($variableName, $variables)) { |
|
344 | + if (!$variables || !array_key_exists($variableName, $variables)) { |
|
345 | 345 | // No valid return value. |
346 | 346 | return $undefined; |
347 | 347 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | } |
389 | 389 | |
390 | 390 | if ($type instanceof InputObjectType) { |
391 | - if (! $valueNode instanceof ObjectValueNode) { |
|
391 | + if (!$valueNode instanceof ObjectValueNode) { |
|
392 | 392 | // Invalid: intentionally return no value. |
393 | 393 | return $undefined; |
394 | 394 | } |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $fields = $type->getFields(); |
398 | 398 | $fieldNodes = Utils::keyMap( |
399 | 399 | $valueNode->fields, |
400 | - function ($field) { |
|
400 | + function($field) { |
|
401 | 401 | return $field->name->value; |
402 | 402 | } |
403 | 403 | ); |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $fieldName = $field->name; |
407 | 407 | $fieldNode = $fieldNodes[$fieldName] ?? null; |
408 | 408 | |
409 | - if (! $fieldNode || self::isMissingVariable($fieldNode->value, $variables)) { |
|
409 | + if (!$fieldNode || self::isMissingVariable($fieldNode->value, $variables)) { |
|
410 | 410 | if ($field->defaultValueExists()) { |
411 | 411 | $coercedObj[$fieldName] = $field->defaultValue; |
412 | 412 | } elseif ($field->getType() instanceof NonNull) { |
@@ -429,11 +429,11 @@ discard block |
||
429 | 429 | } |
430 | 430 | |
431 | 431 | if ($type instanceof EnumType) { |
432 | - if (! $valueNode instanceof EnumValueNode) { |
|
432 | + if (!$valueNode instanceof EnumValueNode) { |
|
433 | 433 | return $undefined; |
434 | 434 | } |
435 | 435 | $enumValue = $type->getValue($valueNode->value); |
436 | - if (! $enumValue) { |
|
436 | + if (!$enumValue) { |
|
437 | 437 | return $undefined; |
438 | 438 | } |
439 | 439 | |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | private static function isMissingVariable($valueNode, $variables) |
467 | 467 | { |
468 | 468 | return $valueNode instanceof VariableNode && |
469 | - (count($variables) === 0 || ! array_key_exists($valueNode->name->value, $variables)); |
|
469 | + (count($variables) === 0 || !array_key_exists($valueNode->name->value, $variables)); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | return $valueNode->value; |
507 | 507 | case $valueNode instanceof ListValueNode: |
508 | 508 | return array_map( |
509 | - function ($node) use ($variables) { |
|
509 | + function($node) use ($variables) { |
|
510 | 510 | return self::valueFromASTUntyped($node, $variables); |
511 | 511 | }, |
512 | 512 | iterator_to_array($valueNode->values) |
@@ -514,13 +514,13 @@ discard block |
||
514 | 514 | case $valueNode instanceof ObjectValueNode: |
515 | 515 | return array_combine( |
516 | 516 | array_map( |
517 | - function ($field) { |
|
517 | + function($field) { |
|
518 | 518 | return $field->name->value; |
519 | 519 | }, |
520 | 520 | iterator_to_array($valueNode->fields) |
521 | 521 | ), |
522 | 522 | array_map( |
523 | - function ($field) use ($variables) { |
|
523 | + function($field) use ($variables) { |
|
524 | 524 | return self::valueFromASTUntyped($field->value, $variables); |
525 | 525 | }, |
526 | 526 | iterator_to_array($valueNode->fields) |
@@ -575,11 +575,11 @@ discard block |
||
575 | 575 | { |
576 | 576 | if ($document->definitions) { |
577 | 577 | foreach ($document->definitions as $def) { |
578 | - if (! ($def instanceof OperationDefinitionNode)) { |
|
578 | + if (!($def instanceof OperationDefinitionNode)) { |
|
579 | 579 | continue; |
580 | 580 | } |
581 | 581 | |
582 | - if (! $operationName || (isset($def->name->value) && $def->name->value === $operationName)) { |
|
582 | + if (!$operationName || (isset($def->name->value) && $def->name->value === $operationName)) { |
|
583 | 583 | return $def->operation; |
584 | 584 | } |
585 | 585 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'description' => $this->getDescription($directiveNode), |
83 | 83 | 'locations' => Utils::map( |
84 | 84 | $directiveNode->locations, |
85 | - function ($node) { |
|
85 | + function($node) { |
|
86 | 86 | return $node->value; |
87 | 87 | } |
88 | 88 | ), |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | private function getLeadingCommentBlock($node) |
113 | 113 | { |
114 | 114 | $loc = $node->loc; |
115 | - if (! $loc || ! $loc->startToken) { |
|
115 | + if (!$loc || !$loc->startToken) { |
|
116 | 116 | return null; |
117 | 117 | } |
118 | 118 | $comments = []; |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | { |
136 | 136 | return Utils::keyValMap( |
137 | 137 | $values, |
138 | - function ($value) { |
|
138 | + function($value) { |
|
139 | 139 | return $value->name->value; |
140 | 140 | }, |
141 | - function ($value) { |
|
141 | + function($value) { |
|
142 | 142 | // Note: While this could make assertions to get the correctly typed |
143 | 143 | // value, that would throw immediately while type system validation |
144 | 144 | // with validateSchema() will produce more actionable results. |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | private function internalBuildType($typeName, $typeNode = null) |
193 | 193 | { |
194 | - if (! isset($this->cache[$typeName])) { |
|
194 | + if (!isset($this->cache[$typeName])) { |
|
195 | 195 | if (isset($this->typeDefintionsMap[$typeName])) { |
196 | 196 | $type = $this->makeSchemaDef($this->typeDefintionsMap[$typeName]); |
197 | 197 | if ($this->typeConfigDecorator) { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $e |
210 | 210 | ); |
211 | 211 | } |
212 | - if (! is_array($config) || isset($config[0])) { |
|
212 | + if (!is_array($config) || isset($config[0])) { |
|
213 | 213 | throw new Error( |
214 | 214 | sprintf( |
215 | 215 | 'Type config decorator passed to %s is expected to return an array, but got %s', |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | private function makeSchemaDef($def) |
239 | 239 | { |
240 | - if (! $def) { |
|
240 | + if (!$def) { |
|
241 | 241 | throw new Error('def must be defined.'); |
242 | 242 | } |
243 | 243 | switch ($def->kind) { |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | return new ObjectType([ |
266 | 266 | 'name' => $typeName, |
267 | 267 | 'description' => $this->getDescription($def), |
268 | - 'fields' => function () use ($def) { |
|
268 | + 'fields' => function() use ($def) { |
|
269 | 269 | return $this->makeFieldDefMap($def); |
270 | 270 | }, |
271 | - 'interfaces' => function () use ($def) { |
|
271 | + 'interfaces' => function() use ($def) { |
|
272 | 272 | return $this->makeImplementedInterfaces($def); |
273 | 273 | }, |
274 | 274 | 'astNode' => $def, |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | return $def->fields |
281 | 281 | ? Utils::keyValMap( |
282 | 282 | $def->fields, |
283 | - function ($field) { |
|
283 | + function($field) { |
|
284 | 284 | return $field->name->value; |
285 | 285 | }, |
286 | - function ($field) { |
|
286 | + function($field) { |
|
287 | 287 | return $this->buildField($field); |
288 | 288 | } |
289 | 289 | ) |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | // validation with validateSchema() will produce more actionable results. |
327 | 327 | return Utils::map( |
328 | 328 | $def->interfaces, |
329 | - function ($iface) { |
|
329 | + function($iface) { |
|
330 | 330 | return $this->buildType($iface); |
331 | 331 | } |
332 | 332 | ); |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | return new InterfaceType([ |
343 | 343 | 'name' => $typeName, |
344 | 344 | 'description' => $this->getDescription($def), |
345 | - 'fields' => function () use ($def) { |
|
345 | + 'fields' => function() use ($def) { |
|
346 | 346 | return $this->makeFieldDefMap($def); |
347 | 347 | }, |
348 | 348 | 'astNode' => $def, |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | 'values' => $def->values |
358 | 358 | ? Utils::keyValMap( |
359 | 359 | $def->values, |
360 | - function ($enumValue) { |
|
360 | + function($enumValue) { |
|
361 | 361 | return $enumValue->name->value; |
362 | 362 | }, |
363 | - function ($enumValue) { |
|
363 | + function($enumValue) { |
|
364 | 364 | return [ |
365 | 365 | 'description' => $this->getDescription($enumValue), |
366 | 366 | 'deprecationReason' => $this->getDeprecationReason($enumValue), |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | 'types' => $def->types |
385 | 385 | ? Utils::map( |
386 | 386 | $def->types, |
387 | - function ($typeNode) { |
|
387 | + function($typeNode) { |
|
388 | 388 | return $this->buildType($typeNode); |
389 | 389 | } |
390 | 390 | ) : |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | 'name' => $def->name->value, |
400 | 400 | 'description' => $this->getDescription($def), |
401 | 401 | 'astNode' => $def, |
402 | - 'serialize' => function ($value) { |
|
402 | + 'serialize' => function($value) { |
|
403 | 403 | return $value; |
404 | 404 | }, |
405 | 405 | ]); |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | return new InputObjectType([ |
411 | 411 | 'name' => $def->name->value, |
412 | 412 | 'description' => $this->getDescription($def), |
413 | - 'fields' => function () use ($def) { |
|
413 | + 'fields' => function() use ($def) { |
|
414 | 414 | return $def->fields |
415 | 415 | ? $this->makeInputValues($def->fields) |
416 | 416 | : []; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | */ |
428 | 428 | private function makeSchemaDefFromConfig($def, array $config) |
429 | 429 | { |
430 | - if (! $def) { |
|
430 | + if (!$def) { |
|
431 | 431 | throw new Error('def must be defined.'); |
432 | 432 | } |
433 | 433 | switch ($def->kind) { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | $breakingChanges = []; |
121 | 121 | foreach ($oldTypeMap as $typeName => $oldType) { |
122 | - if (! isset($newTypeMap[$typeName])) { |
|
122 | + if (!isset($newTypeMap[$typeName])) { |
|
123 | 123 | continue; |
124 | 124 | } |
125 | 125 | $newType = $newTypeMap[$typeName]; |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | $breakingChanges = []; |
186 | 186 | foreach ($oldTypeMap as $typeName => $oldType) { |
187 | 187 | $newType = $newTypeMap[$typeName] ?? null; |
188 | - if (! ($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
189 | - ! ($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
190 | - ! ($newType instanceof $oldType) |
|
188 | + if (!($oldType instanceof ObjectType || $oldType instanceof InterfaceType) || |
|
189 | + !($newType instanceof ObjectType || $newType instanceof InterfaceType) || |
|
190 | + !($newType instanceof $oldType) |
|
191 | 191 | ) { |
192 | 192 | continue; |
193 | 193 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $newTypeFieldsDef = $newType->getFields(); |
197 | 197 | foreach ($oldTypeFieldsDef as $fieldName => $fieldDefinition) { |
198 | 198 | // Check if the field is missing on the type in the new schema. |
199 | - if (! isset($newTypeFieldsDef[$fieldName])) { |
|
199 | + if (!isset($newTypeFieldsDef[$fieldName])) { |
|
200 | 200 | $breakingChanges[] = [ |
201 | 201 | 'type' => self::BREAKING_CHANGE_FIELD_REMOVED, |
202 | 202 | 'description' => "${typeName}.${fieldName} was removed.", |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $oldFieldType, |
209 | 209 | $newFieldType |
210 | 210 | ); |
211 | - if (! $isSafe) { |
|
211 | + if (!$isSafe) { |
|
212 | 212 | $oldFieldTypeString = $oldFieldType instanceof NamedType |
213 | 213 | ? $oldFieldType->name |
214 | 214 | : $oldFieldType; |
@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | $dangerousChanges = []; |
279 | 279 | foreach ($oldTypeMap as $typeName => $oldType) { |
280 | 280 | $newType = $newTypeMap[$typeName] ?? null; |
281 | - if (! ($oldType instanceof InputObjectType) || ! ($newType instanceof InputObjectType)) { |
|
281 | + if (!($oldType instanceof InputObjectType) || !($newType instanceof InputObjectType)) { |
|
282 | 282 | continue; |
283 | 283 | } |
284 | 284 | |
285 | 285 | $oldTypeFieldsDef = $oldType->getFields(); |
286 | 286 | $newTypeFieldsDef = $newType->getFields(); |
287 | 287 | foreach (array_keys($oldTypeFieldsDef) as $fieldName) { |
288 | - if (! isset($newTypeFieldsDef[$fieldName])) { |
|
288 | + if (!isset($newTypeFieldsDef[$fieldName])) { |
|
289 | 289 | $breakingChanges[] = [ |
290 | 290 | 'type' => self::BREAKING_CHANGE_FIELD_REMOVED, |
291 | 291 | 'description' => "${typeName}.${fieldName} was removed.", |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $oldFieldType, |
299 | 299 | $newFieldType |
300 | 300 | ); |
301 | - if (! $isSafe) { |
|
301 | + if (!$isSafe) { |
|
302 | 302 | $oldFieldTypeString = $oldFieldType instanceof NamedType |
303 | 303 | ? $oldFieldType->name |
304 | 304 | : $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 | - function ($arg) use ($oldArgDef) { |
|
495 | + function($arg) use ($oldArgDef) { |
|
496 | 496 | return $arg->name === $oldArgDef->name; |
497 | 497 | } |
498 | 498 | ); |
499 | 499 | if ($newArgDef) { |
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 | - function ($arg) use ($newArgDef) { |
|
534 | + 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 | if (Utils::find( |
588 | 588 | $newInterfaces, |
589 | - function (InterfaceType $interface) use ($oldInterface) { |
|
589 | + function(InterfaceType $interface) use ($oldInterface) { |
|
590 | 590 | return $interface->name === $oldInterface->name; |
591 | 591 | } |
592 | 592 | )) { |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | { |
630 | 630 | return Utils::keyMap( |
631 | 631 | $schema->getDirectives(), |
632 | - function ($dir) { |
|
632 | + function($dir) { |
|
633 | 633 | return $dir->name; |
634 | 634 | } |
635 | 635 | ); |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
642 | 642 | |
643 | 643 | foreach ($newSchema->getDirectives() as $newDirective) { |
644 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
644 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
645 | 645 | continue; |
646 | 646 | } |
647 | 647 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | { |
679 | 679 | return Utils::keyMap( |
680 | 680 | $directive->args ?: [], |
681 | - function ($arg) { |
|
681 | + function($arg) { |
|
682 | 682 | return $arg->name; |
683 | 683 | } |
684 | 684 | ); |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
691 | 691 | |
692 | 692 | foreach ($newSchema->getDirectives() as $newDirective) { |
693 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
693 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
694 | 694 | continue; |
695 | 695 | } |
696 | 696 | |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | $oldSchemaDirectiveMap[$newDirective->name], |
699 | 699 | $newDirective |
700 | 700 | ) as $arg) { |
701 | - if (! $arg->getType() instanceof NonNull) { |
|
701 | + if (!$arg->getType() instanceof NonNull) { |
|
702 | 702 | continue; |
703 | 703 | } |
704 | 704 | $addedNonNullableArgs[] = [ |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
743 | 743 | |
744 | 744 | foreach ($newSchema->getDirectives() as $newDirective) { |
745 | - if (! isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
745 | + if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
|
746 | 746 | continue; |
747 | 747 | } |
748 | 748 | |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | $valuesAddedToEnums = []; |
809 | 809 | foreach ($oldTypeMap as $typeName => $oldType) { |
810 | 810 | $newType = $newTypeMap[$typeName] ?? null; |
811 | - if (! ($oldType instanceof EnumType) || ! ($newType instanceof EnumType)) { |
|
811 | + if (!($oldType instanceof EnumType) || !($newType instanceof EnumType)) { |
|
812 | 812 | continue; |
813 | 813 | } |
814 | 814 | $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 | if (Utils::find( |
855 | 855 | $oldInterfaces, |
856 | - function (InterfaceType $interface) use ($newInterface) { |
|
856 | + function(InterfaceType $interface) use ($newInterface) { |
|
857 | 857 | return $interface->name === $newInterface->name; |
858 | 858 | } |
859 | 859 | )) { |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | $typesAddedToUnion = []; |
891 | 891 | foreach ($newTypeMap as $typeName => $newType) { |
892 | 892 | $oldType = $oldTypeMap[$typeName] ?? null; |
893 | - if (! ($oldType instanceof UnionType) || ! ($newType instanceof UnionType)) { |
|
893 | + if (!($oldType instanceof UnionType) || !($newType instanceof UnionType)) { |
|
894 | 894 | continue; |
895 | 895 | } |
896 | 896 |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | // Compute list of blame nodes. |
103 | 103 | if ($nodes instanceof \Traversable) { |
104 | 104 | $nodes = iterator_to_array($nodes); |
105 | - } elseif ($nodes && ! is_array($nodes)) { |
|
105 | + } elseif ($nodes && !is_array($nodes)) { |
|
106 | 106 | $nodes = [$nodes]; |
107 | 107 | } |
108 | 108 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | public function getSource() |
208 | 208 | { |
209 | 209 | if ($this->source === null) { |
210 | - if (! empty($this->nodes[0]) && ! empty($this->nodes[0]->loc)) { |
|
210 | + if (!empty($this->nodes[0]) && !empty($this->nodes[0]->loc)) { |
|
211 | 211 | $this->source = $this->nodes[0]->loc->source; |
212 | 212 | } |
213 | 213 | } |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function getPositions() |
222 | 222 | { |
223 | - if ($this->positions === null && ! empty($this->nodes)) { |
|
223 | + if ($this->positions === null && !empty($this->nodes)) { |
|
224 | 224 | $positions = array_map( |
225 | - function ($node) { |
|
225 | + function($node) { |
|
226 | 226 | return isset($node->loc) ? $node->loc->start : null; |
227 | 227 | }, |
228 | 228 | $this->nodes |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | $this->positions = array_filter( |
232 | 232 | $positions, |
233 | - function ($p) { |
|
233 | + function($p) { |
|
234 | 234 | return $p !== null; |
235 | 235 | } |
236 | 236 | ); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | if ($positions && $source) { |
264 | 264 | $this->locations = array_map( |
265 | - function ($pos) use ($source) { |
|
265 | + function($pos) use ($source) { |
|
266 | 266 | return $source->getLocation($pos); |
267 | 267 | }, |
268 | 268 | $positions |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | } elseif ($nodes) { |
271 | 271 | $this->locations = array_filter( |
272 | 272 | array_map( |
273 | - function ($node) { |
|
273 | + function($node) { |
|
274 | 274 | if ($node->loc && $node->loc->source) { |
275 | 275 | return $node->loc->source->getLocation($node->loc->start); |
276 | 276 | } |
@@ -328,18 +328,18 @@ discard block |
||
328 | 328 | |
329 | 329 | $locations = Utils::map( |
330 | 330 | $this->getLocations(), |
331 | - function (SourceLocation $loc) { |
|
331 | + function(SourceLocation $loc) { |
|
332 | 332 | return $loc->toSerializableArray(); |
333 | 333 | } |
334 | 334 | ); |
335 | 335 | |
336 | - if (! empty($locations)) { |
|
336 | + if (!empty($locations)) { |
|
337 | 337 | $arr['locations'] = $locations; |
338 | 338 | } |
339 | - if (! empty($this->path)) { |
|
339 | + if (!empty($this->path)) { |
|
340 | 340 | $arr['path'] = $this->path; |
341 | 341 | } |
342 | - if (! empty($this->extensions)) { |
|
342 | + if (!empty($this->extensions)) { |
|
343 | 343 | $arr['extensions'] = $this->extensions; |
344 | 344 | } |
345 | 345 |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $suggestions = Utils::suggestionList( |
96 | 96 | Utils::printSafe($value), |
97 | 97 | array_map( |
98 | - function ($enumValue) { |
|
98 | + function($enumValue) { |
|
99 | 99 | return $enumValue->name; |
100 | 100 | }, |
101 | 101 | $type->getValues() |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | if ($type instanceof InputObjectType) { |
147 | - if (! is_object($value) && ! is_array($value) && ! $value instanceof \Traversable) { |
|
147 | + if (!is_object($value) && !is_array($value) && !$value instanceof \Traversable) { |
|
148 | 148 | return self::ofErrors([ |
149 | 149 | self::coercionError( |
150 | 150 | sprintf('Expected type %s to be an object', $type->name), |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $pathStr = ''; |
266 | 266 | $currentPath = $path; |
267 | 267 | while ($currentPath) { |
268 | - $pathStr = |
|
268 | + $pathStr = |
|
269 | 269 | (is_string($currentPath['key']) |
270 | 270 | ? '.' . $currentPath['key'] |
271 | 271 | : '[' . $currentPath['key'] . ']') . $pathStr; |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | public static function assign($obj, array $vars, array $requiredKeys = []) |
80 | 80 | { |
81 | 81 | foreach ($requiredKeys as $key) { |
82 | - if (! isset($vars[$key])) { |
|
82 | + if (!isset($vars[$key])) { |
|
83 | 83 | throw new InvalidArgumentException(sprintf('Key %s is expected to be set and not to be null', $key)); |
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | 87 | foreach ($vars as $key => $value) { |
88 | - if (! property_exists($obj, $key)) { |
|
88 | + if (!property_exists($obj, $key)) { |
|
89 | 89 | $cls = get_class($obj); |
90 | 90 | Warning::warn( |
91 | 91 | sprintf("Trying to set non-existing property '%s' on class '%s'", $key, $cls), |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | $result = []; |
134 | 134 | $assoc = false; |
135 | 135 | foreach ($traversable as $key => $value) { |
136 | - if (! $assoc && ! is_int($key)) { |
|
136 | + if (!$assoc && !is_int($key)) { |
|
137 | 137 | $assoc = true; |
138 | 138 | } |
139 | - if (! $predicate($value, $key)) { |
|
139 | + if (!$predicate($value, $key)) { |
|
140 | 140 | continue; |
141 | 141 | } |
142 | 142 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $map = []; |
203 | 203 | foreach ($traversable as $key => $value) { |
204 | 204 | $newKey = $keyFn($value, $key); |
205 | - if (! is_scalar($newKey)) { |
|
205 | + if (!is_scalar($newKey)) { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | public static function every($traversable, callable $predicate) |
279 | 279 | { |
280 | 280 | foreach ($traversable as $key => $value) { |
281 | - if (! $predicate($value, $key)) { |
|
281 | + if (!$predicate($value, $key)) { |
|
282 | 282 | return false; |
283 | 283 | } |
284 | 284 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public static function invariant($test, $message = '') |
294 | 294 | { |
295 | - if (! $test) { |
|
295 | + if (!$test) { |
|
296 | 296 | if (func_num_args() > 2) { |
297 | 297 | $args = func_get_args(); |
298 | 298 | array_shift($args); |
@@ -424,10 +424,10 @@ discard block |
||
424 | 424 | */ |
425 | 425 | public static function ord($char, $encoding = 'UTF-8') |
426 | 426 | { |
427 | - if (! $char && $char !== '0') { |
|
427 | + if (!$char && $char !== '0') { |
|
428 | 428 | return 0; |
429 | 429 | } |
430 | - if (! isset($char[1])) { |
|
430 | + if (!isset($char[1])) { |
|
431 | 431 | return ord($char); |
432 | 432 | } |
433 | 433 | if ($encoding !== 'UCS-4BE') { |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | ); |
502 | 502 | } |
503 | 503 | |
504 | - if (! preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) { |
|
504 | + if (!preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) { |
|
505 | 505 | return new Error( |
506 | 506 | sprintf('Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "%s" does not.', $name), |
507 | 507 | $node |
@@ -520,9 +520,9 @@ discard block |
||
520 | 520 | */ |
521 | 521 | public static function withErrorHandling(callable $fn, array &$errors) |
522 | 522 | { |
523 | - return function () use ($fn, &$errors) { |
|
523 | + return function() use ($fn, &$errors) { |
|
524 | 524 | // Catch custom errors (to report them in query results) |
525 | - set_error_handler(function ($severity, $message, $file, $line) use (&$errors) { |
|
525 | + set_error_handler(function($severity, $message, $file, $line) use (&$errors) { |
|
526 | 526 | $errors[] = new \ErrorException($message, 0, $severity, $file, $line); |
527 | 527 | }); |
528 | 528 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | public static function quotedOrList(array $items) |
542 | 542 | { |
543 | 543 | $items = array_map( |
544 | - function ($item) { |
|
544 | + function($item) { |
|
545 | 545 | return sprintf('"%s"', $item); |
546 | 546 | }, |
547 | 547 | $items |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | |
570 | 570 | return array_reduce( |
571 | 571 | range(1, $selectedLength - 1), |
572 | - function ($list, $index) use ($selected, $selectedLength) { |
|
572 | + function($list, $index) use ($selected, $selectedLength) { |
|
573 | 573 | return $list . |
574 | 574 | ($selectedLength > 2 ? ', ' : ' ') . |
575 | 575 | ($index === $selectedLength - 1 ? 'or ' : '') . |