@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | public function testInternalVariableArgument() |
| 17 | 17 | { |
| 18 | - $schema = new Schema([ |
|
| 18 | + $schema = new Schema([ |
|
| 19 | 19 | 'query' => new ObjectType([ |
| 20 | 20 | 'name' => 'RootQuery', |
| 21 | 21 | 'fields' => [ |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | ])), |
| 37 | 37 | ], |
| 38 | 38 | ]), |
| 39 | - 'resolve' => function () { |
|
| 39 | + 'resolve' => function() { |
|
| 40 | 40 | return [ |
| 41 | 41 | 'id' => 1, |
| 42 | 42 | 'name' => 'John', |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | 'description' => 'latest description', |
| 137 | 137 | 'deprecationReason' => 'for test', |
| 138 | 138 | 'isDeprecated' => true, |
| 139 | - 'resolve' => function () { |
|
| 139 | + 'resolve' => function() { |
|
| 140 | 140 | return [ |
| 141 | 141 | 'id' => 1, |
| 142 | 142 | 'name' => 'Alex' |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | ['name' => 'String', 'fields' => null], |
| 203 | 203 | ['name' => '__Schema', 'fields' => [['name' => 'queryType', 'args' => []], ['name' => 'mutationType', 'args' => []], ['name' => 'subscriptionType', 'args' => []], ['name' => 'types', 'args' => []], ['name' => 'directives', 'args' => []]]], |
| 204 | 204 | ['name' => '__Type', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'kind', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'ofType', 'args' => []], ['name' => 'inputFields', 'args' => []], ['name' => 'enumValues', 'args' => [['defaultValue' => 'false']]], ['name' => 'fields', 'args' => [['defaultValue' => 'false']]], ['name' => 'interfaces', 'args' => []], ['name' => 'possibleTypes', 'args' => []]]], |
| 205 | - ['name' => '__InputValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'defaultValue', 'args' => []],]], |
|
| 205 | + ['name' => '__InputValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'defaultValue', 'args' => []], ]], |
|
| 206 | 206 | ['name' => 'Boolean', 'fields' => null], |
| 207 | - ['name' => '__EnumValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'isDeprecated', 'args' => []],]], |
|
| 207 | + ['name' => '__EnumValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ]], |
|
| 208 | 208 | ['name' => '__Field', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'args', 'args' => []]]], |
| 209 | 209 | ['name' => '__Directive', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'args', 'args' => []], ['name' => 'locations', 'args' => []]]], |
| 210 | 210 | ['name' => '__DirectiveLocation', 'fields' => null], |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | 'id' => ['type' => new IntType()], |
| 293 | 293 | 'name' => ['type' => new IntType()], |
| 294 | 294 | ], |
| 295 | - 'resolveType' => function ($type) { |
|
| 295 | + 'resolveType' => function($type) { |
|
| 296 | 296 | |
| 297 | 297 | } |
| 298 | 298 | ]); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $unionType = new UnionType([ |
| 321 | 321 | 'name' => 'UnionType', |
| 322 | 322 | 'types' => [$object1, $object2], |
| 323 | - 'resolveType' => function () { |
|
| 323 | + 'resolveType' => function() { |
|
| 324 | 324 | |
| 325 | 325 | } |
| 326 | 326 | ]); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | 'args' => [ |
| 332 | 332 | 'id' => ['type' => TypeMap::TYPE_INT] |
| 333 | 333 | ], |
| 334 | - 'resolve' => function () { |
|
| 334 | + 'resolve' => function() { |
|
| 335 | 335 | return [ |
| 336 | 336 | 'id' => 1, |
| 337 | 337 | 'name' => 'Alex' |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | ] |
| 358 | 358 | ]) |
| 359 | 359 | ], |
| 360 | - 'resolve' => function () { |
|
| 360 | + 'resolve' => function() { |
|
| 361 | 361 | return null; |
| 362 | 362 | } |
| 363 | 363 | ])); |
@@ -194,6 +194,9 @@ discard block |
||
| 194 | 194 | return new Token($this->getKeyword($value), $this->getLine(), $this->getColumn(), $value); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | + /** |
|
| 198 | + * @param string $name |
|
| 199 | + */ |
|
| 197 | 200 | protected function getKeyword($name) |
| 198 | 201 | { |
| 199 | 202 | switch ($name) { |
@@ -273,6 +276,9 @@ discard block |
||
| 273 | 276 | } |
| 274 | 277 | } |
| 275 | 278 | |
| 279 | + /** |
|
| 280 | + * @param string $message |
|
| 281 | + */ |
|
| 276 | 282 | protected function createException($message) |
| 277 | 283 | { |
| 278 | 284 | return new SyntaxErrorException(sprintf('%s', $message), $this->getLocation()); |
@@ -253,9 +253,9 @@ discard block |
||
| 253 | 253 | $value = substr($this->source, $start, $this->pos - $start); |
| 254 | 254 | |
| 255 | 255 | if (strpos($value, '.') === false) { |
| 256 | - $value = (int) $value; |
|
| 256 | + $value = (int)$value; |
|
| 257 | 257 | } else { |
| 258 | - $value = (float) $value; |
|
| 258 | + $value = (float)$value; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | return new Token(Token::TYPE_NUMBER, $this->getLine(), $this->getColumn(), $value); |
@@ -311,10 +311,10 @@ discard block |
||
| 311 | 311 | return $token; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - if($ch === '\\' && ($this->pos < ($len - 1))) { |
|
| 314 | + if ($ch === '\\' && ($this->pos < ($len - 1))) { |
|
| 315 | 315 | $this->pos++; |
| 316 | 316 | $ch = $this->source[$this->pos]; |
| 317 | - switch($ch) { |
|
| 317 | + switch ($ch) { |
|
| 318 | 318 | case '"': |
| 319 | 319 | case '\\': |
| 320 | 320 | case '/': |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | break; |
| 334 | 334 | case 'u': |
| 335 | 335 | $codepoint = substr($this->source, $this->pos + 1, 4); |
| 336 | - if( !preg_match('/[0-9A-Fa-f]{4}/', $codepoint)) { |
|
| 336 | + if (!preg_match('/[0-9A-Fa-f]{4}/', $codepoint)) { |
|
| 337 | 337 | throw $this->createException(sprintf('Invalid string unicode escape sequece "%s"', $codepoint)); |
| 338 | 338 | } |
| 339 | 339 | $ch = html_entity_decode("&#x{$codepoint};", ENT_QUOTES, 'UTF-8'); |
@@ -24,6 +24,10 @@ discard block |
||
| 24 | 24 | use Youshido\GraphQL\Parser\Token; |
| 25 | 25 | |
| 26 | 26 | class TokenizerTestingParser extends Parser { |
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @param string $source |
|
| 30 | + */ |
|
| 27 | 31 | public function initTokenizerForTesting($source) { |
| 28 | 32 | $this->initTokenizer($source); |
| 29 | 33 | } |
@@ -102,6 +106,9 @@ discard block |
||
| 102 | 106 | ]); |
| 103 | 107 | } |
| 104 | 108 | |
| 109 | + /** |
|
| 110 | + * @param string $graphQLString |
|
| 111 | + */ |
|
| 105 | 112 | private function tokenizeStringContents($graphQLString) { |
| 106 | 113 | $parser = new TokenizerTestingParser(); |
| 107 | 114 | $parser->initTokenizerForTesting('"' . $graphQLString . '"'); |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | |
| 105 | 105 | private function tokenizeStringContents($graphQLString) { |
| 106 | 106 | $parser = new TokenizerTestingParser(); |
| 107 | - $parser->initTokenizerForTesting('"' . $graphQLString . '"'); |
|
| 107 | + $parser->initTokenizerForTesting('"'.$graphQLString.'"'); |
|
| 108 | 108 | |
| 109 | 109 | return $parser->getTokenForTesting(); |
| 110 | 110 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $edgeFields = !empty($config['edgeFields']) ? $config['edgeFields'] : []; |
| 55 | 55 | |
| 56 | 56 | $edgeType = new ObjectType([ |
| 57 | - 'name' => $name . 'Edge', |
|
| 57 | + 'name' => $name.'Edge', |
|
| 58 | 58 | 'description' => 'An edge in a connection.', |
| 59 | 59 | 'fields' => array_merge([ |
| 60 | 60 | 'totalCount' => [ |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $connectionFields = !empty($config['connectionFields']) ? $config['connectionFields'] : []; |
| 92 | 92 | |
| 93 | 93 | $connectionType = new ObjectType([ |
| 94 | - 'name' => $name . 'Connection', |
|
| 94 | + 'name' => $name.'Connection', |
|
| 95 | 95 | 'description' => 'A connection to a list of items.', |
| 96 | 96 | 'fields' => array_merge([ |
| 97 | 97 | 'pageInfo' => [ |