@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @return mixed |
| 126 | 126 | * @throws SyntaxErrorException |
| 127 | 127 | */ |
| 128 | - $buildValue = function (LexerInterface $lexer) { |
|
| 128 | + $buildValue = function(LexerInterface $lexer) { |
|
| 129 | 129 | $this->expect($lexer, TokenKindEnum::COLON); |
| 130 | 130 | return $this->buildValueLiteral($lexer); |
| 131 | 131 | }; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @return mixed |
| 153 | 153 | * @throws SyntaxErrorException |
| 154 | 154 | */ |
| 155 | - $buildValue = function (LexerInterface $lexer) { |
|
| 155 | + $buildValue = function(LexerInterface $lexer) { |
|
| 156 | 156 | $this->expect($lexer, TokenKindEnum::COLON); |
| 157 | 157 | return $this->buildValueLiteral($lexer); |
| 158 | 158 | }; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | protected function buildArgumentsDefinition(LexerInterface $lexer): ?array |
| 174 | 174 | { |
| 175 | - $buildFunction = function (LexerInterface $lexer): array { |
|
| 175 | + $buildFunction = function(LexerInterface $lexer): array { |
|
| 176 | 176 | return $this->buildInputValueDefinition($lexer); |
| 177 | 177 | }; |
| 178 | 178 | |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | |
| 641 | 641 | $this->expectKeyword($lexer, KeywordEnum::FRAGMENT); |
| 642 | 642 | |
| 643 | - $buildTypeCondition = function (LexerInterface $lexer) { |
|
| 643 | + $buildTypeCondition = function(LexerInterface $lexer) { |
|
| 644 | 644 | $this->expectKeyword($lexer, 'on'); |
| 645 | 645 | return $this->buildNamedType($lexer); |
| 646 | 646 | }; |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | */ |
| 701 | 701 | protected function buildInputFieldsDefinition(LexerInterface $lexer): ?array |
| 702 | 702 | { |
| 703 | - $buildFunction = function (LexerInterface $lexer): array { |
|
| 703 | + $buildFunction = function(LexerInterface $lexer): array { |
|
| 704 | 704 | return $this->buildInputValueDefinition($lexer); |
| 705 | 705 | }; |
| 706 | 706 | |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | { |
| 1358 | 1358 | $start = $lexer->getToken(); |
| 1359 | 1359 | |
| 1360 | - $buildValue = function (LexerInterface $lexer, bool $isConst) { |
|
| 1360 | + $buildValue = function(LexerInterface $lexer, bool $isConst) { |
|
| 1361 | 1361 | $this->expect($lexer, TokenKindEnum::COLON); |
| 1362 | 1362 | |
| 1363 | 1363 | return $this->buildValueLiteral($lexer, $isConst); |
@@ -1415,7 +1415,7 @@ discard block |
||
| 1415 | 1415 | * @return mixed |
| 1416 | 1416 | * @throws SyntaxErrorException |
| 1417 | 1417 | */ |
| 1418 | - $buildType = function (LexerInterface $lexer) { |
|
| 1418 | + $buildType = function(LexerInterface $lexer) { |
|
| 1419 | 1419 | $this->expect($lexer, TokenKindEnum::COLON); |
| 1420 | 1420 | |
| 1421 | 1421 | return $this->buildTypeReference($lexer); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | return $coercedValues; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - $argumentNodeMap = keyMap($argumentNodes, function (ArgumentNode $value) { |
|
| 59 | + $argumentNodeMap = keyMap($argumentNodes, function(ArgumentNode $value) { |
|
| 60 | 60 | return $value->getNameValue(); |
| 61 | 61 | }); |
| 62 | 62 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | array $variableValues = [] |
| 132 | 132 | ): ?array { |
| 133 | 133 | $directiveNode = $node->hasDirectives() |
| 134 | - ? find($node->getDirectives(), function (NameAwareInterface $value) use ($directive) { |
|
| 134 | + ? find($node->getDirectives(), function(NameAwareInterface $value) use ($directive) { |
|
| 135 | 135 | return $value->getNameValue() === $directive->getName(); |
| 136 | 136 | }) : null; |
| 137 | 137 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | ]); |
| 330 | 330 | } |
| 331 | 331 | return new CoercedValue($parseResult, null); |
| 332 | - } catch (InvalidTypeException|CoercingException $ex) { |
|
| 332 | + } catch (InvalidTypeException | CoercingException $ex) { |
|
| 333 | 333 | return new CoercedValue(null, [ |
| 334 | 334 | $this->buildCoerceException( |
| 335 | 335 | sprintf('Expected type %s', (string)$type), |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - $suggestions = suggestionList((string)$value, array_map(function (EnumValue $enumValue) { |
|
| 366 | + $suggestions = suggestionList((string)$value, array_map(function(EnumValue $enumValue) { |
|
| 367 | 367 | return $enumValue->getName(); |
| 368 | 368 | }, $type->getValues())); |
| 369 | 369 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | protected function registerIntrospectionTypes() |
| 59 | 59 | { |
| 60 | - $this->container->add(GraphQL::SCHEMA_INTROSPECTION, function () { |
|
| 60 | + $this->container->add(GraphQL::SCHEMA_INTROSPECTION, function() { |
|
| 61 | 61 | return newObjectType([ |
| 62 | 62 | 'name' => GraphQL::SCHEMA_INTROSPECTION, |
| 63 | 63 | 'isIntrospection' => true, |
@@ -65,19 +65,19 @@ discard block |
||
| 65 | 65 | 'A GraphQL Schema defines the capabilities of a GraphQL server. It ' . |
| 66 | 66 | 'exposes all available types and directives on the server, as well as ' . |
| 67 | 67 | 'the entry points for query, mutation, and subscription operations.', |
| 68 | - 'fields' => function () { |
|
| 68 | + 'fields' => function() { |
|
| 69 | 69 | return [ |
| 70 | 70 | 'types' => [ |
| 71 | 71 | 'description' => 'A list of all types supported by this server.', |
| 72 | 72 | 'type' => newNonNull(newList(newNonNull(__Type()))), |
| 73 | - 'resolve' => function (SchemaInterface $schema): array { |
|
| 73 | + 'resolve' => function(SchemaInterface $schema): array { |
|
| 74 | 74 | return array_values($schema->getTypeMap()); |
| 75 | 75 | }, |
| 76 | 76 | ], |
| 77 | 77 | 'queryType' => [ |
| 78 | 78 | 'description' => 'The type that query operations will be rooted at.', |
| 79 | 79 | 'type' => newNonNull(__Type()), |
| 80 | - 'resolve' => function (SchemaInterface $schema): ?TypeInterface { |
|
| 80 | + 'resolve' => function(SchemaInterface $schema): ?TypeInterface { |
|
| 81 | 81 | return $schema->getQueryType(); |
| 82 | 82 | }, |
| 83 | 83 | ], |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | 'If this server supports mutation, the type that ' . |
| 87 | 87 | 'mutation operations will be rooted at.', |
| 88 | 88 | 'type' => __Type(), |
| 89 | - 'resolve' => function (SchemaInterface $schema): ?TypeInterface { |
|
| 89 | + 'resolve' => function(SchemaInterface $schema): ?TypeInterface { |
|
| 90 | 90 | return $schema->getMutationType(); |
| 91 | 91 | }, |
| 92 | 92 | ], |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | 'If this server support subscription, the type that ' . |
| 96 | 96 | 'subscription operations will be rooted at.', |
| 97 | 97 | 'type' => __Type(), |
| 98 | - 'resolve' => function (SchemaInterface $schema): ?TypeInterface { |
|
| 98 | + 'resolve' => function(SchemaInterface $schema): ?TypeInterface { |
|
| 99 | 99 | return $schema->getSubscriptionType(); |
| 100 | 100 | }, |
| 101 | 101 | ], |
| 102 | 102 | 'directives' => [ |
| 103 | 103 | 'description' => 'A list of all directives supported by this server.', |
| 104 | 104 | 'type' => newNonNull(newList(newNonNull(__Directive()))), |
| 105 | - 'resolve' => function (SchemaInterface $schema): array { |
|
| 105 | + 'resolve' => function(SchemaInterface $schema): array { |
|
| 106 | 106 | return $schema->getDirectives(); |
| 107 | 107 | }, |
| 108 | 108 | ], |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | ]); |
| 112 | 112 | }, true/* $shared */); |
| 113 | 113 | |
| 114 | - $this->container->add(GraphQL::DIRECTIVE_INTROSPECTION, function () { |
|
| 114 | + $this->container->add(GraphQL::DIRECTIVE_INTROSPECTION, function() { |
|
| 115 | 115 | return newObjectType([ |
| 116 | 116 | 'name' => GraphQL::DIRECTIVE_INTROSPECTION, |
| 117 | 117 | 'isIntrospection' => true, |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | 'execution behavior in ways field arguments will not suffice, such as ' . |
| 123 | 123 | 'conditionally including or skipping a field. Directives provide this by ' . |
| 124 | 124 | 'describing additional information to the executor.', |
| 125 | - 'fields' => function () { |
|
| 125 | + 'fields' => function() { |
|
| 126 | 126 | return [ |
| 127 | 127 | 'name' => ['type' => newNonNull(String())], |
| 128 | 128 | 'description' => ['type' => String()], |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | ], |
| 132 | 132 | 'args' => [ |
| 133 | 133 | 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
| 134 | - 'resolve' => function (DirectiveInterface $directive): array { |
|
| 134 | + 'resolve' => function(DirectiveInterface $directive): array { |
|
| 135 | 135 | return $directive->getArguments() ?: []; |
| 136 | 136 | }, |
| 137 | 137 | ], |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | ]); |
| 141 | 141 | }, true/* $shared */); |
| 142 | 142 | |
| 143 | - $this->container->add(GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, function () { |
|
| 143 | + $this->container->add(GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, function() { |
|
| 144 | 144 | return newEnumType([ |
| 145 | 145 | 'name' => GraphQL::DIRECTIVE_LOCATION_INTROSPECTION, |
| 146 | 146 | 'isIntrospection' => true, |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | ]); |
| 207 | 207 | }, true/* $shared */); |
| 208 | 208 | |
| 209 | - $this->container->add(GraphQL::TYPE_INTROSPECTION, function () { |
|
| 209 | + $this->container->add(GraphQL::TYPE_INTROSPECTION, function() { |
|
| 210 | 210 | return newObjectType([ |
| 211 | 211 | 'name' => GraphQL::TYPE_INTROSPECTION, |
| 212 | 212 | 'isIntrospection' => true, |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | 'Object and Interface types provide the fields they describe. Abstract ' . |
| 220 | 220 | 'types, Union and Interface, provide the Object types possible ' . |
| 221 | 221 | 'at runtime. List and NonNull types compose other types.', |
| 222 | - 'fields' => function () { |
|
| 222 | + 'fields' => function() { |
|
| 223 | 223 | return [ |
| 224 | 224 | 'kind' => [ |
| 225 | 225 | 'type' => newNonNull(__TypeKind()), |
| 226 | - 'resolve' => function (TypeInterface $type) { |
|
| 226 | + 'resolve' => function(TypeInterface $type) { |
|
| 227 | 227 | if ($type instanceof ScalarType) { |
| 228 | 228 | return TypeKindEnum::SCALAR; |
| 229 | 229 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | 'args' => [ |
| 260 | 260 | 'includeDeprecated' => ['type' => Boolean(), 'defaultValue' => false], |
| 261 | 261 | ], |
| 262 | - 'resolve' => function (TypeInterface $type, array $args): |
|
| 262 | + 'resolve' => function(TypeInterface $type, array $args): |
|
| 263 | 263 | ?array { |
| 264 | 264 | ['includeDeprecated' => $includeDeprecated] = $args; |
| 265 | 265 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $fields = array_values($type->getFields()); |
| 268 | 268 | |
| 269 | 269 | if (!$includeDeprecated) { |
| 270 | - $fields = array_filter($fields, function (Field $field) { |
|
| 270 | + $fields = array_filter($fields, function(Field $field) { |
|
| 271 | 271 | return !$field->getIsDeprecated(); |
| 272 | 272 | }); |
| 273 | 273 | } |
@@ -280,13 +280,13 @@ discard block |
||
| 280 | 280 | ], |
| 281 | 281 | 'interfaces' => [ |
| 282 | 282 | 'type' => newList(newNonNull(__Type())), |
| 283 | - 'resolve' => function (TypeInterface $type): ?array { |
|
| 283 | + 'resolve' => function(TypeInterface $type): ?array { |
|
| 284 | 284 | return $type instanceof ObjectType ? $type->getInterfaces() : null; |
| 285 | 285 | }, |
| 286 | 286 | ], |
| 287 | 287 | 'possibleTypes' => [ |
| 288 | 288 | 'type' => newList(newNonNull(__Type())), |
| 289 | - 'resolve' => function ( |
|
| 289 | + 'resolve' => function( |
|
| 290 | 290 | TypeInterface $type, |
| 291 | 291 | array $args, |
| 292 | 292 | array $context, |
@@ -304,14 +304,14 @@ discard block |
||
| 304 | 304 | 'args' => [ |
| 305 | 305 | 'includeDeprecated' => ['type' => Boolean(), 'defaultValue' => false], |
| 306 | 306 | ], |
| 307 | - 'resolve' => function (TypeInterface $type, array $args): ?array { |
|
| 307 | + 'resolve' => function(TypeInterface $type, array $args): ?array { |
|
| 308 | 308 | ['includeDeprecated' => $includeDeprecated] = $args; |
| 309 | 309 | |
| 310 | 310 | if ($type instanceof EnumType) { |
| 311 | 311 | $values = array_values($type->getValues()); |
| 312 | 312 | |
| 313 | 313 | if (!$includeDeprecated) { |
| 314 | - $values = array_filter($values, function (Field $field) { |
|
| 314 | + $values = array_filter($values, function(Field $field) { |
|
| 315 | 315 | return !$field->getIsDeprecated(); |
| 316 | 316 | }); |
| 317 | 317 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | ], |
| 325 | 325 | 'inputFields' => [ |
| 326 | 326 | 'type' => newList(newNonNull(__InputValue())), |
| 327 | - 'resolve' => function (TypeInterface $type): ?array { |
|
| 327 | + 'resolve' => function(TypeInterface $type): ?array { |
|
| 328 | 328 | return $type instanceof InputObjectType ? $type->getFields() : null; |
| 329 | 329 | }, |
| 330 | 330 | ], |
@@ -334,20 +334,20 @@ discard block |
||
| 334 | 334 | ]); |
| 335 | 335 | }, true/* $shared */); |
| 336 | 336 | |
| 337 | - $this->container->add(GraphQL::FIELD_INTROSPECTION, function () { |
|
| 337 | + $this->container->add(GraphQL::FIELD_INTROSPECTION, function() { |
|
| 338 | 338 | return newObjectType([ |
| 339 | 339 | 'name' => GraphQL::FIELD_INTROSPECTION, |
| 340 | 340 | 'isIntrospection' => true, |
| 341 | 341 | 'description' => |
| 342 | 342 | 'Object and Interface types are described by a list of Fields, each of ' . |
| 343 | 343 | 'which has a name, potentially a list of arguments, and a return type.', |
| 344 | - 'fields' => function () { |
|
| 344 | + 'fields' => function() { |
|
| 345 | 345 | return [ |
| 346 | 346 | 'name' => ['type' => newNonNull(String())], |
| 347 | 347 | 'description' => ['type' => String()], |
| 348 | 348 | 'args' => [ |
| 349 | 349 | 'type' => newNonNull(newList(newNonNull(__InputValue()))), |
| 350 | - 'resolve' => function (ArgumentsAwareInterface $directive): array { |
|
| 350 | + 'resolve' => function(ArgumentsAwareInterface $directive): array { |
|
| 351 | 351 | return $directive->getArguments() ?? []; |
| 352 | 352 | }, |
| 353 | 353 | ], |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | ]); |
| 360 | 360 | }, true/* $shared */); |
| 361 | 361 | |
| 362 | - $this->container->add(GraphQL::INPUT_VALUE_INTROSPECTION, function () { |
|
| 362 | + $this->container->add(GraphQL::INPUT_VALUE_INTROSPECTION, function() { |
|
| 363 | 363 | return newObjectType([ |
| 364 | 364 | 'name' => GraphQL::INPUT_VALUE_INTROSPECTION, |
| 365 | 365 | 'isIntrospection' => true, |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | 'Arguments provided to Fields or Directives and the input fields of an ' . |
| 368 | 368 | 'InputObject are represented as Input Values which describe their type ' . |
| 369 | 369 | 'and optionally a default value.', |
| 370 | - 'fields' => function () { |
|
| 370 | + 'fields' => function() { |
|
| 371 | 371 | return [ |
| 372 | 372 | 'name' => ['type' => newNonNull(String())], |
| 373 | 373 | 'description' => ['type' => String()], |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | 'description' => |
| 378 | 378 | 'A GraphQL-formatted string representing the default value for this ' . |
| 379 | 379 | 'input value.', |
| 380 | - 'resolve' => function ($inputValue) { |
|
| 380 | + 'resolve' => function($inputValue) { |
|
| 381 | 381 | // TODO: Implement this when we have support for printing AST. |
| 382 | 382 | return null; |
| 383 | 383 | } |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | ]); |
| 388 | 388 | }, true/* $shared */); |
| 389 | 389 | |
| 390 | - $this->container->add(GraphQL::ENUM_VALUE_INTROSPECTION, function () { |
|
| 390 | + $this->container->add(GraphQL::ENUM_VALUE_INTROSPECTION, function() { |
|
| 391 | 391 | return newObjectType([ |
| 392 | 392 | 'name' => GraphQL::ENUM_VALUE_INTROSPECTION, |
| 393 | 393 | 'isIntrospection' => true, |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | 'One possible value for a given Enum. Enum values are unique values, not ' . |
| 396 | 396 | 'a placeholder for a string or numeric value. However an Enum value is ' . |
| 397 | 397 | 'returned in a JSON response as a string.', |
| 398 | - 'fields' => function () { |
|
| 398 | + 'fields' => function() { |
|
| 399 | 399 | return [ |
| 400 | 400 | 'name' => ['type' => newNonNull(String())], |
| 401 | 401 | 'description' => ['type' => String()], |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | ]); |
| 407 | 407 | }, true/* $shared */); |
| 408 | 408 | |
| 409 | - $this->container->add(GraphQL::TYPE_KIND_INTROSPECTION, function () { |
|
| 409 | + $this->container->add(GraphQL::TYPE_KIND_INTROSPECTION, function() { |
|
| 410 | 410 | return newEnumType([ |
| 411 | 411 | 'name' => GraphQL::TYPE_KIND_INTROSPECTION, |
| 412 | 412 | 'isIntrospection' => true, |
@@ -446,19 +446,19 @@ discard block |
||
| 446 | 446 | */ |
| 447 | 447 | protected function registerMetaFields() |
| 448 | 448 | { |
| 449 | - $this->container->add(GraphQL::SCHEMA_META_FIELD_DEFINITION, function ($__Schema) { |
|
| 449 | + $this->container->add(GraphQL::SCHEMA_META_FIELD_DEFINITION, function($__Schema) { |
|
| 450 | 450 | return new Field([ |
| 451 | 451 | 'name' => '__schema', |
| 452 | 452 | 'type' => newNonNull($__Schema), |
| 453 | 453 | 'description' => 'Access the current type schema of this server.', |
| 454 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): SchemaInterface { |
|
| 454 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): SchemaInterface { |
|
| 455 | 455 | return $info->getSchema(); |
| 456 | 456 | } |
| 457 | 457 | ]); |
| 458 | 458 | }) |
| 459 | 459 | ->withArgument(GraphQL::SCHEMA_INTROSPECTION); |
| 460 | 460 | |
| 461 | - $this->container->add(GraphQL::TYPE_META_FIELD_DEFINITION, function ($__Type) { |
|
| 461 | + $this->container->add(GraphQL::TYPE_META_FIELD_DEFINITION, function($__Type) { |
|
| 462 | 462 | return new Field([ |
| 463 | 463 | 'name' => '__type', |
| 464 | 464 | 'type' => $__Type, |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | 'args' => [ |
| 467 | 467 | 'name' => ['type' => newNonNull(String())], |
| 468 | 468 | ], |
| 469 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): TypeInterface { |
|
| 469 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): TypeInterface { |
|
| 470 | 470 | ['name' => $name] = $args; |
| 471 | 471 | $schema = $info->getSchema(); |
| 472 | 472 | return $schema->getType($name); |
@@ -475,12 +475,12 @@ discard block |
||
| 475 | 475 | }) |
| 476 | 476 | ->withArgument(GraphQL::TYPE_INTROSPECTION); |
| 477 | 477 | |
| 478 | - $this->container->add(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, function () { |
|
| 478 | + $this->container->add(GraphQL::TYPE_NAME_META_FIELD_DEFINITION, function() { |
|
| 479 | 479 | return new Field([ |
| 480 | 480 | 'name' => '__typename', |
| 481 | 481 | 'type' => newNonNull(String()), |
| 482 | 482 | 'description' => 'The name of the current Object type at runtime.', |
| 483 | - 'resolve' => function ($source, $args, $context, ResolveInfo $info): string { |
|
| 483 | + 'resolve' => function($source, $args, $context, ResolveInfo $info): string { |
|
| 484 | 484 | $parentType = $info->getParentType(); |
| 485 | 485 | return null !== $parentType ? $parentType->getName() : null; |
| 486 | 486 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | public function getTypeResolver(): ?callable |
| 27 | 27 | { |
| 28 | - return function ($rootValue, $contextValues, ResolveInfo $info) { |
|
| 28 | + return function($rootValue, $contextValues, ResolveInfo $info) { |
|
| 29 | 29 | return $this->resolveType($rootValue, $contextValues, $info); |
| 30 | 30 | }; |
| 31 | 31 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $builtInTypes = keyMap( |
| 98 | 98 | \array_merge(specifiedScalarTypes(), introspectionTypes()), |
| 99 | - function (NamedTypeInterface $type) { |
|
| 99 | + function(NamedTypeInterface $type) { |
|
| 100 | 100 | return $type->getName(); |
| 101 | 101 | } |
| 102 | 102 | ); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function buildTypes(array $nodes): array |
| 113 | 113 | { |
| 114 | - return \array_map(function (NodeInterface $node) { |
|
| 114 | + return \array_map(function(NodeInterface $node) { |
|
| 115 | 115 | return $this->buildType($node); |
| 116 | 116 | }, $nodes); |
| 117 | 117 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | return newDirective([ |
| 148 | 148 | 'name' => $node->getNameValue(), |
| 149 | 149 | 'description' => $node->getDescriptionValue(), |
| 150 | - 'locations' => \array_map(function (NameNode $node) { |
|
| 150 | + 'locations' => \array_map(function(NameNode $node) { |
|
| 151 | 151 | return $node->getValue(); |
| 152 | 152 | }, $node->getLocations()), |
| 153 | 153 | 'args' => $node->hasArguments() ? $this->buildArguments($node->getArguments()) : [], |
@@ -191,10 +191,10 @@ discard block |
||
| 191 | 191 | { |
| 192 | 192 | return keyValueMap( |
| 193 | 193 | $nodes, |
| 194 | - function (InputValueDefinitionNode $value) { |
|
| 194 | + function(InputValueDefinitionNode $value) { |
|
| 195 | 195 | return $value->getNameValue(); |
| 196 | 196 | }, |
| 197 | - function (InputValueDefinitionNode $value): array { |
|
| 197 | + function(InputValueDefinitionNode $value): array { |
|
| 198 | 198 | $type = $this->buildWrappedType($value->getType()); |
| 199 | 199 | $defaultValue = $value->getDefaultValue(); |
| 200 | 200 | return [ |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | return newObjectType([ |
| 247 | 247 | 'name' => $node->getNameValue(), |
| 248 | 248 | 'description' => $node->getDescriptionValue(), |
| 249 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
| 249 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
| 250 | 250 | return $this->buildFields($node); |
| 251 | 251 | } : [], |
| 252 | 252 | // Note: While this could make early assertions to get the correctly |
| 253 | 253 | // typed values, that would throw immediately while type system |
| 254 | 254 | // validation with validateSchema() will produce more actionable results. |
| 255 | - 'interfaces' => function () use ($node) { |
|
| 256 | - return $node->hasInterfaces() ? \array_map(function (NodeInterface $interface) { |
|
| 255 | + 'interfaces' => function() use ($node) { |
|
| 256 | + return $node->hasInterfaces() ? \array_map(function(NodeInterface $interface) { |
|
| 257 | 257 | return $this->buildType($interface); |
| 258 | 258 | }, $node->getInterfaces()) : []; |
| 259 | 259 | }, |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | { |
| 270 | 270 | return keyValueMap( |
| 271 | 271 | $node->getFields(), |
| 272 | - function ($value) { |
|
| 272 | + function($value) { |
|
| 273 | 273 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
| 274 | 274 | return $value->getNameValue(); |
| 275 | 275 | }, |
| 276 | - function ($value) use ($node) { |
|
| 276 | + function($value) use ($node) { |
|
| 277 | 277 | /** @var FieldDefinitionNode|InputValueDefinitionNode $value */ |
| 278 | 278 | return $this->buildField($value, $this->getFieldResolver($node->getNameValue(), $value->getNameValue())); |
| 279 | 279 | } |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | return newInterfaceType([ |
| 302 | 302 | 'name' => $node->getNameValue(), |
| 303 | 303 | 'description' => $node->getDescriptionValue(), |
| 304 | - 'fields' => $node->hasFields() ? function () use ($node): array { |
|
| 304 | + 'fields' => $node->hasFields() ? function() use ($node) : array { |
|
| 305 | 305 | return $this->buildFields($node); |
| 306 | 306 | } : [], |
| 307 | 307 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -320,10 +320,10 @@ discard block |
||
| 320 | 320 | 'description' => $node->getDescriptionValue(), |
| 321 | 321 | 'values' => $node->hasValues() ? keyValueMap( |
| 322 | 322 | $node->getValues(), |
| 323 | - function (EnumValueDefinitionNode $value): string { |
|
| 323 | + function(EnumValueDefinitionNode $value): string { |
|
| 324 | 324 | return $value->getNameValue(); |
| 325 | 325 | }, |
| 326 | - function (EnumValueDefinitionNode $value): array { |
|
| 326 | + function(EnumValueDefinitionNode $value): array { |
|
| 327 | 327 | return [ |
| 328 | 328 | 'description' => $value->getDescriptionValue(), |
| 329 | 329 | 'deprecationReason' => $this->getDeprecationReason($value), |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | return newUnionType([ |
| 345 | 345 | 'name' => $node->getNameValue(), |
| 346 | 346 | 'description' => $node->getDescriptionValue(), |
| 347 | - 'types' => $node->hasTypes() ? \array_map(function (TypeNodeInterface $type) { |
|
| 347 | + 'types' => $node->hasTypes() ? \array_map(function(TypeNodeInterface $type) { |
|
| 348 | 348 | return $this->buildType($type); |
| 349 | 349 | }, $node->getTypes()) : [], |
| 350 | 350 | 'resolveType' => $this->getTypeResolver($node->getNameValue()), |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | return newScalarType([ |
| 373 | 373 | 'name' => $node->getNameValue(), |
| 374 | 374 | 'description' => $node->getDescriptionValue(), |
| 375 | - 'serialize' => function ($value) { |
|
| 375 | + 'serialize' => function($value) { |
|
| 376 | 376 | return $value; |
| 377 | 377 | }, |
| 378 | 378 | 'astNode' => $node, |
@@ -388,13 +388,13 @@ discard block |
||
| 388 | 388 | return newInputObjectType([ |
| 389 | 389 | 'name' => $node->getNameValue(), |
| 390 | 390 | 'description' => $node->getDescriptionValue(), |
| 391 | - 'fields' => $node->hasFields() ? function () use ($node) { |
|
| 391 | + 'fields' => $node->hasFields() ? function() use ($node) { |
|
| 392 | 392 | return keyValueMap( |
| 393 | 393 | $node->getFields(), |
| 394 | - function (InputValueDefinitionNode $value): string { |
|
| 394 | + function(InputValueDefinitionNode $value): string { |
|
| 395 | 395 | return $value->getNameValue(); |
| 396 | 396 | }, |
| 397 | - function (InputValueDefinitionNode $value): array { |
|
| 397 | + function(InputValueDefinitionNode $value): array { |
|
| 398 | 398 | $type = $this->buildWrappedType($value->getType()); |
| 399 | 399 | $defaultValue = $value->getDefaultValue(); |
| 400 | 400 | return [ |
@@ -15,11 +15,11 @@ |
||
| 15 | 15 | * @return Token |
| 16 | 16 | */ |
| 17 | 17 | public function read( |
| 18 | - int $code, |
|
| 19 | - int $pos, |
|
| 20 | - int $line, |
|
| 21 | - int $col, |
|
| 22 | - Token $prev |
|
| 18 | + int $code, |
|
| 19 | + int $pos, |
|
| 20 | + int $line, |
|
| 21 | + int $col, |
|
| 22 | + Token $prev |
|
| 23 | 23 | ): Token; |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -35,11 +35,11 @@ discard block |
||
| 35 | 35 | * @inheritdoc |
| 36 | 36 | */ |
| 37 | 37 | public function read( |
| 38 | - int $code, |
|
| 39 | - int $pos, |
|
| 40 | - int $line, |
|
| 41 | - int $col, |
|
| 42 | - Token $prev |
|
| 38 | + int $code, |
|
| 39 | + int $pos, |
|
| 40 | + int $line, |
|
| 41 | + int $col, |
|
| 42 | + Token $prev |
|
| 43 | 43 | ): Token { |
| 44 | 44 | switch ($code) { |
| 45 | 45 | case 33: // ! |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | * @return Token |
| 108 | 108 | */ |
| 109 | 109 | protected function readName( |
| 110 | - int $code, |
|
| 111 | - int $pos, |
|
| 112 | - int $line, |
|
| 113 | - int $col, |
|
| 114 | - Token $prev |
|
| 110 | + int $code, |
|
| 111 | + int $pos, |
|
| 112 | + int $line, |
|
| 113 | + int $col, |
|
| 114 | + Token $prev |
|
| 115 | 115 | ): Token { |
| 116 | 116 | $body = $this->lexer->getBody(); |
| 117 | 117 | $bodyLength = mb_strlen($body); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | return new Token(TokenKindEnum::NAME, $start, $pos, $line, $col, $prev, |
| 127 | - sliceString($body, $start, $pos)); |
|
| 127 | + sliceString($body, $start, $pos)); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | * @throws SyntaxErrorException |
| 138 | 138 | */ |
| 139 | 139 | protected function readBlockString( |
| 140 | - int $code, |
|
| 141 | - int $pos, |
|
| 142 | - int $line, |
|
| 143 | - int $col, |
|
| 144 | - Token $prev |
|
| 140 | + int $code, |
|
| 141 | + int $pos, |
|
| 142 | + int $line, |
|
| 143 | + int $col, |
|
| 144 | + Token $prev |
|
| 145 | 145 | ): Token { |
| 146 | 146 | $body = $this->lexer->getBody(); |
| 147 | 147 | $bodyLength = mb_strlen($body); |
@@ -157,21 +157,21 @@ discard block |
||
| 157 | 157 | $rawValue .= sliceString($body, $chunkStart, $pos); |
| 158 | 158 | |
| 159 | 159 | return new Token( |
| 160 | - TokenKindEnum::BLOCK_STRING, |
|
| 161 | - $start, |
|
| 162 | - $pos + 3, |
|
| 163 | - $line, |
|
| 164 | - $col, |
|
| 165 | - $prev, |
|
| 166 | - blockStringValue($rawValue) |
|
| 160 | + TokenKindEnum::BLOCK_STRING, |
|
| 161 | + $start, |
|
| 162 | + $pos + 3, |
|
| 163 | + $line, |
|
| 164 | + $col, |
|
| 165 | + $prev, |
|
| 166 | + blockStringValue($rawValue) |
|
| 167 | 167 | ); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | if (isSourceCharacter($code)) { |
| 171 | 171 | throw new SyntaxErrorException( |
| 172 | - $this->lexer->getSource(), |
|
| 173 | - $pos, |
|
| 174 | - sprintf('Invalid character within String: %s', |
|
| 172 | + $this->lexer->getSource(), |
|
| 173 | + $pos, |
|
| 174 | + sprintf('Invalid character within String: %s', |
|
| 175 | 175 | printCharCode($code)) |
| 176 | 176 | ); |
| 177 | 177 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | throw new SyntaxErrorException($this->lexer->getSource(), $pos, |
| 189 | - 'Unterminated string.'); |
|
| 189 | + 'Unterminated string.'); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -199,11 +199,11 @@ discard block |
||
| 199 | 199 | * @throws SyntaxErrorException |
| 200 | 200 | */ |
| 201 | 201 | protected function readNumber( |
| 202 | - int $code, |
|
| 203 | - int $pos, |
|
| 204 | - int $line, |
|
| 205 | - int $col, |
|
| 206 | - Token $prev |
|
| 202 | + int $code, |
|
| 203 | + int $pos, |
|
| 204 | + int $line, |
|
| 205 | + int $col, |
|
| 206 | + Token $prev |
|
| 207 | 207 | ): Token { |
| 208 | 208 | $body = $this->lexer->getBody(); |
| 209 | 209 | $start = $pos; |
@@ -219,9 +219,9 @@ discard block |
||
| 219 | 219 | $code = charCodeAt($body, ++$pos); |
| 220 | 220 | if (isNumber($code)) { |
| 221 | 221 | throw new SyntaxErrorException( |
| 222 | - $this->lexer->getSource(), |
|
| 223 | - $pos, |
|
| 224 | - sprintf('Invalid number, unexpected digit after 0: %s.', |
|
| 222 | + $this->lexer->getSource(), |
|
| 223 | + $pos, |
|
| 224 | + sprintf('Invalid number, unexpected digit after 0: %s.', |
|
| 225 | 225 | printCharCode($code)) |
| 226 | 226 | ); |
| 227 | 227 | } |
@@ -252,13 +252,13 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | return new Token( |
| 255 | - $isFloat ? TokenKindEnum::FLOAT : TokenKindEnum::INT, |
|
| 256 | - $start, |
|
| 257 | - $pos, |
|
| 258 | - $line, |
|
| 259 | - $col, |
|
| 260 | - $prev, |
|
| 261 | - sliceString($body, $start, $pos) |
|
| 255 | + $isFloat ? TokenKindEnum::FLOAT : TokenKindEnum::INT, |
|
| 256 | + $start, |
|
| 257 | + $pos, |
|
| 258 | + $line, |
|
| 259 | + $col, |
|
| 260 | + $prev, |
|
| 261 | + sliceString($body, $start, $pos) |
|
| 262 | 262 | ); |
| 263 | 263 | } |
| 264 | 264 | |
@@ -272,11 +272,11 @@ discard block |
||
| 272 | 272 | * @throws SyntaxErrorException |
| 273 | 273 | */ |
| 274 | 274 | protected function readString( |
| 275 | - int $code, |
|
| 276 | - int $pos, |
|
| 277 | - int $line, |
|
| 278 | - int $col, |
|
| 279 | - Token $prev |
|
| 275 | + int $code, |
|
| 276 | + int $pos, |
|
| 277 | + int $line, |
|
| 278 | + int $col, |
|
| 279 | + Token $prev |
|
| 280 | 280 | ): Token { |
| 281 | 281 | $body = $this->lexer->getBody(); |
| 282 | 282 | $bodyLength = mb_strlen($body); |
@@ -292,14 +292,14 @@ discard block |
||
| 292 | 292 | $value .= sliceString($body, $chunkStart, $pos); |
| 293 | 293 | |
| 294 | 294 | return new Token(TokenKindEnum::STRING, $start, $pos + 1, $line, |
| 295 | - $col, $prev, $value); |
|
| 295 | + $col, $prev, $value); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | if ($this->isSourceCharacter($code)) { |
| 299 | 299 | throw new SyntaxErrorException( |
| 300 | - $this->lexer->getSource(), |
|
| 301 | - $pos, |
|
| 302 | - sprintf('Invalid character within String: %s', |
|
| 300 | + $this->lexer->getSource(), |
|
| 301 | + $pos, |
|
| 302 | + sprintf('Invalid character within String: %s', |
|
| 303 | 303 | printCharCode($code)) |
| 304 | 304 | ); |
| 305 | 305 | } |
@@ -339,19 +339,19 @@ discard block |
||
| 339 | 339 | case 117: |
| 340 | 340 | // u |
| 341 | 341 | $charCode = uniCharCode( |
| 342 | - charCodeAt($body, $pos + 1), |
|
| 343 | - charCodeAt($body, $pos + 2), |
|
| 344 | - charCodeAt($body, $pos + 3), |
|
| 345 | - charCodeAt($body, $pos + 4) |
|
| 342 | + charCodeAt($body, $pos + 1), |
|
| 343 | + charCodeAt($body, $pos + 2), |
|
| 344 | + charCodeAt($body, $pos + 3), |
|
| 345 | + charCodeAt($body, $pos + 4) |
|
| 346 | 346 | ); |
| 347 | 347 | if ($charCode < 0) { |
| 348 | 348 | throw new SyntaxErrorException( |
| 349 | - $this->lexer->getSource(), |
|
| 350 | - $pos, |
|
| 351 | - sprintf( |
|
| 349 | + $this->lexer->getSource(), |
|
| 350 | + $pos, |
|
| 351 | + sprintf( |
|
| 352 | 352 | 'Invalid character escape sequence: \\u%s', |
| 353 | 353 | sliceString($body, $pos + 1, $pos + 5) |
| 354 | - ) |
|
| 354 | + ) |
|
| 355 | 355 | ); |
| 356 | 356 | } |
| 357 | 357 | $value .= chr($charCode); |
@@ -359,9 +359,9 @@ discard block |
||
| 359 | 359 | break; |
| 360 | 360 | default: |
| 361 | 361 | throw new SyntaxErrorException( |
| 362 | - $this->lexer->getSource(), |
|
| 363 | - $pos, |
|
| 364 | - sprintf('Invalid character escape sequence: \\%s', |
|
| 362 | + $this->lexer->getSource(), |
|
| 363 | + $pos, |
|
| 364 | + sprintf('Invalid character escape sequence: \\%s', |
|
| 365 | 365 | chr($code)) |
| 366 | 366 | ); |
| 367 | 367 | } |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | throw new SyntaxErrorException($this->lexer->getSource(), $pos, |
| 375 | - 'Unterminated string.'); |
|
| 375 | + 'Unterminated string.'); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | /** |
@@ -384,14 +384,14 @@ discard block |
||
| 384 | 384 | * @return Token |
| 385 | 385 | */ |
| 386 | 386 | protected function readSpread( |
| 387 | - int $code, |
|
| 388 | - int $pos, |
|
| 389 | - int $line, |
|
| 390 | - int $col, |
|
| 391 | - Token $prev |
|
| 387 | + int $code, |
|
| 388 | + int $pos, |
|
| 389 | + int $line, |
|
| 390 | + int $col, |
|
| 391 | + Token $prev |
|
| 392 | 392 | ): Token { |
| 393 | 393 | return new Token(TokenKindEnum::SPREAD, $pos, $pos + 3, $line, $col, |
| 394 | - $prev); |
|
| 394 | + $prev); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | /** |
@@ -403,14 +403,14 @@ discard block |
||
| 403 | 403 | * @return Token |
| 404 | 404 | */ |
| 405 | 405 | protected function readDollar( |
| 406 | - int $code, |
|
| 407 | - int $pos, |
|
| 408 | - int $line, |
|
| 409 | - int $col, |
|
| 410 | - Token $prev |
|
| 406 | + int $code, |
|
| 407 | + int $pos, |
|
| 408 | + int $line, |
|
| 409 | + int $col, |
|
| 410 | + Token $prev |
|
| 411 | 411 | ): Token { |
| 412 | 412 | return new Token(TokenKindEnum::DOLLAR, $pos, $pos + 1, $line, $col, |
| 413 | - $prev); |
|
| 413 | + $prev); |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | /** |
@@ -422,14 +422,14 @@ discard block |
||
| 422 | 422 | * @return Token |
| 423 | 423 | */ |
| 424 | 424 | protected function readPipe( |
| 425 | - int $code, |
|
| 426 | - int $pos, |
|
| 427 | - int $line, |
|
| 428 | - int $col, |
|
| 429 | - Token $prev |
|
| 425 | + int $code, |
|
| 426 | + int $pos, |
|
| 427 | + int $line, |
|
| 428 | + int $col, |
|
| 429 | + Token $prev |
|
| 430 | 430 | ): Token { |
| 431 | 431 | return new Token(TokenKindEnum::PIPE, $pos, $pos + 1, $line, $col, |
| 432 | - $prev); |
|
| 432 | + $prev); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -441,11 +441,11 @@ discard block |
||
| 441 | 441 | * @return Token |
| 442 | 442 | */ |
| 443 | 443 | protected function readParenthesis( |
| 444 | - int $code, |
|
| 445 | - int $pos, |
|
| 446 | - int $line, |
|
| 447 | - int $col, |
|
| 448 | - Token $prev |
|
| 444 | + int $code, |
|
| 445 | + int $pos, |
|
| 446 | + int $line, |
|
| 447 | + int $col, |
|
| 448 | + Token $prev |
|
| 449 | 449 | ): Token { |
| 450 | 450 | return $code === 40 |
| 451 | 451 | ? new Token(TokenKindEnum::PAREN_L, $pos, $pos + 1, $line, $col, |
@@ -463,14 +463,14 @@ discard block |
||
| 463 | 463 | * @return Token |
| 464 | 464 | */ |
| 465 | 465 | protected function readEquals( |
| 466 | - int $code, |
|
| 467 | - int $pos, |
|
| 468 | - int $line, |
|
| 469 | - int $col, |
|
| 470 | - Token $prev |
|
| 466 | + int $code, |
|
| 467 | + int $pos, |
|
| 468 | + int $line, |
|
| 469 | + int $col, |
|
| 470 | + Token $prev |
|
| 471 | 471 | ): Token { |
| 472 | 472 | return new Token(TokenKindEnum::EQUALS, $pos, $pos + 1, $line, $col, |
| 473 | - $prev); |
|
| 473 | + $prev); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | /** |
@@ -482,11 +482,11 @@ discard block |
||
| 482 | 482 | * @return Token |
| 483 | 483 | */ |
| 484 | 484 | protected function readAt( |
| 485 | - int $code, |
|
| 486 | - int $pos, |
|
| 487 | - int $line, |
|
| 488 | - int $col, |
|
| 489 | - Token $prev |
|
| 485 | + int $code, |
|
| 486 | + int $pos, |
|
| 487 | + int $line, |
|
| 488 | + int $col, |
|
| 489 | + Token $prev |
|
| 490 | 490 | ): Token { |
| 491 | 491 | return new Token(TokenKindEnum::AT, $pos, $pos + 1, $line, $col, $prev); |
| 492 | 492 | } |
@@ -500,11 +500,11 @@ discard block |
||
| 500 | 500 | * @return Token |
| 501 | 501 | */ |
| 502 | 502 | protected function readComment( |
| 503 | - int $code, |
|
| 504 | - int $pos, |
|
| 505 | - int $line, |
|
| 506 | - int $col, |
|
| 507 | - Token $prev |
|
| 503 | + int $code, |
|
| 504 | + int $pos, |
|
| 505 | + int $line, |
|
| 506 | + int $col, |
|
| 507 | + Token $prev |
|
| 508 | 508 | ): Token { |
| 509 | 509 | $body = $this->lexer->getBody(); |
| 510 | 510 | $start = $pos; |
@@ -514,13 +514,13 @@ discard block |
||
| 514 | 514 | } while ($code !== null && ($code > 0x001f || $code === 0x0009)); // SourceCharacter but not LineTerminator |
| 515 | 515 | |
| 516 | 516 | return new Token( |
| 517 | - TokenKindEnum::COMMENT, |
|
| 518 | - $start, |
|
| 519 | - $pos, |
|
| 520 | - $line, |
|
| 521 | - $col, |
|
| 522 | - $prev, |
|
| 523 | - sliceString($body, $start + 1, $pos) |
|
| 517 | + TokenKindEnum::COMMENT, |
|
| 518 | + $start, |
|
| 519 | + $pos, |
|
| 520 | + $line, |
|
| 521 | + $col, |
|
| 522 | + $prev, |
|
| 523 | + sliceString($body, $start + 1, $pos) |
|
| 524 | 524 | ); |
| 525 | 525 | } |
| 526 | 526 | |
@@ -533,14 +533,14 @@ discard block |
||
| 533 | 533 | * @return Token |
| 534 | 534 | */ |
| 535 | 535 | protected function readColon( |
| 536 | - int $code, |
|
| 537 | - int $pos, |
|
| 538 | - int $line, |
|
| 539 | - int $col, |
|
| 540 | - Token $prev |
|
| 536 | + int $code, |
|
| 537 | + int $pos, |
|
| 538 | + int $line, |
|
| 539 | + int $col, |
|
| 540 | + Token $prev |
|
| 541 | 541 | ): Token { |
| 542 | 542 | return new Token(TokenKindEnum::COLON, $pos, $pos + 1, $line, $col, |
| 543 | - $prev); |
|
| 543 | + $prev); |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | /** |
@@ -552,14 +552,14 @@ discard block |
||
| 552 | 552 | * @return Token |
| 553 | 553 | */ |
| 554 | 554 | protected function readAmp( |
| 555 | - int $code, |
|
| 556 | - int $pos, |
|
| 557 | - int $line, |
|
| 558 | - int $col, |
|
| 559 | - Token $prev |
|
| 555 | + int $code, |
|
| 556 | + int $pos, |
|
| 557 | + int $line, |
|
| 558 | + int $col, |
|
| 559 | + Token $prev |
|
| 560 | 560 | ): Token { |
| 561 | 561 | return new Token(TokenKindEnum::AMP, $pos, $pos + 1, $line, $col, |
| 562 | - $prev); |
|
| 562 | + $prev); |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | /** |
@@ -571,14 +571,14 @@ discard block |
||
| 571 | 571 | * @return Token |
| 572 | 572 | */ |
| 573 | 573 | protected function readBang( |
| 574 | - int $code, |
|
| 575 | - int $pos, |
|
| 576 | - int $line, |
|
| 577 | - int $col, |
|
| 578 | - Token $prev |
|
| 574 | + int $code, |
|
| 575 | + int $pos, |
|
| 576 | + int $line, |
|
| 577 | + int $col, |
|
| 578 | + Token $prev |
|
| 579 | 579 | ): Token { |
| 580 | 580 | return new Token(TokenKindEnum::BANG, $pos, $pos + 1, $line, $col, |
| 581 | - $prev); |
|
| 581 | + $prev); |
|
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | /** |
@@ -590,11 +590,11 @@ discard block |
||
| 590 | 590 | * @return Token |
| 591 | 591 | */ |
| 592 | 592 | protected function readBrace( |
| 593 | - int $code, |
|
| 594 | - int $pos, |
|
| 595 | - int $line, |
|
| 596 | - int $col, |
|
| 597 | - Token $prev |
|
| 593 | + int $code, |
|
| 594 | + int $pos, |
|
| 595 | + int $line, |
|
| 596 | + int $col, |
|
| 597 | + Token $prev |
|
| 598 | 598 | ): Token { |
| 599 | 599 | return $code === 123 |
| 600 | 600 | ? new Token(TokenKindEnum::BRACE_L, $pos, $pos + 1, $line, $col, |
@@ -612,11 +612,11 @@ discard block |
||
| 612 | 612 | * @return Token |
| 613 | 613 | */ |
| 614 | 614 | protected function readBracket( |
| 615 | - int $code, |
|
| 616 | - int $pos, |
|
| 617 | - int $line, |
|
| 618 | - int $col, |
|
| 619 | - Token $prev |
|
| 615 | + int $code, |
|
| 616 | + int $pos, |
|
| 617 | + int $line, |
|
| 618 | + int $col, |
|
| 619 | + Token $prev |
|
| 620 | 620 | ): Token { |
| 621 | 621 | return $code === 91 |
| 622 | 622 | ? new Token(TokenKindEnum::BRACKET_L, $pos, $pos + 1, $line, $col, |
@@ -644,9 +644,9 @@ discard block |
||
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | throw new SyntaxErrorException( |
| 647 | - $this->lexer->getSource(), |
|
| 648 | - $pos, |
|
| 649 | - sprintf('Invalid number, expected digit but got: %s', |
|
| 647 | + $this->lexer->getSource(), |
|
| 648 | + $pos, |
|
| 649 | + sprintf('Invalid number, expected digit but got: %s', |
|
| 650 | 650 | printCharCode($code)) |
| 651 | 651 | ); |
| 652 | 652 | } |
@@ -696,9 +696,9 @@ discard block |
||
| 696 | 696 | * @return bool |
| 697 | 697 | */ |
| 698 | 698 | protected function isEscapedTripleQuote( |
| 699 | - string $body, |
|
| 700 | - int $code, |
|
| 701 | - int $pos |
|
| 699 | + string $body, |
|
| 700 | + int $code, |
|
| 701 | + int $pos |
|
| 702 | 702 | ): bool { |
| 703 | 703 | return $code === 92 && |
| 704 | 704 | charCodeAt($body, $pos + 1) === 34 && |