@@ -121,15 +121,15 @@ |
||
121 | 121 | return DataSource::findComments($story->id, $args['limit'], $args['after']); |
122 | 122 | } |
123 | 123 | |
124 | - public function resolveMentions(Story $story, $args, AppContext $context){ |
|
124 | + public function resolveMentions(Story $story, $args, AppContext $context) { |
|
125 | 125 | return DataSource::findStoryMentions($story->id); |
126 | 126 | } |
127 | 127 | |
128 | - public function resolveLikedBy(Story $story, $args, AppContext $context){ |
|
129 | - return DataSource::findLikes($story->id,10); |
|
128 | + public function resolveLikedBy(Story $story, $args, AppContext $context) { |
|
129 | + return DataSource::findLikes($story->id, 10); |
|
130 | 130 | } |
131 | 131 | |
132 | - public function resolveLikes(Story $story, $args, AppContext $context){ |
|
133 | - return DataSource::findLikes($story->id,10); |
|
132 | + public function resolveLikes(Story $story, $args, AppContext $context) { |
|
133 | + return DataSource::findLikes($story->id, 10); |
|
134 | 134 | } |
135 | 135 | } |
@@ -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 |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | if (Type::isCompositeType($initialType)) { |
95 | 95 | $this->parentTypeStack[] = $initialType; |
96 | 96 | } |
97 | - if (! Type::isOutputType($initialType)) { |
|
97 | + if (!Type::isOutputType($initialType)) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | |
@@ -149,17 +149,17 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public static function extractTypes($type, ?array $typeMap = null) |
151 | 151 | { |
152 | - if (! $typeMap) { |
|
152 | + if (!$typeMap) { |
|
153 | 153 | $typeMap = []; |
154 | 154 | } |
155 | - if (! $type) { |
|
155 | + if (!$type) { |
|
156 | 156 | return $typeMap; |
157 | 157 | } |
158 | 158 | |
159 | 159 | if ($type instanceof WrappingType) { |
160 | 160 | return self::extractTypes($type->getWrappedType(true), $typeMap); |
161 | 161 | } |
162 | - if (! $type instanceof Type) { |
|
162 | + if (!$type instanceof Type) { |
|
163 | 163 | // Preserve these invalid types in map (at numeric index) to make them |
164 | 164 | // detectable during $schema->validate() |
165 | 165 | $i = 0; |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | $alreadyInMap = $alreadyInMap || $typeMap[$i] === $type; |
169 | 169 | $i++; |
170 | 170 | } |
171 | - if (! $alreadyInMap) { |
|
171 | + if (!$alreadyInMap) { |
|
172 | 172 | $typeMap[$i] = $type; |
173 | 173 | } |
174 | 174 | |
175 | 175 | return $typeMap; |
176 | 176 | } |
177 | 177 | |
178 | - if (! empty($typeMap[$type->name])) { |
|
178 | + if (!empty($typeMap[$type->name])) { |
|
179 | 179 | Utils::invariant( |
180 | 180 | $typeMap[$type->name] === $type, |
181 | 181 | sprintf('Schema must contain unique named types but contains multiple types named "%s" ', $type) . |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | } |
197 | 197 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
198 | 198 | foreach ($type->getFields() as $fieldName => $field) { |
199 | - if (! empty($field->args)) { |
|
199 | + if (!empty($field->args)) { |
|
200 | 200 | $fieldArgTypes = array_map( |
201 | - static function (FieldArgument $arg) { |
|
201 | + static function(FieldArgument $arg) { |
|
202 | 202 | return $arg->getType(); |
203 | 203 | }, |
204 | 204 | $field->args |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | /** @var FieldArgument $argDef */ |
324 | 324 | $argDef = Utils::find( |
325 | 325 | $fieldOrDirective->args, |
326 | - static function ($arg) use ($node) { |
|
326 | + static function($arg) use ($node) { |
|
327 | 327 | return $arg->name === $node->name->value; |
328 | 328 | } |
329 | 329 | ); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function getVisitor(ValidationContext $context) |
29 | 29 | { |
30 | 30 | return [ |
31 | - NodeKind::ARGUMENT => static function (ArgumentNode $node, $key, $parent, $path, $ancestors) use ($context) { |
|
31 | + NodeKind::ARGUMENT => static function(ArgumentNode $node, $key, $parent, $path, $ancestors) use ($context) { |
|
32 | 32 | $argDef = $context->getArgument(); |
33 | 33 | if ($argDef !== null) { |
34 | 34 | return null; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | Utils::suggestionList( |
49 | 49 | $node->name->value, |
50 | 50 | array_map( |
51 | - static function ($arg) { |
|
51 | + static function($arg) { |
|
52 | 52 | return $arg->name; |
53 | 53 | }, |
54 | 54 | $fieldDef->args |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | Utils::suggestionList( |
69 | 69 | $node->name->value, |
70 | 70 | array_map( |
71 | - static function ($arg) { |
|
71 | + static function($arg) { |
|
72 | 72 | return $arg->name; |
73 | 73 | }, |
74 | 74 | $directive->args |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public static function unknownArgMessage($argName, $fieldName, $typeName, array $suggestedArgs) |
90 | 90 | { |
91 | 91 | $message = sprintf('Unknown argument "%s" on field "%s" of type "%s".', $argName, $fieldName, $typeName); |
92 | - if (! empty($suggestedArgs)) { |
|
92 | + if (!empty($suggestedArgs)) { |
|
93 | 93 | $message .= sprintf(' Did you mean %s?', Utils::quotedOrList($suggestedArgs)); |
94 | 94 | } |
95 | 95 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | public static function unknownDirectiveArgMessage($argName, $directiveName, array $suggestedArgs) |
103 | 103 | { |
104 | 104 | $message = sprintf('Unknown argument "%s" on directive "@%s".', $argName, $directiveName); |
105 | - if (! empty($suggestedArgs)) { |
|
105 | + if (!empty($suggestedArgs)) { |
|
106 | 106 | $message .= sprintf(' Did you mean %s?', Utils::quotedOrList($suggestedArgs)); |
107 | 107 | } |
108 | 108 |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | |
46 | 46 | foreach ($definedDirectives as $directive) { |
47 | 47 | $requiredArgsMap[$directive->name] = Utils::keyMap( |
48 | - array_filter($directive->args, static function (FieldArgument $arg) : bool { |
|
49 | - return $arg->getType() instanceof NonNull && ! isset($arg->defaultValue); |
|
48 | + array_filter($directive->args, static function(FieldArgument $arg) : bool { |
|
49 | + return $arg->getType() instanceof NonNull && !isset($arg->defaultValue); |
|
50 | 50 | }), |
51 | - static function (FieldArgument $arg) : string { |
|
51 | + static function(FieldArgument $arg) : string { |
|
52 | 52 | return $arg->name; |
53 | 53 | } |
54 | 54 | ); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $astDefinition = $context->getDocument()->definitions; |
58 | 58 | foreach ($astDefinition as $def) { |
59 | - if (! ($def instanceof DirectiveDefinitionNode)) { |
|
59 | + if (!($def instanceof DirectiveDefinitionNode)) { |
|
60 | 60 | continue; |
61 | 61 | } |
62 | 62 | |
@@ -70,32 +70,32 @@ discard block |
||
70 | 70 | |
71 | 71 | $requiredArgsMap[$def->name->value] = Utils::keyMap( |
72 | 72 | $arguments |
73 | - ? array_filter($arguments, static function (Node $argument) : bool { |
|
73 | + ? array_filter($arguments, static function(Node $argument) : bool { |
|
74 | 74 | return $argument instanceof NonNullTypeNode && |
75 | 75 | ( |
76 | - ! isset($argument->defaultValue) || |
|
76 | + !isset($argument->defaultValue) || |
|
77 | 77 | $argument->defaultValue === null |
78 | 78 | ); |
79 | 79 | }) |
80 | 80 | : [], |
81 | - static function (NamedTypeNode $argument) : string { |
|
81 | + static function(NamedTypeNode $argument) : string { |
|
82 | 82 | return $argument->name->value; |
83 | 83 | } |
84 | 84 | ); |
85 | 85 | } |
86 | 86 | |
87 | 87 | return [ |
88 | - NodeKind::DIRECTIVE => static function (DirectiveNode $directiveNode) use ($requiredArgsMap, $context) { |
|
88 | + NodeKind::DIRECTIVE => static function(DirectiveNode $directiveNode) use ($requiredArgsMap, $context) { |
|
89 | 89 | $directiveName = $directiveNode->name->value; |
90 | 90 | $requiredArgs = $requiredArgsMap[$directiveName] ?? null; |
91 | - if (! $requiredArgs) { |
|
91 | + if (!$requiredArgs) { |
|
92 | 92 | return null; |
93 | 93 | } |
94 | 94 | |
95 | 95 | $argNodes = $directiveNode->arguments ?: []; |
96 | 96 | $argNodeMap = Utils::keyMap( |
97 | 97 | $argNodes, |
98 | - static function (ArgumentNode $arg) : string { |
|
98 | + static function(ArgumentNode $arg) : string { |
|
99 | 99 | return $arg->name->value; |
100 | 100 | } |
101 | 101 | ); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | 'args' => [ |
20 | 20 | 'message' => ['type' => Type::string()], |
21 | 21 | ], |
22 | - 'resolve' => function ($rootValue, $args) { |
|
22 | + 'resolve' => function($rootValue, $args) { |
|
23 | 23 | return $rootValue['prefix'] . $args['message']; |
24 | 24 | } |
25 | 25 | ], |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | 'x' => ['type' => Type::int()], |
36 | 36 | 'y' => ['type' => Type::int()], |
37 | 37 | ], |
38 | - 'resolve' => function ($calc, $args) { |
|
38 | + 'resolve' => function($calc, $args) { |
|
39 | 39 | return $args['x'] + $args['y']; |
40 | 40 | }, |
41 | 41 | ], |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | $astDefinition = $context->getDocument()->definitions; |
73 | 73 | |
74 | 74 | foreach ($astDefinition as $def) { |
75 | - if (! ($def instanceof DirectiveDefinitionNode)) { |
|
75 | + if (!($def instanceof DirectiveDefinitionNode)) { |
|
76 | 76 | continue; |
77 | 77 | } |
78 | 78 | |
79 | 79 | $locationsMap[$def->name->value] = array_map( |
80 | - static function ($name) : string { |
|
80 | + static function($name) : string { |
|
81 | 81 | return $name->value; |
82 | 82 | }, |
83 | 83 | $def->locations |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | return [ |
88 | - NodeKind::DIRECTIVE => function ( |
|
88 | + NodeKind::DIRECTIVE => function( |
|
89 | 89 | DirectiveNode $node, |
90 | 90 | $key, |
91 | 91 | $parent, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $name = $node->name->value; |
99 | 99 | $locations = $locationsMap[$name] ?? null; |
100 | 100 | |
101 | - if (! $locations) { |
|
101 | + if (!$locations) { |
|
102 | 102 | $context->reportError(new Error( |
103 | 103 | self::unknownDirectiveMessage($name), |
104 | 104 | [$node] |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | $candidateLocation = $this->getDirectiveLocationForASTPath($ancestors); |
111 | 111 | |
112 | - if (! $candidateLocation || in_array($candidateLocation, $locations, true)) { |
|
112 | + if (!$candidateLocation || in_array($candidateLocation, $locations, true)) { |
|
113 | 113 | return; |
114 | 114 | } |
115 | 115 | $context->reportError( |
@@ -31,7 +31,7 @@ |
||
31 | 31 | return $this->invokeIfNeeded( |
32 | 32 | $context, |
33 | 33 | [ |
34 | - NodeKind::FIELD => static function (FieldNode $node) use ($context) : void { |
|
34 | + NodeKind::FIELD => static function(FieldNode $node) use ($context) : void { |
|
35 | 35 | if ($node->name->value !== '__type' && $node->name->value !== '__schema') { |
36 | 36 | return; |
37 | 37 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | // Compute list of blame nodes. |
107 | 107 | if ($nodes instanceof Traversable) { |
108 | 108 | $nodes = iterator_to_array($nodes); |
109 | - } elseif ($nodes && ! is_array($nodes)) { |
|
109 | + } elseif ($nodes && !is_array($nodes)) { |
|
110 | 110 | $nodes = [$nodes]; |
111 | 111 | } |
112 | 112 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | public function getSource() |
213 | 213 | { |
214 | 214 | if ($this->source === null) { |
215 | - if (! empty($this->nodes[0]) && ! empty($this->nodes[0]->loc)) { |
|
215 | + if (!empty($this->nodes[0]) && !empty($this->nodes[0]->loc)) { |
|
216 | 216 | $this->source = $this->nodes[0]->loc->source; |
217 | 217 | } |
218 | 218 | } |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function getPositions() |
227 | 227 | { |
228 | - if ($this->positions === null && ! empty($this->nodes)) { |
|
228 | + if ($this->positions === null && !empty($this->nodes)) { |
|
229 | 229 | $positions = array_map( |
230 | - static function ($node) : ?int { |
|
230 | + static function($node) : ?int { |
|
231 | 231 | return isset($node->loc) ? $node->loc->start : null; |
232 | 232 | }, |
233 | 233 | $this->nodes |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | $positions = array_filter( |
237 | 237 | $positions, |
238 | - static function ($p) : bool { |
|
238 | + static function($p) : bool { |
|
239 | 239 | return $p !== null; |
240 | 240 | } |
241 | 241 | ); |
@@ -270,15 +270,15 @@ discard block |
||
270 | 270 | |
271 | 271 | if ($positions && $source) { |
272 | 272 | $this->locations = array_map( |
273 | - static function ($pos) use ($source) : SourceLocation { |
|
273 | + static function($pos) use ($source) : SourceLocation { |
|
274 | 274 | return $source->getLocation($pos); |
275 | 275 | }, |
276 | 276 | $positions |
277 | 277 | ); |
278 | 278 | } elseif ($nodes) { |
279 | - $locations = array_filter( |
|
279 | + $locations = array_filter( |
|
280 | 280 | array_map( |
281 | - static function ($node) { |
|
281 | + static function($node) { |
|
282 | 282 | if ($node->loc && $node->loc->source) { |
283 | 283 | return $node->loc->source->getLocation($node->loc->start); |
284 | 284 | } |
@@ -343,18 +343,18 @@ discard block |
||
343 | 343 | |
344 | 344 | $locations = Utils::map( |
345 | 345 | $this->getLocations(), |
346 | - static function (SourceLocation $loc) : array { |
|
346 | + static function(SourceLocation $loc) : array { |
|
347 | 347 | return $loc->toSerializableArray(); |
348 | 348 | } |
349 | 349 | ); |
350 | 350 | |
351 | - if (! empty($locations)) { |
|
351 | + if (!empty($locations)) { |
|
352 | 352 | $arr['locations'] = $locations; |
353 | 353 | } |
354 | - if (! empty($this->path)) { |
|
354 | + if (!empty($this->path)) { |
|
355 | 355 | $arr['path'] = $this->path; |
356 | 356 | } |
357 | - if (! empty($this->extensions)) { |
|
357 | + if (!empty($this->extensions)) { |
|
358 | 358 | $arr['extensions'] = $this->extensions; |
359 | 359 | } |
360 | 360 |