@@ -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) { |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | return self::printFilteredSchema( |
| 52 | 52 | $schema, |
| 53 | - function ($type) { |
|
| 54 | - return ! Directive::isSpecifiedDirective($type); |
|
| 53 | + function($type) { |
|
| 54 | + return !Directive::isSpecifiedDirective($type); |
|
| 55 | 55 | }, |
| 56 | - function ($type) { |
|
| 57 | - return ! Type::isBuiltInType($type); |
|
| 56 | + function($type) { |
|
| 57 | + return !Type::isBuiltInType($type); |
|
| 58 | 58 | }, |
| 59 | 59 | $options |
| 60 | 60 | ); |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $directives = array_filter( |
| 69 | 69 | $schema->getDirectives(), |
| 70 | - function ($directive) use ($directiveFilter) { |
|
| 70 | + function($directive) use ($directiveFilter) { |
|
| 71 | 71 | return $directiveFilter($directive); |
| 72 | 72 | } |
| 73 | 73 | ); |
| 74 | - $types = $schema->getTypeMap(); |
|
| 74 | + $types = $schema->getTypeMap(); |
|
| 75 | 75 | ksort($types); |
| 76 | 76 | $types = array_filter($types, $typeFilter); |
| 77 | 77 | |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | array_filter( |
| 81 | 81 | array_merge( |
| 82 | 82 | [self::printSchemaDefinition($schema)], |
| 83 | - array_map(function ($directive) use ($options) { |
|
| 83 | + array_map(function($directive) use ($options) { |
|
| 84 | 84 | return self::printDirective($directive, $options); |
| 85 | 85 | }, |
| 86 | 86 | $directives), |
| 87 | - array_map(function ($type) use ($options) { |
|
| 87 | + array_map(function($type) use ($options) { |
|
| 88 | 88 | return self::printType($type, $options); |
| 89 | 89 | }, |
| 90 | 90 | $types) |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | private static function printDescription($options, $def, $indentation = '', $firstInBlock = true) |
| 162 | 162 | { |
| 163 | - if (! $def->description) { |
|
| 163 | + if (!$def->description) { |
|
| 164 | 164 | return ''; |
| 165 | 165 | } |
| 166 | 166 | $lines = self::descriptionLines($def->description, 120 - strlen($indentation)); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | return self::printDescriptionWithComments($lines, $indentation, $firstInBlock); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - $description = ($indentation && ! $firstInBlock) |
|
| 171 | + $description = ($indentation && !$firstInBlock) |
|
| 172 | 172 | ? "\n" . $indentation . '"""' |
| 173 | 173 | : $indentation . '"""'; |
| 174 | 174 | |
@@ -186,13 +186,13 @@ discard block |
||
| 186 | 186 | substr($lines[0], 0, 1) === ' ' || |
| 187 | 187 | substr($lines[0], 0, 1) === '\t' |
| 188 | 188 | ); |
| 189 | - if (! $hasLeadingSpace) { |
|
| 189 | + if (!$hasLeadingSpace) { |
|
| 190 | 190 | $description .= "\n"; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | $lineLength = count($lines); |
| 194 | 194 | for ($i = 0; $i < $lineLength; $i++) { |
| 195 | - if ($i !== 0 || ! $hasLeadingSpace) { |
|
| 195 | + if ($i !== 0 || !$hasLeadingSpace) { |
|
| 196 | 196 | $description .= $indentation; |
| 197 | 197 | } |
| 198 | 198 | $description .= self::escapeQuote($lines[$i]) . "\n"; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | private static function printDescriptionWithComments($lines, $indentation, $firstInBlock) |
| 237 | 237 | { |
| 238 | - $description = $indentation && ! $firstInBlock ? "\n" : ''; |
|
| 238 | + $description = $indentation && !$firstInBlock ? "\n" : ''; |
|
| 239 | 239 | foreach ($lines as $line) { |
| 240 | 240 | if ($line === '') { |
| 241 | 241 | $description .= $indentation . "#\n"; |
@@ -254,14 +254,14 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | private static function printArgs($options, $args, $indentation = '') |
| 256 | 256 | { |
| 257 | - if (! $args) { |
|
| 257 | + if (!$args) { |
|
| 258 | 258 | return ''; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | // If every arg does not have a description, print them on one line. |
| 262 | 262 | if (Utils::every( |
| 263 | 263 | $args, |
| 264 | - function ($arg) { |
|
| 264 | + function($arg) { |
|
| 265 | 265 | return empty($arg->description); |
| 266 | 266 | } |
| 267 | 267 | )) { |
@@ -273,8 +273,8 @@ discard block |
||
| 273 | 273 | implode( |
| 274 | 274 | "\n", |
| 275 | 275 | array_map( |
| 276 | - function ($arg, $i) use ($indentation, $options) { |
|
| 277 | - return self::printDescription($options, $arg, ' ' . $indentation, ! $i) . ' ' . $indentation . |
|
| 276 | + function($arg, $i) use ($indentation, $options) { |
|
| 277 | + return self::printDescription($options, $arg, ' ' . $indentation, !$i) . ' ' . $indentation . |
|
| 278 | 278 | self::printInputValue($arg); |
| 279 | 279 | }, |
| 280 | 280 | $args, |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | private static function printObject(ObjectType $type, array $options) |
| 342 | 342 | { |
| 343 | 343 | $interfaces = $type->getInterfaces(); |
| 344 | - $implementedInterfaces = ! empty($interfaces) ? |
|
| 344 | + $implementedInterfaces = !empty($interfaces) ? |
|
| 345 | 345 | ' implements ' . implode( |
| 346 | 346 | ', ', |
| 347 | - array_map(function ($i) { |
|
| 347 | + array_map(function($i) { |
|
| 348 | 348 | return $i->name; |
| 349 | 349 | }, |
| 350 | 350 | $interfaces) |
@@ -364,8 +364,8 @@ discard block |
||
| 364 | 364 | return implode( |
| 365 | 365 | "\n", |
| 366 | 366 | array_map( |
| 367 | - function ($f, $i) use ($options) { |
|
| 368 | - return self::printDescription($options, $f, ' ', ! $i) . ' ' . |
|
| 367 | + function($f, $i) use ($options) { |
|
| 368 | + return self::printDescription($options, $f, ' ', !$i) . ' ' . |
|
| 369 | 369 | $f->name . self::printArgs($options, $f->args, ' ') . ': ' . |
| 370 | 370 | (string) $f->getType() . self::printDeprecated($f); |
| 371 | 371 | }, |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | return implode( |
| 425 | 425 | "\n", |
| 426 | 426 | array_map( |
| 427 | - function ($value, $i) use ($options) { |
|
| 428 | - return self::printDescription($options, $value, ' ', ! $i) . ' ' . |
|
| 427 | + function($value, $i) use ($options) { |
|
| 428 | + return self::printDescription($options, $value, ' ', !$i) . ' ' . |
|
| 429 | 429 | $value->name . self::printDeprecated($value); |
| 430 | 430 | }, |
| 431 | 431 | $values, |
@@ -448,8 +448,8 @@ discard block |
||
| 448 | 448 | implode( |
| 449 | 449 | "\n", |
| 450 | 450 | array_map( |
| 451 | - function ($f, $i) use ($options) { |
|
| 452 | - return self::printDescription($options, $f, ' ', ! $i) . ' ' . self::printInputValue($f); |
|
| 451 | + function($f, $i) use ($options) { |
|
| 452 | + return self::printDescription($options, $f, ' ', !$i) . ' ' . self::printInputValue($f); |
|
| 453 | 453 | }, |
| 454 | 454 | $fields, |
| 455 | 455 | array_keys($fields) |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | case NodeKind::UNION_TYPE_DEFINITION: |
| 112 | 112 | case NodeKind::INPUT_OBJECT_TYPE_DEFINITION: |
| 113 | 113 | $typeName = $d->name->value; |
| 114 | - if (! empty($this->nodeMap[$typeName])) { |
|
| 114 | + if (!empty($this->nodeMap[$typeName])) { |
|
| 115 | 115 | throw new Error(sprintf('Type "%s" was defined more than once.', $typeName)); |
| 116 | 116 | } |
| 117 | 117 | $typeDefs[] = $d; |
@@ -134,13 +134,13 @@ discard block |
||
| 134 | 134 | $defintionBuilder = new ASTDefinitionBuilder( |
| 135 | 135 | $this->nodeMap, |
| 136 | 136 | $this->options, |
| 137 | - function ($typeName) { |
|
| 137 | + function($typeName) { |
|
| 138 | 138 | throw new Error('Type "' . $typeName . '" not found in document.'); |
| 139 | 139 | }, |
| 140 | 140 | $this->typeConfigDecorator |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - $directives = array_map(function ($def) use ($defintionBuilder) { |
|
| 143 | + $directives = array_map(function($def) use ($defintionBuilder) { |
|
| 144 | 144 | return $defintionBuilder->buildDirective($def); |
| 145 | 145 | }, |
| 146 | 146 | $directiveDefs); |
@@ -148,31 +148,31 @@ discard block |
||
| 148 | 148 | // If specified directives were not explicitly declared, add them. |
| 149 | 149 | $skip = array_reduce( |
| 150 | 150 | $directives, |
| 151 | - function ($hasSkip, $directive) { |
|
| 151 | + function($hasSkip, $directive) { |
|
| 152 | 152 | return $hasSkip || $directive->name === 'skip'; |
| 153 | 153 | } |
| 154 | 154 | ); |
| 155 | - if (! $skip) { |
|
| 155 | + if (!$skip) { |
|
| 156 | 156 | $directives[] = Directive::skipDirective(); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $include = array_reduce( |
| 160 | 160 | $directives, |
| 161 | - function ($hasInclude, $directive) { |
|
| 161 | + function($hasInclude, $directive) { |
|
| 162 | 162 | return $hasInclude || $directive->name === 'include'; |
| 163 | 163 | } |
| 164 | 164 | ); |
| 165 | - if (! $include) { |
|
| 165 | + if (!$include) { |
|
| 166 | 166 | $directives[] = Directive::includeDirective(); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $deprecated = array_reduce( |
| 170 | 170 | $directives, |
| 171 | - function ($hasDeprecated, $directive) { |
|
| 171 | + function($hasDeprecated, $directive) { |
|
| 172 | 172 | return $hasDeprecated || $directive->name === 'deprecated'; |
| 173 | 173 | } |
| 174 | 174 | ); |
| 175 | - if (! $deprecated) { |
|
| 175 | + if (!$deprecated) { |
|
| 176 | 176 | $directives[] = Directive::deprecatedDirective(); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | 'subscription' => isset($operationTypes['subscription']) |
| 191 | 191 | ? $defintionBuilder->buildType($operationTypes['subscription']) |
| 192 | 192 | : null, |
| 193 | - 'typeLoader' => function ($name) use ($defintionBuilder) { |
|
| 193 | + 'typeLoader' => function($name) use ($defintionBuilder) { |
|
| 194 | 194 | return $defintionBuilder->buildType($name); |
| 195 | 195 | }, |
| 196 | 196 | 'directives' => $directives, |
| 197 | 197 | 'astNode' => $schemaDef, |
| 198 | - 'types' => function () use ($defintionBuilder) { |
|
| 198 | + 'types' => function() use ($defintionBuilder) { |
|
| 199 | 199 | $types = []; |
| 200 | 200 | foreach ($this->nodeMap as $name => $def) { |
| 201 | 201 | $types[] = $defintionBuilder->buildType($def->name->value); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | throw new Error(sprintf('Must provide only one %s type in schema.', $operation)); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - if (! isset($this->nodeMap[$typeName])) { |
|
| 228 | + if (!isset($this->nodeMap[$typeName])) { |
|
| 229 | 229 | throw new Error(sprintf('Specified %s type "%s" not found in document.', $operation, $typeName)); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | $suggestions = Utils::suggestionList( |
| 96 | 96 | Utils::printSafe($value), |
| 97 | - array_map(function ($enumValue) { |
|
| 97 | + array_map(function($enumValue) { |
|
| 98 | 98 | return $enumValue->name; |
| 99 | 99 | }, |
| 100 | 100 | $type->getValues()) |
| 101 | 101 | ); |
| 102 | - $didYouMean = $suggestions |
|
| 102 | + $didYouMean = $suggestions |
|
| 103 | 103 | ? 'did you mean ' . Utils::orList($suggestions) . '?' |
| 104 | 104 | : null; |
| 105 | 105 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | if ($type instanceof InputObjectType) { |
| 144 | - if (! is_object($value) && ! is_array($value) && ! $value instanceof \Traversable) { |
|
| 144 | + if (!is_object($value) && !is_array($value) && !$value instanceof \Traversable) { |
|
| 145 | 145 | return self::ofErrors([ |
| 146 | 146 | self::coercionError( |
| 147 | 147 | sprintf('Expected type %s to be an object', $type->name), |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $pathStr = ''; |
| 259 | 259 | $currentPath = $path; |
| 260 | 260 | while ($currentPath) { |
| 261 | - $pathStr = |
|
| 261 | + $pathStr = |
|
| 262 | 262 | (is_string($currentPath['key']) |
| 263 | 263 | ? '.' . $currentPath['key'] |
| 264 | 264 | : '[' . $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 | |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | */ |
| 541 | 541 | public static function quotedOrList(array $items) |
| 542 | 542 | { |
| 543 | - $items = array_map(function ($item) { |
|
| 543 | + $items = array_map(function($item) { |
|
| 544 | 544 | return sprintf('"%s"', $item); |
| 545 | 545 | }, |
| 546 | 546 | $items); |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | */ |
| 555 | 555 | public static function orList(array $items) |
| 556 | 556 | { |
| 557 | - if (! $items) { |
|
| 557 | + if (!$items) { |
|
| 558 | 558 | throw new \LogicException('items must not need to be empty.'); |
| 559 | 559 | } |
| 560 | 560 | $selected = array_slice($items, 0, 5); |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | |
| 568 | 568 | return array_reduce( |
| 569 | 569 | range(1, $selectedLength - 1), |
| 570 | - function ($list, $index) use ($selected, $selectedLength) { |
|
| 570 | + function($list, $index) use ($selected, $selectedLength) { |
|
| 571 | 571 | return $list . |
| 572 | 572 | ($selectedLength > 2 ? ', ' : ' ') . |
| 573 | 573 | ($index === $selectedLength - 1 ? 'or ' : '') . |
@@ -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 | |