@@ -495,7 +495,7 @@ |
||
495 | 495 | case 117: |
496 | 496 | $position = $this->position; |
497 | 497 | [$hex] = $this->readChars(4, true); |
498 | - if (! preg_match('/[0-9a-fA-F]{4}/', $hex)) { |
|
498 | + if (!preg_match('/[0-9a-fA-F]{4}/', $hex)) { |
|
499 | 499 | throw new SyntaxError( |
500 | 500 | $this->source, |
501 | 501 | $position - 1, |
@@ -97,19 +97,19 @@ discard block |
||
97 | 97 | $ast, |
98 | 98 | [ |
99 | 99 | 'leave' => [ |
100 | - NodeKind::NAME => static function (Node $node) { |
|
100 | + NodeKind::NAME => static function(Node $node) { |
|
101 | 101 | return '' . $node->value; |
102 | 102 | }, |
103 | 103 | |
104 | - NodeKind::VARIABLE => static function ($node) { |
|
104 | + NodeKind::VARIABLE => static function($node) { |
|
105 | 105 | return '$' . $node->name; |
106 | 106 | }, |
107 | 107 | |
108 | - NodeKind::DOCUMENT => function (DocumentNode $node) { |
|
108 | + NodeKind::DOCUMENT => function(DocumentNode $node) { |
|
109 | 109 | return $this->join($node->definitions, "\n\n") . "\n"; |
110 | 110 | }, |
111 | 111 | |
112 | - NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) { |
|
112 | + NodeKind::OPERATION_DEFINITION => function(OperationDefinitionNode $node) { |
|
113 | 113 | $op = $node->operation; |
114 | 114 | $name = $node->name; |
115 | 115 | $varDefs = $this->wrap('(', $this->join($node->variableDefinitions, ', '), ')'); |
@@ -117,20 +117,20 @@ discard block |
||
117 | 117 | $selectionSet = $node->selectionSet; |
118 | 118 | // Anonymous queries with no directives or variable definitions can use |
119 | 119 | // the query short form. |
120 | - return ! $name && ! $directives && ! $varDefs && $op === 'query' |
|
120 | + return !$name && !$directives && !$varDefs && $op === 'query' |
|
121 | 121 | ? $selectionSet |
122 | 122 | : $this->join([$op, $this->join([$name, $varDefs]), $directives, $selectionSet], ' '); |
123 | 123 | }, |
124 | 124 | |
125 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $node) { |
|
125 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $node) { |
|
126 | 126 | return $node->variable . ': ' . $node->type . $this->wrap(' = ', $node->defaultValue); |
127 | 127 | }, |
128 | 128 | |
129 | - NodeKind::SELECTION_SET => function (SelectionSetNode $node) { |
|
129 | + NodeKind::SELECTION_SET => function(SelectionSetNode $node) { |
|
130 | 130 | return $this->block($node->selections); |
131 | 131 | }, |
132 | 132 | |
133 | - NodeKind::FIELD => function (FieldNode $node) { |
|
133 | + NodeKind::FIELD => function(FieldNode $node) { |
|
134 | 134 | return $this->join( |
135 | 135 | [ |
136 | 136 | $this->wrap('', $node->alias, ': ') . $node->name . $this->wrap( |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | ); |
146 | 146 | }, |
147 | 147 | |
148 | - NodeKind::ARGUMENT => static function (ArgumentNode $node) { |
|
148 | + NodeKind::ARGUMENT => static function(ArgumentNode $node) { |
|
149 | 149 | return $node->name . ': ' . $node->value; |
150 | 150 | }, |
151 | 151 | |
152 | - NodeKind::FRAGMENT_SPREAD => function (FragmentSpreadNode $node) { |
|
152 | + NodeKind::FRAGMENT_SPREAD => function(FragmentSpreadNode $node) { |
|
153 | 153 | return '...' . $node->name . $this->wrap(' ', $this->join($node->directives, ' ')); |
154 | 154 | }, |
155 | 155 | |
156 | - NodeKind::INLINE_FRAGMENT => function (InlineFragmentNode $node) { |
|
156 | + NodeKind::INLINE_FRAGMENT => function(InlineFragmentNode $node) { |
|
157 | 157 | return $this->join( |
158 | 158 | [ |
159 | 159 | '...', |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | ); |
166 | 166 | }, |
167 | 167 | |
168 | - NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) { |
|
168 | + NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $node) { |
|
169 | 169 | // Note: fragment variable definitions are experimental and may be changed or removed in the future. |
170 | 170 | return sprintf('fragment %s', $node->name) |
171 | 171 | . $this->wrap('(', $this->join($node->variableDefinitions, ', '), ')') |
@@ -174,15 +174,15 @@ discard block |
||
174 | 174 | . $node->selectionSet; |
175 | 175 | }, |
176 | 176 | |
177 | - NodeKind::INT => static function (IntValueNode $node) { |
|
177 | + NodeKind::INT => static function(IntValueNode $node) { |
|
178 | 178 | return $node->value; |
179 | 179 | }, |
180 | 180 | |
181 | - NodeKind::FLOAT => static function (FloatValueNode $node) { |
|
181 | + NodeKind::FLOAT => static function(FloatValueNode $node) { |
|
182 | 182 | return $node->value; |
183 | 183 | }, |
184 | 184 | |
185 | - NodeKind::STRING => function (StringValueNode $node, $key) { |
|
185 | + NodeKind::STRING => function(StringValueNode $node, $key) { |
|
186 | 186 | if ($node->block) { |
187 | 187 | return $this->printBlockString($node->value, $key === 'description'); |
188 | 188 | } |
@@ -190,47 +190,47 @@ discard block |
||
190 | 190 | return json_encode($node->value); |
191 | 191 | }, |
192 | 192 | |
193 | - NodeKind::BOOLEAN => static function (BooleanValueNode $node) { |
|
193 | + NodeKind::BOOLEAN => static function(BooleanValueNode $node) { |
|
194 | 194 | return $node->value ? 'true' : 'false'; |
195 | 195 | }, |
196 | 196 | |
197 | - NodeKind::NULL => static function (NullValueNode $node) { |
|
197 | + NodeKind::NULL => static function(NullValueNode $node) { |
|
198 | 198 | return 'null'; |
199 | 199 | }, |
200 | 200 | |
201 | - NodeKind::ENUM => static function (EnumValueNode $node) { |
|
201 | + NodeKind::ENUM => static function(EnumValueNode $node) { |
|
202 | 202 | return $node->value; |
203 | 203 | }, |
204 | 204 | |
205 | - NodeKind::LST => function (ListValueNode $node) { |
|
205 | + NodeKind::LST => function(ListValueNode $node) { |
|
206 | 206 | return '[' . $this->join($node->values, ', ') . ']'; |
207 | 207 | }, |
208 | 208 | |
209 | - NodeKind::OBJECT => function (ObjectValueNode $node) { |
|
209 | + NodeKind::OBJECT => function(ObjectValueNode $node) { |
|
210 | 210 | return '{' . $this->join($node->fields, ', ') . '}'; |
211 | 211 | }, |
212 | 212 | |
213 | - NodeKind::OBJECT_FIELD => static function (ObjectFieldNode $node) { |
|
213 | + NodeKind::OBJECT_FIELD => static function(ObjectFieldNode $node) { |
|
214 | 214 | return $node->name . ': ' . $node->value; |
215 | 215 | }, |
216 | 216 | |
217 | - NodeKind::DIRECTIVE => function (DirectiveNode $node) { |
|
217 | + NodeKind::DIRECTIVE => function(DirectiveNode $node) { |
|
218 | 218 | return '@' . $node->name . $this->wrap('(', $this->join($node->arguments, ', '), ')'); |
219 | 219 | }, |
220 | 220 | |
221 | - NodeKind::NAMED_TYPE => static function (NamedTypeNode $node) { |
|
221 | + NodeKind::NAMED_TYPE => static function(NamedTypeNode $node) { |
|
222 | 222 | return $node->name; |
223 | 223 | }, |
224 | 224 | |
225 | - NodeKind::LIST_TYPE => static function (ListTypeNode $node) { |
|
225 | + NodeKind::LIST_TYPE => static function(ListTypeNode $node) { |
|
226 | 226 | return '[' . $node->type . ']'; |
227 | 227 | }, |
228 | 228 | |
229 | - NodeKind::NON_NULL_TYPE => static function (NonNullTypeNode $node) { |
|
229 | + NodeKind::NON_NULL_TYPE => static function(NonNullTypeNode $node) { |
|
230 | 230 | return $node->type . '!'; |
231 | 231 | }, |
232 | 232 | |
233 | - NodeKind::SCHEMA_DEFINITION => function (SchemaDefinitionNode $def) { |
|
233 | + NodeKind::SCHEMA_DEFINITION => function(SchemaDefinitionNode $def) { |
|
234 | 234 | return $this->join( |
235 | 235 | [ |
236 | 236 | 'schema', |
@@ -241,15 +241,15 @@ discard block |
||
241 | 241 | ); |
242 | 242 | }, |
243 | 243 | |
244 | - NodeKind::OPERATION_TYPE_DEFINITION => static function (OperationTypeDefinitionNode $def) { |
|
244 | + NodeKind::OPERATION_TYPE_DEFINITION => static function(OperationTypeDefinitionNode $def) { |
|
245 | 245 | return $def->operation . ': ' . $def->type; |
246 | 246 | }, |
247 | 247 | |
248 | - NodeKind::SCALAR_TYPE_DEFINITION => $this->addDescription(function (ScalarTypeDefinitionNode $def) { |
|
248 | + NodeKind::SCALAR_TYPE_DEFINITION => $this->addDescription(function(ScalarTypeDefinitionNode $def) { |
|
249 | 249 | return $this->join(['scalar', $def->name, $this->join($def->directives, ' ')], ' '); |
250 | 250 | }), |
251 | 251 | |
252 | - NodeKind::OBJECT_TYPE_DEFINITION => $this->addDescription(function (ObjectTypeDefinitionNode $def) { |
|
252 | + NodeKind::OBJECT_TYPE_DEFINITION => $this->addDescription(function(ObjectTypeDefinitionNode $def) { |
|
253 | 253 | return $this->join( |
254 | 254 | [ |
255 | 255 | 'type', |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | ); |
263 | 263 | }), |
264 | 264 | |
265 | - NodeKind::FIELD_DEFINITION => $this->addDescription(function (FieldDefinitionNode $def) { |
|
266 | - $noIndent = Utils::every($def->arguments, static function (string $arg) { |
|
265 | + NodeKind::FIELD_DEFINITION => $this->addDescription(function(FieldDefinitionNode $def) { |
|
266 | + $noIndent = Utils::every($def->arguments, static function(string $arg) { |
|
267 | 267 | return strpos($arg, "\n") === false; |
268 | 268 | }); |
269 | 269 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | . $this->wrap(' ', $this->join($def->directives, ' ')); |
276 | 276 | }), |
277 | 277 | |
278 | - NodeKind::INPUT_VALUE_DEFINITION => $this->addDescription(function (InputValueDefinitionNode $def) { |
|
278 | + NodeKind::INPUT_VALUE_DEFINITION => $this->addDescription(function(InputValueDefinitionNode $def) { |
|
279 | 279 | return $this->join( |
280 | 280 | [ |
281 | 281 | $def->name . ': ' . $def->type, |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | }), |
288 | 288 | |
289 | 289 | NodeKind::INTERFACE_TYPE_DEFINITION => $this->addDescription( |
290 | - function (InterfaceTypeDefinitionNode $def) { |
|
290 | + function(InterfaceTypeDefinitionNode $def) { |
|
291 | 291 | return $this->join( |
292 | 292 | [ |
293 | 293 | 'interface', |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | ), |
302 | 302 | |
303 | - NodeKind::UNION_TYPE_DEFINITION => $this->addDescription(function (UnionTypeDefinitionNode $def) { |
|
303 | + NodeKind::UNION_TYPE_DEFINITION => $this->addDescription(function(UnionTypeDefinitionNode $def) { |
|
304 | 304 | return $this->join( |
305 | 305 | [ |
306 | 306 | 'union', |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | ); |
315 | 315 | }), |
316 | 316 | |
317 | - NodeKind::ENUM_TYPE_DEFINITION => $this->addDescription(function (EnumTypeDefinitionNode $def) { |
|
317 | + NodeKind::ENUM_TYPE_DEFINITION => $this->addDescription(function(EnumTypeDefinitionNode $def) { |
|
318 | 318 | return $this->join( |
319 | 319 | [ |
320 | 320 | 'enum', |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | ); |
327 | 327 | }), |
328 | 328 | |
329 | - NodeKind::ENUM_VALUE_DEFINITION => $this->addDescription(function (EnumValueDefinitionNode $def) { |
|
329 | + NodeKind::ENUM_VALUE_DEFINITION => $this->addDescription(function(EnumValueDefinitionNode $def) { |
|
330 | 330 | return $this->join([$def->name, $this->join($def->directives, ' ')], ' '); |
331 | 331 | }), |
332 | 332 | |
333 | - NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $this->addDescription(function ( |
|
333 | + NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $this->addDescription(function( |
|
334 | 334 | InputObjectTypeDefinitionNode $def |
335 | 335 | ) { |
336 | 336 | return $this->join( |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | ); |
345 | 345 | }), |
346 | 346 | |
347 | - NodeKind::SCHEMA_EXTENSION => function (SchemaTypeExtensionNode $def) { |
|
347 | + NodeKind::SCHEMA_EXTENSION => function(SchemaTypeExtensionNode $def) { |
|
348 | 348 | return $this->join( |
349 | 349 | [ |
350 | 350 | 'extend schema', |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | ); |
356 | 356 | }, |
357 | 357 | |
358 | - NodeKind::SCALAR_TYPE_EXTENSION => function (ScalarTypeExtensionNode $def) { |
|
358 | + NodeKind::SCALAR_TYPE_EXTENSION => function(ScalarTypeExtensionNode $def) { |
|
359 | 359 | return $this->join( |
360 | 360 | [ |
361 | 361 | 'extend scalar', |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | ); |
367 | 367 | }, |
368 | 368 | |
369 | - NodeKind::OBJECT_TYPE_EXTENSION => function (ObjectTypeExtensionNode $def) { |
|
369 | + NodeKind::OBJECT_TYPE_EXTENSION => function(ObjectTypeExtensionNode $def) { |
|
370 | 370 | return $this->join( |
371 | 371 | [ |
372 | 372 | 'extend type', |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | ); |
380 | 380 | }, |
381 | 381 | |
382 | - NodeKind::INTERFACE_TYPE_EXTENSION => function (InterfaceTypeExtensionNode $def) { |
|
382 | + NodeKind::INTERFACE_TYPE_EXTENSION => function(InterfaceTypeExtensionNode $def) { |
|
383 | 383 | return $this->join( |
384 | 384 | [ |
385 | 385 | 'extend interface', |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | ); |
392 | 392 | }, |
393 | 393 | |
394 | - NodeKind::UNION_TYPE_EXTENSION => function (UnionTypeExtensionNode $def) { |
|
394 | + NodeKind::UNION_TYPE_EXTENSION => function(UnionTypeExtensionNode $def) { |
|
395 | 395 | return $this->join( |
396 | 396 | [ |
397 | 397 | 'extend union', |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | ); |
406 | 406 | }, |
407 | 407 | |
408 | - NodeKind::ENUM_TYPE_EXTENSION => function (EnumTypeExtensionNode $def) { |
|
408 | + NodeKind::ENUM_TYPE_EXTENSION => function(EnumTypeExtensionNode $def) { |
|
409 | 409 | return $this->join( |
410 | 410 | [ |
411 | 411 | 'extend enum', |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | ); |
418 | 418 | }, |
419 | 419 | |
420 | - NodeKind::INPUT_OBJECT_TYPE_EXTENSION => function (InputObjectTypeExtensionNode $def) { |
|
420 | + NodeKind::INPUT_OBJECT_TYPE_EXTENSION => function(InputObjectTypeExtensionNode $def) { |
|
421 | 421 | return $this->join( |
422 | 422 | [ |
423 | 423 | 'extend input', |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | ); |
430 | 430 | }, |
431 | 431 | |
432 | - NodeKind::DIRECTIVE_DEFINITION => $this->addDescription(function (DirectiveDefinitionNode $def) { |
|
433 | - $noIndent = Utils::every($def->arguments, static function (string $arg) { |
|
432 | + NodeKind::DIRECTIVE_DEFINITION => $this->addDescription(function(DirectiveDefinitionNode $def) { |
|
433 | + $noIndent = Utils::every($def->arguments, static function(string $arg) { |
|
434 | 434 | return strpos($arg, "\n") === false; |
435 | 435 | }); |
436 | 436 | |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | |
449 | 449 | public function addDescription(callable $cb) |
450 | 450 | { |
451 | - return function ($node) use ($cb) { |
|
451 | + return function($node) use ($cb) { |
|
452 | 452 | return $this->join([$node->description, $cb($node)], "\n"); |
453 | 453 | }; |
454 | 454 | } |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | $separator, |
496 | 496 | Utils::filter( |
497 | 497 | $maybeArray, |
498 | - static function ($x) { |
|
498 | + static function($x) { |
|
499 | 499 | return (bool) $x; |
500 | 500 | } |
501 | 501 | ) |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $isEdited = $isLeaving && count($edits) !== 0; |
209 | 209 | |
210 | 210 | if ($isLeaving) { |
211 | - $key = ! $ancestors ? $UNDEFINED : $path[count($path) - 1]; |
|
211 | + $key = !$ancestors ? $UNDEFINED : $path[count($path) - 1]; |
|
212 | 212 | $node = $parent; |
213 | 213 | $parent = array_pop($ancestors); |
214 | 214 | |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | $result = null; |
265 | - if (! $node instanceof NodeList && ! is_array($node)) { |
|
266 | - if (! ($node instanceof Node)) { |
|
265 | + if (!$node instanceof NodeList && !is_array($node)) { |
|
266 | + if (!($node instanceof Node)) { |
|
267 | 267 | throw new Exception('Invalid AST Node: ' . json_encode($node)); |
268 | 268 | } |
269 | 269 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | if ($result->doBreak) { |
279 | 279 | break; |
280 | 280 | } |
281 | - if (! $isLeaving && $result->doContinue) { |
|
281 | + if (!$isLeaving && $result->doContinue) { |
|
282 | 282 | array_pop($path); |
283 | 283 | continue; |
284 | 284 | } |
@@ -290,8 +290,8 @@ discard block |
||
290 | 290 | } |
291 | 291 | |
292 | 292 | $edits[] = [$key, $editValue]; |
293 | - if (! $isLeaving) { |
|
294 | - if (! ($editValue instanceof Node)) { |
|
293 | + if (!$isLeaving) { |
|
294 | + if (!($editValue instanceof Node)) { |
|
295 | 295 | array_pop($path); |
296 | 296 | continue; |
297 | 297 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | if ($isLeaving) { |
310 | 310 | array_pop($path); |
311 | 311 | } else { |
312 | - $stack = [ |
|
312 | + $stack = [ |
|
313 | 313 | 'inArray' => $inArray, |
314 | 314 | 'index' => $index, |
315 | 315 | 'keys' => $keys, |
@@ -391,9 +391,9 @@ discard block |
||
391 | 391 | $skipping = new SplFixedArray($visitorsCount); |
392 | 392 | |
393 | 393 | return [ |
394 | - 'enter' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) { |
|
394 | + 'enter' => static function(Node $node) use ($visitors, $skipping, $visitorsCount) { |
|
395 | 395 | for ($i = 0; $i < $visitorsCount; $i++) { |
396 | - if (! empty($skipping[$i])) { |
|
396 | + if (!empty($skipping[$i])) { |
|
397 | 397 | continue; |
398 | 398 | } |
399 | 399 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | false |
404 | 404 | ); |
405 | 405 | |
406 | - if (! $fn) { |
|
406 | + if (!$fn) { |
|
407 | 407 | continue; |
408 | 408 | } |
409 | 409 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | } |
423 | 423 | } |
424 | 424 | }, |
425 | - 'leave' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) { |
|
425 | + 'leave' => static function(Node $node) use ($visitors, $skipping, $visitorsCount) { |
|
426 | 426 | for ($i = 0; $i < $visitorsCount; $i++) { |
427 | 427 | if (empty($skipping[$i])) { |
428 | 428 | $fn = self::getVisitFn( |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | public static function visitWithTypeInfo(TypeInfo $typeInfo, $visitor) |
459 | 459 | { |
460 | 460 | return [ |
461 | - 'enter' => static function (Node $node) use ($typeInfo, $visitor) { |
|
461 | + 'enter' => static function(Node $node) use ($typeInfo, $visitor) { |
|
462 | 462 | $typeInfo->enter($node); |
463 | 463 | $fn = self::getVisitFn($visitor, $node->kind, false); |
464 | 464 | |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | |
477 | 477 | return null; |
478 | 478 | }, |
479 | - 'leave' => static function (Node $node) use ($typeInfo, $visitor) { |
|
479 | + 'leave' => static function(Node $node) use ($typeInfo, $visitor) { |
|
480 | 480 | $fn = self::getVisitFn($visitor, $node->kind, true); |
481 | 481 | $result = $fn ? call_user_func_array($fn, func_get_args()) : null; |
482 | 482 | $typeInfo->leave($node); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | |
502 | 502 | $kindVisitor = $visitor[$kind] ?? null; |
503 | 503 | |
504 | - if (! $isLeaving && is_callable($kindVisitor)) { |
|
504 | + if (!$isLeaving && is_callable($kindVisitor)) { |
|
505 | 505 | // { Kind() {} } |
506 | 506 | return $kindVisitor; |
507 | 507 | } |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | Visitor::visitWithTypeInfo( |
129 | 129 | $typeInfo, |
130 | 130 | [ |
131 | - NodeKind::VARIABLE_DEFINITION => static function () { |
|
131 | + NodeKind::VARIABLE_DEFINITION => static function() { |
|
132 | 132 | return false; |
133 | 133 | }, |
134 | - NodeKind::VARIABLE => static function (VariableNode $variable) use ( |
|
134 | + NodeKind::VARIABLE => static function(VariableNode $variable) use ( |
|
135 | 135 | &$newUsages, |
136 | 136 | $typeInfo |
137 | 137 | ) { |
@@ -158,19 +158,19 @@ discard block |
||
158 | 158 | $fragments = []; |
159 | 159 | $collectedNames = []; |
160 | 160 | $nodesToVisit = [$operation]; |
161 | - while (! empty($nodesToVisit)) { |
|
161 | + while (!empty($nodesToVisit)) { |
|
162 | 162 | $node = array_pop($nodesToVisit); |
163 | 163 | $spreads = $this->getFragmentSpreads($node); |
164 | 164 | foreach ($spreads as $spread) { |
165 | 165 | $fragName = $spread->name->value; |
166 | 166 | |
167 | - if (! empty($collectedNames[$fragName])) { |
|
167 | + if (!empty($collectedNames[$fragName])) { |
|
168 | 168 | continue; |
169 | 169 | } |
170 | 170 | |
171 | 171 | $collectedNames[$fragName] = true; |
172 | 172 | $fragment = $this->getFragment($fragName); |
173 | - if (! $fragment) { |
|
173 | + if (!$fragment) { |
|
174 | 174 | continue; |
175 | 175 | } |
176 | 176 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $spreads = []; |
195 | 195 | /** @var SelectionSetNode[] $setsToVisit */ |
196 | 196 | $setsToVisit = [$node->selectionSet]; |
197 | - while (! empty($setsToVisit)) { |
|
197 | + while (!empty($setsToVisit)) { |
|
198 | 198 | $set = array_pop($setsToVisit); |
199 | 199 | |
200 | 200 | for ($i = 0, $selectionCount = count($set->selections); $i < $selectionCount; $i++) { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | public function getFragment($name) |
221 | 221 | { |
222 | 222 | $fragments = $this->fragments; |
223 | - if (! $fragments) { |
|
223 | + if (!$fragments) { |
|
224 | 224 | $fragments = []; |
225 | 225 | foreach ($this->getDocument()->definitions as $statement) { |
226 | 226 | if ($statement->kind !== NodeKind::FRAGMENT_DEFINITION) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public static function allRules() |
129 | 129 | { |
130 | - if (! self::$initRules) { |
|
130 | + if (!self::$initRules) { |
|
131 | 131 | static::$rules = array_merge(static::defaultRules(), self::securityRules(), self::$rules); |
132 | 132 | static::$initRules = true; |
133 | 133 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | return is_array($value) |
269 | 269 | ? count(array_filter( |
270 | 270 | $value, |
271 | - static function ($item) { |
|
271 | + static function($item) { |
|
272 | 272 | return $item instanceof Exception || $item instanceof Throwable; |
273 | 273 | } |
274 | 274 | )) === count($value) |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | throw new Error( |
317 | 317 | implode( |
318 | 318 | "\n\n", |
319 | - array_map(static function (Error $error) : string { |
|
319 | + array_map(static function(Error $error) : string { |
|
320 | 320 | return $error->message; |
321 | 321 | }, $errors) |
322 | 322 | ) |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function getVisitor(ValidationContext $context) |
27 | 27 | { |
28 | 28 | return [ |
29 | - NodeKind::ARGUMENT => static function (ArgumentNode $node, $key, $parent, $path, $ancestors) use ($context) { |
|
29 | + NodeKind::ARGUMENT => static function(ArgumentNode $node, $key, $parent, $path, $ancestors) use ($context) { |
|
30 | 30 | /** @var NodeList|Node[] $ancestors */ |
31 | 31 | $argDef = $context->getArgument(); |
32 | 32 | if ($argDef !== null) { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | Utils::suggestionList( |
47 | 47 | $node->name->value, |
48 | 48 | array_map( |
49 | - static function ($arg) { |
|
49 | + static function($arg) { |
|
50 | 50 | return $arg->name; |
51 | 51 | }, |
52 | 52 | $fieldDef->args |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | Utils::suggestionList( |
67 | 67 | $node->name->value, |
68 | 68 | array_map( |
69 | - static function ($arg) { |
|
69 | + static function($arg) { |
|
70 | 70 | return $arg->name; |
71 | 71 | }, |
72 | 72 | $directive->args |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public static function unknownArgMessage($argName, $fieldName, $typeName, array $suggestedArgs) |
88 | 88 | { |
89 | 89 | $message = sprintf('Unknown argument "%s" on field "%s" of type "%s".', $argName, $fieldName, $typeName); |
90 | - if (! empty($suggestedArgs)) { |
|
90 | + if (!empty($suggestedArgs)) { |
|
91 | 91 | $message .= sprintf(' Did you mean %s?', Utils::quotedOrList($suggestedArgs)); |
92 | 92 | } |
93 | 93 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | public static function unknownDirectiveArgMessage($argName, $directiveName, array $suggestedArgs) |
101 | 101 | { |
102 | 102 | $message = sprintf('Unknown argument "%s" on directive "@%s".', $argName, $directiveName); |
103 | - if (! empty($suggestedArgs)) { |
|
103 | + if (!empty($suggestedArgs)) { |
|
104 | 104 | $message .= sprintf(' Did you mean %s?', Utils::quotedOrList($suggestedArgs)); |
105 | 105 | } |
106 | 106 |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | |
26 | 26 | return [ |
27 | 27 | NodeKind::OPERATION_DEFINITION => [ |
28 | - 'enter' => static function () use (&$variableNameDefined) { |
|
28 | + 'enter' => static function() use (&$variableNameDefined) { |
|
29 | 29 | $variableNameDefined = []; |
30 | 30 | }, |
31 | - 'leave' => static function (OperationDefinitionNode $operation) use (&$variableNameDefined, $context) { |
|
31 | + 'leave' => static function(OperationDefinitionNode $operation) use (&$variableNameDefined, $context) { |
|
32 | 32 | $usages = $context->getRecursiveVariableUsages($operation); |
33 | 33 | |
34 | 34 | foreach ($usages as $usage) { |
35 | 35 | $node = $usage['node']; |
36 | 36 | $varName = $node->name->value; |
37 | 37 | |
38 | - if (! empty($variableNameDefined[$varName])) { |
|
38 | + if (!empty($variableNameDefined[$varName])) { |
|
39 | 39 | continue; |
40 | 40 | } |
41 | 41 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | }, |
51 | 51 | ], |
52 | - NodeKind::VARIABLE_DEFINITION => static function (VariableDefinitionNode $def) use (&$variableNameDefined) { |
|
52 | + NodeKind::VARIABLE_DEFINITION => static function(VariableDefinitionNode $def) use (&$variableNameDefined) { |
|
53 | 53 | $variableNameDefined[$def->variable->name->value] = true; |
54 | 54 | }, |
55 | 55 | ]; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $this->cachedFieldsAndFragmentNames = new SplObjectStorage(); |
61 | 61 | |
62 | 62 | return [ |
63 | - NodeKind::SELECTION_SET => function (SelectionSetNode $selectionSet) use ($context) { |
|
63 | + NodeKind::SELECTION_SET => function(SelectionSetNode $selectionSet) use ($context) { |
|
64 | 64 | $conflicts = $this->findConflictsWithinSelectionSet( |
65 | 65 | $context, |
66 | 66 | $context->getParentType(), |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | } |
260 | 260 | $responseName = $selection->alias ? $selection->alias->value : $fieldName; |
261 | 261 | |
262 | - if (! isset($astAndDefs[$responseName])) { |
|
262 | + if (!isset($astAndDefs[$responseName])) { |
|
263 | 263 | $astAndDefs[$responseName] = []; |
264 | 264 | } |
265 | 265 | $astAndDefs[$responseName][] = [$parentType, $selection, $fieldDef]; |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $fields[$i], |
319 | 319 | $fields[$j] |
320 | 320 | ); |
321 | - if (! $conflict) { |
|
321 | + if (!$conflict) { |
|
322 | 322 | continue; |
323 | 323 | } |
324 | 324 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $type1 = $def1 === null ? null : $def1->getType(); |
370 | 370 | $type2 = $def2 === null ? null : $def2->getType(); |
371 | 371 | |
372 | - if (! $areMutuallyExclusive) { |
|
372 | + if (!$areMutuallyExclusive) { |
|
373 | 373 | // Two aliases must refer to the same field. |
374 | 374 | $name1 = $ast1->name->value; |
375 | 375 | $name2 = $ast2->name->value; |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | ]; |
382 | 382 | } |
383 | 383 | |
384 | - if (! $this->sameArguments($ast1->arguments ?: [], $ast2->arguments ?: [])) { |
|
384 | + if (!$this->sameArguments($ast1->arguments ?: [], $ast2->arguments ?: [])) { |
|
385 | 385 | return [ |
386 | 386 | [$responseName, 'they have differing arguments'], |
387 | 387 | [$ast1], |
@@ -443,11 +443,11 @@ discard block |
||
443 | 443 | break; |
444 | 444 | } |
445 | 445 | } |
446 | - if (! $argument2) { |
|
446 | + if (!$argument2) { |
|
447 | 447 | return false; |
448 | 448 | } |
449 | 449 | |
450 | - if (! $this->sameValue($argument1->value, $argument2->value)) { |
|
450 | + if (!$this->sameValue($argument1->value, $argument2->value)) { |
|
451 | 451 | return false; |
452 | 452 | } |
453 | 453 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | */ |
461 | 461 | private function sameValue(Node $value1, Node $value2) |
462 | 462 | { |
463 | - return (! $value1 && ! $value2) || (Printer::doPrint($value1) === Printer::doPrint($value2)); |
|
463 | + return (!$value1 && !$value2) || (Printer::doPrint($value1) === Printer::doPrint($value2)); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | /** |
@@ -474,23 +474,19 @@ discard block |
||
474 | 474 | { |
475 | 475 | if ($type1 instanceof ListOfType) { |
476 | 476 | return $type2 instanceof ListOfType ? |
477 | - $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : |
|
478 | - true; |
|
477 | + $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : true; |
|
479 | 478 | } |
480 | 479 | if ($type2 instanceof ListOfType) { |
481 | 480 | return $type1 instanceof ListOfType ? |
482 | - $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : |
|
483 | - true; |
|
481 | + $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : true; |
|
484 | 482 | } |
485 | 483 | if ($type1 instanceof NonNull) { |
486 | 484 | return $type2 instanceof NonNull ? |
487 | - $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : |
|
488 | - true; |
|
485 | + $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : true; |
|
489 | 486 | } |
490 | 487 | if ($type2 instanceof NonNull) { |
491 | 488 | return $type1 instanceof NonNull ? |
492 | - $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : |
|
493 | - true; |
|
489 | + $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : true; |
|
494 | 490 | } |
495 | 491 | if (Type::isLeafType($type1) || Type::isLeafType($type2)) { |
496 | 492 | return $type1 !== $type2; |
@@ -617,7 +613,7 @@ discard block |
||
617 | 613 | // maps, each field from the first field map must be compared to every field |
618 | 614 | // in the second field map to find potential conflicts. |
619 | 615 | foreach ($fieldMap1 as $responseName => $fields1) { |
620 | - if (! isset($fieldMap2[$responseName])) { |
|
616 | + if (!isset($fieldMap2[$responseName])) { |
|
621 | 617 | continue; |
622 | 618 | } |
623 | 619 | |
@@ -633,7 +629,7 @@ discard block |
||
633 | 629 | $fields1[$i], |
634 | 630 | $fields2[$j] |
635 | 631 | ); |
636 | - if (! $conflict) { |
|
632 | + if (!$conflict) { |
|
637 | 633 | continue; |
638 | 634 | } |
639 | 635 | |
@@ -667,7 +663,7 @@ discard block |
||
667 | 663 | $comparedFragments[$fragmentName] = true; |
668 | 664 | |
669 | 665 | $fragment = $context->getFragment($fragmentName); |
670 | - if (! $fragment) { |
|
666 | + if (!$fragment) { |
|
671 | 667 | return; |
672 | 668 | } |
673 | 669 | |
@@ -767,7 +763,7 @@ discard block |
||
767 | 763 | |
768 | 764 | $fragment1 = $context->getFragment($fragmentName1); |
769 | 765 | $fragment2 = $context->getFragment($fragmentName2); |
770 | - if (! $fragment1 || ! $fragment2) { |
|
766 | + if (!$fragment1 || !$fragment2) { |
|
771 | 767 | return; |
772 | 768 | } |
773 | 769 | |
@@ -840,7 +836,7 @@ discard block |
||
840 | 836 | [ |
841 | 837 | $responseName, |
842 | 838 | array_map( |
843 | - static function ($conflict) { |
|
839 | + static function($conflict) { |
|
844 | 840 | return $conflict[0]; |
845 | 841 | }, |
846 | 842 | $conflicts |
@@ -848,14 +844,14 @@ discard block |
||
848 | 844 | ], |
849 | 845 | array_reduce( |
850 | 846 | $conflicts, |
851 | - static function ($allFields, $conflict) { |
|
847 | + static function($allFields, $conflict) { |
|
852 | 848 | return array_merge($allFields, $conflict[1]); |
853 | 849 | }, |
854 | 850 | [$ast1] |
855 | 851 | ), |
856 | 852 | array_reduce( |
857 | 853 | $conflicts, |
858 | - static function ($allFields, $conflict) { |
|
854 | + static function($allFields, $conflict) { |
|
859 | 855 | return array_merge($allFields, $conflict[2]); |
860 | 856 | }, |
861 | 857 | [$ast2] |
@@ -882,7 +878,7 @@ discard block |
||
882 | 878 | { |
883 | 879 | if (is_array($reason)) { |
884 | 880 | $tmp = array_map( |
885 | - static function ($tmp) { |
|
881 | + static function($tmp) { |
|
886 | 882 | [$responseName, $subReason] = $tmp; |
887 | 883 | |
888 | 884 | $reasonMessage = self::reasonMessage($subReason); |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | { |
25 | 25 | return [ |
26 | 26 | NodeKind::OPERATION_DEFINITION => [ |
27 | - 'enter' => function () { |
|
27 | + 'enter' => function() { |
|
28 | 28 | $this->varDefMap = []; |
29 | 29 | }, |
30 | - 'leave' => function (OperationDefinitionNode $operation) use ($context) { |
|
30 | + 'leave' => function(OperationDefinitionNode $operation) use ($context) { |
|
31 | 31 | $usages = $context->getRecursiveVariableUsages($operation); |
32 | 32 | |
33 | 33 | foreach ($usages as $usage) { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $schema = $context->getSchema(); |
49 | 49 | $varType = TypeInfo::typeFromAST($schema, $varDef->type); |
50 | 50 | |
51 | - if (! $varType || TypeComparators::isTypeSubTypeOf( |
|
51 | + if (!$varType || TypeComparators::isTypeSubTypeOf( |
|
52 | 52 | $schema, |
53 | 53 | $this->effectiveType($varType, $varDef), |
54 | 54 | $type |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | }, |
65 | 65 | ], |
66 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $varDefNode) { |
|
66 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $varDefNode) { |
|
67 | 67 | $this->varDefMap[$varDefNode->variable->name->value] = $varDefNode; |
68 | 68 | }, |
69 | 69 | ]; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | private function effectiveType($varType, $varDef) |
73 | 73 | { |
74 | - return ! $varDef->defaultValue || $varType instanceof NonNull ? $varType : new NonNull($varType); |
|
74 | + return !$varDef->defaultValue || $varType instanceof NonNull ? $varType : new NonNull($varType); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |