@@ -99,19 +99,19 @@ discard block |
||
| 99 | 99 | $ast, |
| 100 | 100 | [ |
| 101 | 101 | 'leave' => [ |
| 102 | - NodeKind::NAME => static function (NameNode $node) { |
|
| 102 | + NodeKind::NAME => static function(NameNode $node) { |
|
| 103 | 103 | return '' . $node->value; |
| 104 | 104 | }, |
| 105 | 105 | |
| 106 | - NodeKind::VARIABLE => static function (VariableNode $node) { |
|
| 106 | + NodeKind::VARIABLE => static function(VariableNode $node) { |
|
| 107 | 107 | return '$' . $node->name; |
| 108 | 108 | }, |
| 109 | 109 | |
| 110 | - NodeKind::DOCUMENT => function (DocumentNode $node) { |
|
| 110 | + NodeKind::DOCUMENT => function(DocumentNode $node) { |
|
| 111 | 111 | return $this->join($node->definitions, "\n\n") . "\n"; |
| 112 | 112 | }, |
| 113 | 113 | |
| 114 | - NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) { |
|
| 114 | + NodeKind::OPERATION_DEFINITION => function(OperationDefinitionNode $node) { |
|
| 115 | 115 | $op = $node->operation; |
| 116 | 116 | $name = $node->name; |
| 117 | 117 | $varDefs = $this->wrap('(', $this->join($node->variableDefinitions, ', '), ')'); |
@@ -120,12 +120,12 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | // Anonymous queries with no directives or variable definitions can use |
| 122 | 122 | // the query short form. |
| 123 | - return ! $name && ! $directives && ! $varDefs && $op === 'query' |
|
| 123 | + return !$name && !$directives && !$varDefs && $op === 'query' |
|
| 124 | 124 | ? $selectionSet |
| 125 | 125 | : $this->join([$op, $this->join([$name, $varDefs]), $directives, $selectionSet], ' '); |
| 126 | 126 | }, |
| 127 | 127 | |
| 128 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $node) { |
|
| 128 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $node) { |
|
| 129 | 129 | return $node->variable |
| 130 | 130 | . ': ' |
| 131 | 131 | . $node->type |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | . $this->wrap(' ', $this->join($node->directives, ' ')); |
| 134 | 134 | }, |
| 135 | 135 | |
| 136 | - NodeKind::SELECTION_SET => function (SelectionSetNode $node) { |
|
| 136 | + NodeKind::SELECTION_SET => function(SelectionSetNode $node) { |
|
| 137 | 137 | return $this->block($node->selections); |
| 138 | 138 | }, |
| 139 | 139 | |
| 140 | - NodeKind::FIELD => function (FieldNode $node) { |
|
| 140 | + NodeKind::FIELD => function(FieldNode $node) { |
|
| 141 | 141 | return $this->join( |
| 142 | 142 | [ |
| 143 | 143 | $this->wrap('', $node->alias, ': ') . $node->name . $this->wrap( |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | ); |
| 153 | 153 | }, |
| 154 | 154 | |
| 155 | - NodeKind::ARGUMENT => static function (ArgumentNode $node) { |
|
| 155 | + NodeKind::ARGUMENT => static function(ArgumentNode $node) { |
|
| 156 | 156 | return $node->name . ': ' . $node->value; |
| 157 | 157 | }, |
| 158 | 158 | |
| 159 | - NodeKind::FRAGMENT_SPREAD => function (FragmentSpreadNode $node) { |
|
| 159 | + NodeKind::FRAGMENT_SPREAD => function(FragmentSpreadNode $node) { |
|
| 160 | 160 | return '...' . $node->name . $this->wrap(' ', $this->join($node->directives, ' ')); |
| 161 | 161 | }, |
| 162 | 162 | |
| 163 | - NodeKind::INLINE_FRAGMENT => function (InlineFragmentNode $node) { |
|
| 163 | + NodeKind::INLINE_FRAGMENT => function(InlineFragmentNode $node) { |
|
| 164 | 164 | return $this->join( |
| 165 | 165 | [ |
| 166 | 166 | '...', |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | ); |
| 173 | 173 | }, |
| 174 | 174 | |
| 175 | - NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) { |
|
| 175 | + NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $node) { |
|
| 176 | 176 | // Note: fragment variable definitions are experimental and may be changed or removed in the future. |
| 177 | 177 | return sprintf('fragment %s', $node->name) |
| 178 | 178 | . $this->wrap('(', $this->join($node->variableDefinitions, ', '), ')') |
@@ -181,15 +181,15 @@ discard block |
||
| 181 | 181 | . $node->selectionSet; |
| 182 | 182 | }, |
| 183 | 183 | |
| 184 | - NodeKind::INT => static function (IntValueNode $node) { |
|
| 184 | + NodeKind::INT => static function(IntValueNode $node) { |
|
| 185 | 185 | return $node->value; |
| 186 | 186 | }, |
| 187 | 187 | |
| 188 | - NodeKind::FLOAT => static function (FloatValueNode $node) { |
|
| 188 | + NodeKind::FLOAT => static function(FloatValueNode $node) { |
|
| 189 | 189 | return $node->value; |
| 190 | 190 | }, |
| 191 | 191 | |
| 192 | - NodeKind::STRING => function (StringValueNode $node, $key) { |
|
| 192 | + NodeKind::STRING => function(StringValueNode $node, $key) { |
|
| 193 | 193 | if ($node->block) { |
| 194 | 194 | return $this->printBlockString($node->value, $key === 'description'); |
| 195 | 195 | } |
@@ -197,47 +197,47 @@ discard block |
||
| 197 | 197 | return json_encode($node->value); |
| 198 | 198 | }, |
| 199 | 199 | |
| 200 | - NodeKind::BOOLEAN => static function (BooleanValueNode $node) { |
|
| 200 | + NodeKind::BOOLEAN => static function(BooleanValueNode $node) { |
|
| 201 | 201 | return $node->value ? 'true' : 'false'; |
| 202 | 202 | }, |
| 203 | 203 | |
| 204 | - NodeKind::NULL => static function (NullValueNode $node) { |
|
| 204 | + NodeKind::NULL => static function(NullValueNode $node) { |
|
| 205 | 205 | return 'null'; |
| 206 | 206 | }, |
| 207 | 207 | |
| 208 | - NodeKind::ENUM => static function (EnumValueNode $node) { |
|
| 208 | + NodeKind::ENUM => static function(EnumValueNode $node) { |
|
| 209 | 209 | return $node->value; |
| 210 | 210 | }, |
| 211 | 211 | |
| 212 | - NodeKind::LST => function (ListValueNode $node) { |
|
| 212 | + NodeKind::LST => function(ListValueNode $node) { |
|
| 213 | 213 | return '[' . $this->join($node->values, ', ') . ']'; |
| 214 | 214 | }, |
| 215 | 215 | |
| 216 | - NodeKind::OBJECT => function (ObjectValueNode $node) { |
|
| 216 | + NodeKind::OBJECT => function(ObjectValueNode $node) { |
|
| 217 | 217 | return '{' . $this->join($node->fields, ', ') . '}'; |
| 218 | 218 | }, |
| 219 | 219 | |
| 220 | - NodeKind::OBJECT_FIELD => static function (ObjectFieldNode $node) { |
|
| 220 | + NodeKind::OBJECT_FIELD => static function(ObjectFieldNode $node) { |
|
| 221 | 221 | return $node->name . ': ' . $node->value; |
| 222 | 222 | }, |
| 223 | 223 | |
| 224 | - NodeKind::DIRECTIVE => function (DirectiveNode $node) { |
|
| 224 | + NodeKind::DIRECTIVE => function(DirectiveNode $node) { |
|
| 225 | 225 | return '@' . $node->name . $this->wrap('(', $this->join($node->arguments, ', '), ')'); |
| 226 | 226 | }, |
| 227 | 227 | |
| 228 | - NodeKind::NAMED_TYPE => static function (NamedTypeNode $node) { |
|
| 228 | + NodeKind::NAMED_TYPE => static function(NamedTypeNode $node) { |
|
| 229 | 229 | return $node->name; |
| 230 | 230 | }, |
| 231 | 231 | |
| 232 | - NodeKind::LIST_TYPE => static function (ListTypeNode $node) { |
|
| 232 | + NodeKind::LIST_TYPE => static function(ListTypeNode $node) { |
|
| 233 | 233 | return '[' . $node->type . ']'; |
| 234 | 234 | }, |
| 235 | 235 | |
| 236 | - NodeKind::NON_NULL_TYPE => static function (NonNullTypeNode $node) { |
|
| 236 | + NodeKind::NON_NULL_TYPE => static function(NonNullTypeNode $node) { |
|
| 237 | 237 | return $node->type . '!'; |
| 238 | 238 | }, |
| 239 | 239 | |
| 240 | - NodeKind::SCHEMA_DEFINITION => function (SchemaDefinitionNode $def) { |
|
| 240 | + NodeKind::SCHEMA_DEFINITION => function(SchemaDefinitionNode $def) { |
|
| 241 | 241 | return $this->join( |
| 242 | 242 | [ |
| 243 | 243 | 'schema', |
@@ -248,15 +248,15 @@ discard block |
||
| 248 | 248 | ); |
| 249 | 249 | }, |
| 250 | 250 | |
| 251 | - NodeKind::OPERATION_TYPE_DEFINITION => static function (OperationTypeDefinitionNode $def) { |
|
| 251 | + NodeKind::OPERATION_TYPE_DEFINITION => static function(OperationTypeDefinitionNode $def) { |
|
| 252 | 252 | return $def->operation . ': ' . $def->type; |
| 253 | 253 | }, |
| 254 | 254 | |
| 255 | - NodeKind::SCALAR_TYPE_DEFINITION => $this->addDescription(function (ScalarTypeDefinitionNode $def) { |
|
| 255 | + NodeKind::SCALAR_TYPE_DEFINITION => $this->addDescription(function(ScalarTypeDefinitionNode $def) { |
|
| 256 | 256 | return $this->join(['scalar', $def->name, $this->join($def->directives, ' ')], ' '); |
| 257 | 257 | }), |
| 258 | 258 | |
| 259 | - NodeKind::OBJECT_TYPE_DEFINITION => $this->addDescription(function (ObjectTypeDefinitionNode $def) { |
|
| 259 | + NodeKind::OBJECT_TYPE_DEFINITION => $this->addDescription(function(ObjectTypeDefinitionNode $def) { |
|
| 260 | 260 | return $this->join( |
| 261 | 261 | [ |
| 262 | 262 | 'type', |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | ); |
| 270 | 270 | }), |
| 271 | 271 | |
| 272 | - NodeKind::FIELD_DEFINITION => $this->addDescription(function (FieldDefinitionNode $def) { |
|
| 273 | - $noIndent = Utils::every($def->arguments, static function (string $arg) { |
|
| 272 | + NodeKind::FIELD_DEFINITION => $this->addDescription(function(FieldDefinitionNode $def) { |
|
| 273 | + $noIndent = Utils::every($def->arguments, static function(string $arg) { |
|
| 274 | 274 | return strpos($arg, "\n") === false; |
| 275 | 275 | }); |
| 276 | 276 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | . $this->wrap(' ', $this->join($def->directives, ' ')); |
| 283 | 283 | }), |
| 284 | 284 | |
| 285 | - NodeKind::INPUT_VALUE_DEFINITION => $this->addDescription(function (InputValueDefinitionNode $def) { |
|
| 285 | + NodeKind::INPUT_VALUE_DEFINITION => $this->addDescription(function(InputValueDefinitionNode $def) { |
|
| 286 | 286 | return $this->join( |
| 287 | 287 | [ |
| 288 | 288 | $def->name . ': ' . $def->type, |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | }), |
| 295 | 295 | |
| 296 | 296 | NodeKind::INTERFACE_TYPE_DEFINITION => $this->addDescription( |
| 297 | - function (InterfaceTypeDefinitionNode $def) { |
|
| 297 | + function(InterfaceTypeDefinitionNode $def) { |
|
| 298 | 298 | return $this->join( |
| 299 | 299 | [ |
| 300 | 300 | 'interface', |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | } |
| 308 | 308 | ), |
| 309 | 309 | |
| 310 | - NodeKind::UNION_TYPE_DEFINITION => $this->addDescription(function (UnionTypeDefinitionNode $def) { |
|
| 310 | + NodeKind::UNION_TYPE_DEFINITION => $this->addDescription(function(UnionTypeDefinitionNode $def) { |
|
| 311 | 311 | return $this->join( |
| 312 | 312 | [ |
| 313 | 313 | 'union', |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | ); |
| 322 | 322 | }), |
| 323 | 323 | |
| 324 | - NodeKind::ENUM_TYPE_DEFINITION => $this->addDescription(function (EnumTypeDefinitionNode $def) { |
|
| 324 | + NodeKind::ENUM_TYPE_DEFINITION => $this->addDescription(function(EnumTypeDefinitionNode $def) { |
|
| 325 | 325 | return $this->join( |
| 326 | 326 | [ |
| 327 | 327 | 'enum', |
@@ -333,11 +333,11 @@ discard block |
||
| 333 | 333 | ); |
| 334 | 334 | }), |
| 335 | 335 | |
| 336 | - NodeKind::ENUM_VALUE_DEFINITION => $this->addDescription(function (EnumValueDefinitionNode $def) { |
|
| 336 | + NodeKind::ENUM_VALUE_DEFINITION => $this->addDescription(function(EnumValueDefinitionNode $def) { |
|
| 337 | 337 | return $this->join([$def->name, $this->join($def->directives, ' ')], ' '); |
| 338 | 338 | }), |
| 339 | 339 | |
| 340 | - NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $this->addDescription(function ( |
|
| 340 | + NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $this->addDescription(function( |
|
| 341 | 341 | InputObjectTypeDefinitionNode $def |
| 342 | 342 | ) { |
| 343 | 343 | return $this->join( |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | ); |
| 352 | 352 | }), |
| 353 | 353 | |
| 354 | - NodeKind::SCHEMA_EXTENSION => function (SchemaTypeExtensionNode $def) { |
|
| 354 | + NodeKind::SCHEMA_EXTENSION => function(SchemaTypeExtensionNode $def) { |
|
| 355 | 355 | return $this->join( |
| 356 | 356 | [ |
| 357 | 357 | 'extend schema', |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | ); |
| 363 | 363 | }, |
| 364 | 364 | |
| 365 | - NodeKind::SCALAR_TYPE_EXTENSION => function (ScalarTypeExtensionNode $def) { |
|
| 365 | + NodeKind::SCALAR_TYPE_EXTENSION => function(ScalarTypeExtensionNode $def) { |
|
| 366 | 366 | return $this->join( |
| 367 | 367 | [ |
| 368 | 368 | 'extend scalar', |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | ); |
| 374 | 374 | }, |
| 375 | 375 | |
| 376 | - NodeKind::OBJECT_TYPE_EXTENSION => function (ObjectTypeExtensionNode $def) { |
|
| 376 | + NodeKind::OBJECT_TYPE_EXTENSION => function(ObjectTypeExtensionNode $def) { |
|
| 377 | 377 | return $this->join( |
| 378 | 378 | [ |
| 379 | 379 | 'extend type', |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | ); |
| 387 | 387 | }, |
| 388 | 388 | |
| 389 | - NodeKind::INTERFACE_TYPE_EXTENSION => function (InterfaceTypeExtensionNode $def) { |
|
| 389 | + NodeKind::INTERFACE_TYPE_EXTENSION => function(InterfaceTypeExtensionNode $def) { |
|
| 390 | 390 | return $this->join( |
| 391 | 391 | [ |
| 392 | 392 | 'extend interface', |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | ); |
| 399 | 399 | }, |
| 400 | 400 | |
| 401 | - NodeKind::UNION_TYPE_EXTENSION => function (UnionTypeExtensionNode $def) { |
|
| 401 | + NodeKind::UNION_TYPE_EXTENSION => function(UnionTypeExtensionNode $def) { |
|
| 402 | 402 | return $this->join( |
| 403 | 403 | [ |
| 404 | 404 | 'extend union', |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | ); |
| 413 | 413 | }, |
| 414 | 414 | |
| 415 | - NodeKind::ENUM_TYPE_EXTENSION => function (EnumTypeExtensionNode $def) { |
|
| 415 | + NodeKind::ENUM_TYPE_EXTENSION => function(EnumTypeExtensionNode $def) { |
|
| 416 | 416 | return $this->join( |
| 417 | 417 | [ |
| 418 | 418 | 'extend enum', |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | ); |
| 425 | 425 | }, |
| 426 | 426 | |
| 427 | - NodeKind::INPUT_OBJECT_TYPE_EXTENSION => function (InputObjectTypeExtensionNode $def) { |
|
| 427 | + NodeKind::INPUT_OBJECT_TYPE_EXTENSION => function(InputObjectTypeExtensionNode $def) { |
|
| 428 | 428 | return $this->join( |
| 429 | 429 | [ |
| 430 | 430 | 'extend input', |
@@ -436,8 +436,8 @@ discard block |
||
| 436 | 436 | ); |
| 437 | 437 | }, |
| 438 | 438 | |
| 439 | - NodeKind::DIRECTIVE_DEFINITION => $this->addDescription(function (DirectiveDefinitionNode $def) { |
|
| 440 | - $noIndent = Utils::every($def->arguments, static function (string $arg) { |
|
| 439 | + NodeKind::DIRECTIVE_DEFINITION => $this->addDescription(function(DirectiveDefinitionNode $def) { |
|
| 440 | + $noIndent = Utils::every($def->arguments, static function(string $arg) { |
|
| 441 | 441 | return strpos($arg, "\n") === false; |
| 442 | 442 | }); |
| 443 | 443 | |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | public function addDescription(callable $cb) |
| 457 | 457 | { |
| 458 | - return function ($node) use ($cb) { |
|
| 458 | + return function($node) use ($cb) { |
|
| 459 | 459 | return $this->join([$node->description, $cb($node)], "\n"); |
| 460 | 460 | }; |
| 461 | 461 | } |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | $separator, |
| 503 | 503 | Utils::filter( |
| 504 | 504 | $maybeArray, |
| 505 | - static function ($x) { |
|
| 505 | + static function($x) { |
|
| 506 | 506 | return (bool) $x; |
| 507 | 507 | } |
| 508 | 508 | ) |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | case 117: |
| 519 | 519 | $position = $this->position; |
| 520 | 520 | [$hex] = $this->readChars(4, true); |
| 521 | - if (! preg_match('/[0-9a-fA-F]{4}/', $hex)) { |
|
| 521 | + if (!preg_match('/[0-9a-fA-F]{4}/', $hex)) { |
|
| 522 | 522 | throw new SyntaxError( |
| 523 | 523 | $this->source, |
| 524 | 524 | $position - 1, |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | $highOrderByte = $code >> 8; |
| 533 | 533 | if (0xD8 <= $highOrderByte && $highOrderByte <= 0xDF) { |
| 534 | 534 | [$utf16Continuation] = $this->readChars(6, true); |
| 535 | - if (! preg_match('/^\\\u[0-9a-fA-F]{4}$/', $utf16Continuation)) { |
|
| 535 | + if (!preg_match('/^\\\u[0-9a-fA-F]{4}$/', $utf16Continuation)) { |
|
| 536 | 536 | throw new SyntaxError( |
| 537 | 537 | $this->source, |
| 538 | 538 | $this->position - 5, |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $this->expect($openKind); |
| 370 | 370 | |
| 371 | 371 | $nodes = []; |
| 372 | - while (! $this->skip($closeKind)) { |
|
| 372 | + while (!$this->skip($closeKind)) { |
|
| 373 | 373 | $nodes[] = $parseFn($this); |
| 374 | 374 | } |
| 375 | 375 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $this->expect($openKind); |
| 390 | 390 | |
| 391 | 391 | $nodes = [$parseFn($this)]; |
| 392 | - while (! $this->skip($closeKind)) { |
|
| 392 | + while (!$this->skip($closeKind)) { |
|
| 393 | 393 | $nodes[] = $parseFn($this); |
| 394 | 394 | } |
| 395 | 395 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | return new DocumentNode([ |
| 424 | 424 | 'definitions' => $this->many( |
| 425 | 425 | Token::SOF, |
| 426 | - function () { |
|
| 426 | + function() { |
|
| 427 | 427 | return $this->parseDefinition(); |
| 428 | 428 | }, |
| 429 | 429 | Token::EOF |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | return $this->peek(Token::PAREN_L) |
| 551 | 551 | ? $this->many( |
| 552 | 552 | Token::PAREN_L, |
| 553 | - function () { |
|
| 553 | + function() { |
|
| 554 | 554 | return $this->parseVariableDefinition(); |
| 555 | 555 | }, |
| 556 | 556 | Token::PAREN_R |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | [ |
| 602 | 602 | 'selections' => $this->many( |
| 603 | 603 | Token::BRACE_L, |
| 604 | - function () { |
|
| 604 | + function() { |
|
| 605 | 605 | return $this->parseSelection(); |
| 606 | 606 | }, |
| 607 | 607 | Token::BRACE_R |
@@ -656,10 +656,10 @@ discard block |
||
| 656 | 656 | private function parseArguments(bool $isConst) : NodeList |
| 657 | 657 | { |
| 658 | 658 | $parseFn = $isConst |
| 659 | - ? function () { |
|
| 659 | + ? function() { |
|
| 660 | 660 | return $this->parseConstArgument(); |
| 661 | 661 | } |
| 662 | - : function () { |
|
| 662 | + : function() { |
|
| 663 | 663 | return $this->parseArgument(); |
| 664 | 664 | }; |
| 665 | 665 | |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | break; |
| 857 | 857 | |
| 858 | 858 | case Token::DOLLAR: |
| 859 | - if (! $isConst) { |
|
| 859 | + if (!$isConst) { |
|
| 860 | 860 | return $this->parseVariable(); |
| 861 | 861 | } |
| 862 | 862 | break; |
@@ -897,9 +897,9 @@ discard block |
||
| 897 | 897 | private function parseArray(bool $isConst) : ListValueNode |
| 898 | 898 | { |
| 899 | 899 | $start = $this->lexer->token; |
| 900 | - $parseFn = $isConst ? function () { |
|
| 900 | + $parseFn = $isConst ? function() { |
|
| 901 | 901 | return $this->parseConstValue(); |
| 902 | - } : function () { |
|
| 902 | + } : function() { |
|
| 903 | 903 | return $this->parseVariableValue(); |
| 904 | 904 | }; |
| 905 | 905 | |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | $start = $this->lexer->token; |
| 917 | 917 | $this->expect(Token::BRACE_L); |
| 918 | 918 | $fields = []; |
| 919 | - while (! $this->skip(Token::BRACE_R)) { |
|
| 919 | + while (!$this->skip(Token::BRACE_R)) { |
|
| 920 | 920 | $fields[] = $this->parseObjectField($isConst); |
| 921 | 921 | } |
| 922 | 922 | |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | |
| 1091 | 1091 | $operationTypes = $this->many( |
| 1092 | 1092 | Token::BRACE_L, |
| 1093 | - function () { |
|
| 1093 | + function() { |
|
| 1094 | 1094 | return $this->parseOperationTypeDefinition(); |
| 1095 | 1095 | }, |
| 1096 | 1096 | Token::BRACE_R |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | $types[] = $this->parseNamedType(); |
| 1181 | 1181 | } while ($this->skip(Token::AMP) || |
| 1182 | 1182 | // Legacy support for the SDL? |
| 1183 | - (! empty($this->lexer->options['allowLegacySDLImplementsInterfaces']) && $this->peek(Token::NAME)) |
|
| 1183 | + (!empty($this->lexer->options['allowLegacySDLImplementsInterfaces']) && $this->peek(Token::NAME)) |
|
| 1184 | 1184 | ); |
| 1185 | 1185 | } |
| 1186 | 1186 | |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | private function parseFieldsDefinition() : NodeList |
| 1194 | 1194 | { |
| 1195 | 1195 | // Legacy support for the SDL? |
| 1196 | - if (! empty($this->lexer->options['allowLegacySDLEmptyFields']) |
|
| 1196 | + if (!empty($this->lexer->options['allowLegacySDLEmptyFields']) |
|
| 1197 | 1197 | && $this->peek(Token::BRACE_L) |
| 1198 | 1198 | && $this->lexer->lookahead()->kind === Token::BRACE_R |
| 1199 | 1199 | ) { |
@@ -1207,7 +1207,7 @@ discard block |
||
| 1207 | 1207 | $nodeList = $this->peek(Token::BRACE_L) |
| 1208 | 1208 | ? $this->many( |
| 1209 | 1209 | Token::BRACE_L, |
| 1210 | - function () { |
|
| 1210 | + function() { |
|
| 1211 | 1211 | return $this->parseFieldDefinition(); |
| 1212 | 1212 | }, |
| 1213 | 1213 | Token::BRACE_R |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | $nodeList = $this->peek(Token::PAREN_L) |
| 1251 | 1251 | ? $this->many( |
| 1252 | 1252 | Token::PAREN_L, |
| 1253 | - function () { |
|
| 1253 | + function() { |
|
| 1254 | 1254 | return $this->parseInputValueDefinition(); |
| 1255 | 1255 | }, |
| 1256 | 1256 | Token::PAREN_R |
@@ -1382,7 +1382,7 @@ discard block |
||
| 1382 | 1382 | $nodeList = $this->peek(Token::BRACE_L) |
| 1383 | 1383 | ? $this->many( |
| 1384 | 1384 | Token::BRACE_L, |
| 1385 | - function () { |
|
| 1385 | + function() { |
|
| 1386 | 1386 | return $this->parseEnumValueDefinition(); |
| 1387 | 1387 | }, |
| 1388 | 1388 | Token::BRACE_R |
@@ -1440,7 +1440,7 @@ discard block |
||
| 1440 | 1440 | $nodeList = $this->peek(Token::BRACE_L) |
| 1441 | 1441 | ? $this->many( |
| 1442 | 1442 | Token::BRACE_L, |
| 1443 | - function () { |
|
| 1443 | + function() { |
|
| 1444 | 1444 | return $this->parseInputValueDefinition(); |
| 1445 | 1445 | }, |
| 1446 | 1446 | Token::BRACE_R |
@@ -80,12 +80,12 @@ |
||
| 80 | 80 | // TODO: rework with generators when PHP minimum required version is changed to 5.5+ |
| 81 | 81 | $promisesOrValues = Utils::map( |
| 82 | 82 | $promisesOrValues, |
| 83 | - static function ($item) { |
|
| 83 | + static function($item) { |
|
| 84 | 84 | return $item instanceof Promise ? $item->adoptedPromise : $item; |
| 85 | 85 | } |
| 86 | 86 | ); |
| 87 | 87 | |
| 88 | - $promise = all($promisesOrValues)->then(static function ($values) use ($promisesOrValues) { |
|
| 88 | + $promise = all($promisesOrValues)->then(static function($values) use ($promisesOrValues) { |
|
| 89 | 89 | $orderedResults = []; |
| 90 | 90 | |
| 91 | 91 | foreach ($promisesOrValues as $key => $value) { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | public static function runQueue() : void |
| 42 | 42 | { |
| 43 | 43 | $q = self::$queue; |
| 44 | - while ($q !== null && ! $q->isEmpty()) { |
|
| 44 | + while ($q !== null && !$q->isEmpty()) { |
|
| 45 | 45 | $task = $q->dequeue(); |
| 46 | 46 | $task(); |
| 47 | 47 | } |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | if (is_object($value) && method_exists($value, 'then')) { |
| 58 | 58 | $value->then( |
| 59 | - function ($resolvedValue) { |
|
| 59 | + function($resolvedValue) { |
|
| 60 | 60 | $this->resolve($resolvedValue); |
| 61 | 61 | }, |
| 62 | - function ($reason) { |
|
| 62 | + function($reason) { |
|
| 63 | 63 | $this->reject($reason); |
| 64 | 64 | } |
| 65 | 65 | ); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | public function reject($reason) : self |
| 87 | 87 | { |
| 88 | - if (! $reason instanceof Throwable) { |
|
| 88 | + if (!$reason instanceof Throwable) { |
|
| 89 | 89 | throw new Exception('SyncPromise::reject() has to be called with an instance of \Throwable'); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | 117 | foreach ($this->waiting as $descriptor) { |
| 118 | - self::getQueue()->enqueue(function () use ($descriptor) { |
|
| 118 | + self::getQueue()->enqueue(function() use ($descriptor) { |
|
| 119 | 119 | /** @var self $promise */ |
| 120 | 120 | [$promise, $onFulfilled, $onRejected] = $descriptor; |
| 121 | 121 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function convertThenable($thenable) |
| 34 | 34 | { |
| 35 | - if (! $thenable instanceof Deferred) { |
|
| 35 | + if (!$thenable instanceof Deferred) { |
|
| 36 | 36 | throw new InvariantViolation('Expected instance of GraphQL\Deferred, got ' . Utils::printSafe($thenable)); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | if ($promiseOrValue instanceof Promise) { |
| 111 | 111 | $result[$index] = null; |
| 112 | 112 | $promiseOrValue->then( |
| 113 | - static function ($value) use ($index, &$count, $total, &$result, $all) { |
|
| 113 | + static function($value) use ($index, &$count, $total, &$result, $all) { |
|
| 114 | 114 | $result[$index] = $value; |
| 115 | 115 | $count++; |
| 116 | 116 | if ($count < $total) { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $promiseQueue = SyncPromise::getQueue(); |
| 146 | 146 | |
| 147 | 147 | while ($promise->adoptedPromise->state === SyncPromise::PENDING && |
| 148 | - ! ($dfdQueue->isEmpty() && $promiseQueue->isEmpty()) |
|
| 148 | + !($dfdQueue->isEmpty() && $promiseQueue->isEmpty()) |
|
| 149 | 149 | ) { |
| 150 | 150 | Deferred::runQueue(); |
| 151 | 151 | SyncPromise::runQueue(); |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function __construct($adoptedPromise, PromiseAdapter $adapter) |
| 26 | 26 | { |
| 27 | - Utils::invariant(! $adoptedPromise instanceof self, 'Expecting promise from adapted system, got ' . self::class); |
|
| 27 | + Utils::invariant(!$adoptedPromise instanceof self, 'Expecting promise from adapted system, got ' . self::class); |
|
| 28 | 28 | |
| 29 | 29 | $this->adapter = $adapter; |
| 30 | 30 | $this->adoptedPromise = $adoptedPromise; |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $result = []; |
| 140 | 140 | |
| 141 | - if (! empty($this->errors)) { |
|
| 142 | - $errorsHandler = $this->errorsHandler ?: static function (array $errors, callable $formatter) { |
|
| 141 | + if (!empty($this->errors)) { |
|
| 142 | + $errorsHandler = $this->errorsHandler ?: static function(array $errors, callable $formatter) { |
|
| 143 | 143 | return array_map($formatter, $errors); |
| 144 | 144 | }; |
| 145 | 145 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $result['data'] = $this->data; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if (! empty($this->extensions)) { |
|
| 156 | + if (!empty($this->extensions)) { |
|
| 157 | 157 | $result['extensions'] = $this->extensions; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -265,23 +265,23 @@ |
||
| 265 | 265 | ); |
| 266 | 266 | } elseif ($hasValue) { |
| 267 | 267 | if ($argumentValueNode instanceof NullValueNode) { |
| 268 | - // If the explicit value `null` was provided, an entry in the coerced |
|
| 269 | - // values must exist as the value `null`. |
|
| 268 | + // If the explicit value `null` was provided, an entry in the coerced |
|
| 269 | + // values must exist as the value `null`. |
|
| 270 | 270 | $coercedValues[$name] = null; |
| 271 | 271 | } elseif ($argumentValueNode instanceof VariableNode) { |
| 272 | 272 | $variableName = $argumentValueNode->name->value; |
| 273 | 273 | Utils::invariant($variableValues !== null, 'Must exist for hasValue to be true.'); |
| 274 | - // Note: This does no further checking that this variable is correct. |
|
| 275 | - // This assumes that this query has been validated and the variable |
|
| 276 | - // usage here is of the correct type. |
|
| 274 | + // Note: This does no further checking that this variable is correct. |
|
| 275 | + // This assumes that this query has been validated and the variable |
|
| 276 | + // usage here is of the correct type. |
|
| 277 | 277 | $coercedValues[$name] = $variableValues[$variableName] ?? null; |
| 278 | 278 | } else { |
| 279 | 279 | $valueNode = $argumentValueNode; |
| 280 | 280 | $coercedValue = AST::valueFromAST($valueNode, $argType, $variableValues); |
| 281 | 281 | if (Utils::isInvalid($coercedValue)) { |
| 282 | - // Note: ValuesOfCorrectType validation should catch this before |
|
| 283 | - // execution. This is a runtime check to ensure execution does not |
|
| 284 | - // continue with an invalid argument value. |
|
| 282 | + // Note: ValuesOfCorrectType validation should catch this before |
|
| 283 | + // execution. This is a runtime check to ensure execution does not |
|
| 284 | + // continue with an invalid argument value. |
|
| 285 | 285 | throw new Error( |
| 286 | 286 | 'Argument "' . $name . '" has invalid value ' . Printer::doPrint($valueNode) . '.', |
| 287 | 287 | [$argumentValueNode] |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | /** @var InputType|Type $varType */ |
| 68 | 68 | $varType = TypeInfo::typeFromAST($schema, $varDefNode->type); |
| 69 | 69 | |
| 70 | - if (! Type::isInputType($varType)) { |
|
| 70 | + if (!Type::isInputType($varType)) { |
|
| 71 | 71 | // Must use input types for variables. This should be caught during |
| 72 | 72 | // validation, however is checked again here for safety. |
| 73 | 73 | $errors[] = new Error( |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | $hasValue = array_key_exists($varName, $inputs); |
| 83 | 83 | $value = $hasValue ? $inputs[$varName] : Utils::undefined(); |
| 84 | 84 | |
| 85 | - if (! $hasValue && $varDefNode->defaultValue) { |
|
| 85 | + if (!$hasValue && $varDefNode->defaultValue) { |
|
| 86 | 86 | // If no value was provided to a variable with a default value, |
| 87 | 87 | // use the default value. |
| 88 | 88 | $coercedValues[$varName] = AST::valueFromAST($varDefNode->defaultValue, $varType); |
| 89 | - } elseif ((! $hasValue || $value === null) && ($varType instanceof NonNull)) { |
|
| 89 | + } elseif ((!$hasValue || $value === null) && ($varType instanceof NonNull)) { |
|
| 90 | 90 | // If no value or a nullish value was provided to a variable with a |
| 91 | 91 | // non-null type (required), produce an error. |
| 92 | 92 | $errors[] = new Error( |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if (! empty($errors)) { |
|
| 139 | + if (!empty($errors)) { |
|
| 140 | 140 | return [$errors, null]; |
| 141 | 141 | } |
| 142 | 142 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | if (isset($node->directives) && $node->directives instanceof NodeList) { |
| 161 | 161 | $directiveNode = Utils::find( |
| 162 | 162 | $node->directives, |
| 163 | - static function (DirectiveNode $directive) use ($directiveDef) { |
|
| 163 | + static function(DirectiveNode $directive) use ($directiveDef) { |
|
| 164 | 164 | return $directive->name->value === $directiveDef->name; |
| 165 | 165 | } |
| 166 | 166 | ); |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | $isNull = $argumentValueNode instanceof NullValueNode; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - if (! $hasValue && $argumentDefinition->defaultValueExists()) { |
|
| 236 | + if (!$hasValue && $argumentDefinition->defaultValueExists()) { |
|
| 237 | 237 | // If no argument was provided where the definition has a default value, |
| 238 | 238 | // use the default value. |
| 239 | 239 | $coercedValues[$name] = $argumentDefinition->defaultValue; |
| 240 | - } elseif ((! $hasValue || $isNull) && ($argType instanceof NonNull)) { |
|
| 240 | + } elseif ((!$hasValue || $isNull) && ($argType instanceof NonNull)) { |
|
| 241 | 241 | // If no argument or a null value was provided to an argument with a |
| 242 | 242 | // non-null type (required), produce a field error. |
| 243 | 243 | if ($isNull) { |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | return $errors |
| 329 | 329 | ? array_map( |
| 330 | - static function (Throwable $error) { |
|
| 330 | + static function(Throwable $error) { |
|
| 331 | 331 | return $error->getMessage(); |
| 332 | 332 | }, |
| 333 | 333 | $errors |