@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | public function getVisitor(ValidationContext $context) |
24 | 24 | { |
25 | 25 | return [ |
26 | - NodeKind::INLINE_FRAGMENT => function (InlineFragmentNode $node) use ($context) { |
|
26 | + NodeKind::INLINE_FRAGMENT => function(InlineFragmentNode $node) use ($context) { |
|
27 | 27 | $fragType = $context->getType(); |
28 | 28 | $parentType = $context->getParentType(); |
29 | 29 | |
30 | - if (! ($fragType instanceof CompositeType) || |
|
31 | - ! ($parentType instanceof CompositeType) || |
|
30 | + if (!($fragType instanceof CompositeType) || |
|
31 | + !($parentType instanceof CompositeType) || |
|
32 | 32 | $this->doTypesOverlap($context->getSchema(), $fragType, $parentType)) { |
33 | 33 | return; |
34 | 34 | } |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | [$node] |
39 | 39 | )); |
40 | 40 | }, |
41 | - NodeKind::FRAGMENT_SPREAD => function (FragmentSpreadNode $node) use ($context) { |
|
41 | + NodeKind::FRAGMENT_SPREAD => function(FragmentSpreadNode $node) use ($context) { |
|
42 | 42 | $fragName = $node->name->value; |
43 | 43 | $fragType = $this->getFragmentType($context, $fragName); |
44 | 44 | $parentType = $context->getParentType(); |
45 | 45 | |
46 | - if (! $fragType || |
|
47 | - ! $parentType || |
|
46 | + if (!$fragType || |
|
47 | + !$parentType || |
|
48 | 48 | $this->doTypesOverlap($context->getSchema(), $fragType, $parentType) |
49 | 49 | ) { |
50 | 50 | return; |
@@ -21,10 +21,10 @@ |
||
21 | 21 | $this->knownVariableNames = []; |
22 | 22 | |
23 | 23 | return [ |
24 | - NodeKind::OPERATION_DEFINITION => function () { |
|
24 | + NodeKind::OPERATION_DEFINITION => function() { |
|
25 | 25 | $this->knownVariableNames = []; |
26 | 26 | }, |
27 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $node) use ($context) { |
|
27 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $node) use ($context) { |
|
28 | 28 | $variableName = $node->variable->name->value; |
29 | 29 | if (empty($this->knownVariableNames[$variableName])) { |
30 | 30 | $this->knownVariableNames[$variableName] = $node->variable->name; |
@@ -27,18 +27,18 @@ |
||
27 | 27 | |
28 | 28 | return [ |
29 | 29 | NodeKind::OBJECT => [ |
30 | - 'enter' => function () { |
|
30 | + 'enter' => function() { |
|
31 | 31 | $this->knownNameStack[] = $this->knownNames; |
32 | 32 | $this->knownNames = []; |
33 | 33 | }, |
34 | - 'leave' => function () { |
|
34 | + 'leave' => function() { |
|
35 | 35 | $this->knownNames = array_pop($this->knownNameStack); |
36 | 36 | }, |
37 | 37 | ], |
38 | - NodeKind::OBJECT_FIELD => function (ObjectFieldNode $node) use ($context) { |
|
38 | + NodeKind::OBJECT_FIELD => function(ObjectFieldNode $node) use ($context) { |
|
39 | 39 | $fieldName = $node->name->value; |
40 | 40 | |
41 | - if (! empty($this->knownNames[$fieldName])) { |
|
41 | + if (!empty($this->knownNames[$fieldName])) { |
|
42 | 42 | $context->reportError(new Error( |
43 | 43 | self::duplicateInputFieldMessage($fieldName), |
44 | 44 | [$this->knownNames[$fieldName], $node->name] |
@@ -22,15 +22,15 @@ |
||
22 | 22 | $this->knownArgNames = []; |
23 | 23 | |
24 | 24 | return [ |
25 | - NodeKind::FIELD => function () { |
|
25 | + NodeKind::FIELD => function() { |
|
26 | 26 | $this->knownArgNames = []; |
27 | 27 | }, |
28 | - NodeKind::DIRECTIVE => function () { |
|
28 | + NodeKind::DIRECTIVE => function() { |
|
29 | 29 | $this->knownArgNames = []; |
30 | 30 | }, |
31 | - NodeKind::ARGUMENT => function (ArgumentNode $node) use ($context) { |
|
31 | + NodeKind::ARGUMENT => function(ArgumentNode $node) use ($context) { |
|
32 | 32 | $argName = $node->name->value; |
33 | - if (! empty($this->knownArgNames[$argName])) { |
|
33 | + if (!empty($this->knownArgNames[$argName])) { |
|
34 | 34 | $context->reportError(new Error( |
35 | 35 | self::duplicateArgMessage($argName), |
36 | 36 | [$this->knownArgNames[$argName], $node->name] |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | public function getVisitor(ValidationContext $context) |
24 | 24 | { |
25 | 25 | return [ |
26 | - NodeKind::FIELD => function (FieldNode $node) use ($context) { |
|
26 | + NodeKind::FIELD => function(FieldNode $node) use ($context) { |
|
27 | 27 | $type = $context->getParentType(); |
28 | - if (! $type) { |
|
28 | + if (!$type) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
@@ -84,19 +84,19 @@ discard block |
||
84 | 84 | |
85 | 85 | foreach ($schema->getPossibleTypes($type) as $possibleType) { |
86 | 86 | $fields = $possibleType->getFields(); |
87 | - if (! isset($fields[$fieldName])) { |
|
87 | + if (!isset($fields[$fieldName])) { |
|
88 | 88 | continue; |
89 | 89 | } |
90 | 90 | // This object type defines this field. |
91 | 91 | $suggestedObjectTypes[] = $possibleType->name; |
92 | 92 | foreach ($possibleType->getInterfaces() as $possibleInterface) { |
93 | 93 | $fields = $possibleInterface->getFields(); |
94 | - if (! isset($fields[$fieldName])) { |
|
94 | + if (!isset($fields[$fieldName])) { |
|
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | // This interface type defines this field. |
98 | 98 | $interfaceUsageCount[$possibleInterface->name] = |
99 | - ! isset($interfaceUsageCount[$possibleInterface->name]) |
|
99 | + !isset($interfaceUsageCount[$possibleInterface->name]) |
|
100 | 100 | ? 0 |
101 | 101 | : $interfaceUsageCount[$possibleInterface->name] + 1; |
102 | 102 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $suggestions = Utils::quotedOrList($suggestedTypeNames); |
154 | 154 | |
155 | 155 | $message .= sprintf(' Did you mean to use an inline fragment on %s?', $suggestions); |
156 | - } elseif (! empty($suggestedFieldNames)) { |
|
156 | + } elseif (!empty($suggestedFieldNames)) { |
|
157 | 157 | $suggestions = Utils::quotedOrList($suggestedFieldNames); |
158 | 158 | |
159 | 159 | $message .= sprintf(' Did you mean %s?', $suggestions); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | $context, |
29 | 29 | [ |
30 | 30 | NodeKind::OPERATION_DEFINITION => [ |
31 | - 'leave' => function (OperationDefinitionNode $operationDefinition) use ($context) { |
|
31 | + 'leave' => function(OperationDefinitionNode $operationDefinition) use ($context) { |
|
32 | 32 | $maxDepth = $this->fieldDepth($operationDefinition); |
33 | 33 | |
34 | 34 | if ($maxDepth <= $this->getMaxQueryDepth()) { |
@@ -26,18 +26,18 @@ discard block |
||
26 | 26 | $this->fragmentDefs = []; |
27 | 27 | |
28 | 28 | return [ |
29 | - NodeKind::OPERATION_DEFINITION => function ($node) { |
|
29 | + NodeKind::OPERATION_DEFINITION => function($node) { |
|
30 | 30 | $this->operationDefs[] = $node; |
31 | 31 | |
32 | 32 | return Visitor::skipNode(); |
33 | 33 | }, |
34 | - NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $def) { |
|
34 | + NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $def) { |
|
35 | 35 | $this->fragmentDefs[] = $def; |
36 | 36 | |
37 | 37 | return Visitor::skipNode(); |
38 | 38 | }, |
39 | 39 | NodeKind::DOCUMENT => [ |
40 | - 'leave' => function () use ($context) { |
|
40 | + 'leave' => function() use ($context) { |
|
41 | 41 | $fragmentNameUsed = []; |
42 | 42 | |
43 | 43 | foreach ($this->operationDefs as $operation) { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | foreach ($this->fragmentDefs as $fragmentDef) { |
50 | 50 | $fragName = $fragmentDef->name->value; |
51 | - if (! empty($fragmentNameUsed[$fragName])) { |
|
51 | + if (!empty($fragmentNameUsed[$fragName])) { |
|
52 | 52 | continue; |
53 | 53 | } |
54 | 54 |
@@ -67,7 +67,7 @@ |
||
67 | 67 | $this->endToken = $endToken; |
68 | 68 | $this->source = $source; |
69 | 69 | |
70 | - if (! $startToken || ! $endToken) { |
|
70 | + if (!$startToken || !$endToken) { |
|
71 | 71 | return; |
72 | 72 | } |
73 | 73 |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | $this->expect($openKind); |
300 | 300 | |
301 | 301 | $nodes = []; |
302 | - while (! $this->skip($closeKind)) { |
|
302 | + while (!$this->skip($closeKind)) { |
|
303 | 303 | $nodes[] = $parseFn($this); |
304 | 304 | } |
305 | 305 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $this->expect($openKind); |
324 | 324 | |
325 | 325 | $nodes = [$parseFn($this)]; |
326 | - while (! $this->skip($closeKind)) { |
|
326 | + while (!$this->skip($closeKind)) { |
|
327 | 327 | $nodes[] = $parseFn($this); |
328 | 328 | } |
329 | 329 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $definitions = []; |
361 | 361 | do { |
362 | 362 | $definitions[] = $this->parseDefinition(); |
363 | - } while (! $this->skip(Token::EOF)); |
|
363 | + } while (!$this->skip(Token::EOF)); |
|
364 | 364 | |
365 | 365 | return new DocumentNode([ |
366 | 366 | 'definitions' => new NodeList($definitions), |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | return $this->peek(Token::PAREN_L) ? |
493 | 493 | $this->many( |
494 | 494 | Token::PAREN_L, |
495 | - function () { |
|
495 | + function() { |
|
496 | 496 | return $this->parseVariableDefinition(); |
497 | 497 | }, |
498 | 498 | Token::PAREN_R |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | [ |
548 | 548 | 'selections' => $this->many( |
549 | 549 | Token::BRACE_L, |
550 | - function () { |
|
550 | + function() { |
|
551 | 551 | return $this->parseSelection(); |
552 | 552 | }, |
553 | 553 | Token::BRACE_R |
@@ -568,8 +568,7 @@ discard block |
||
568 | 568 | private function parseSelection() |
569 | 569 | { |
570 | 570 | return $this->peek(Token::SPREAD) ? |
571 | - $this->parseFragment() : |
|
572 | - $this->parseField(); |
|
571 | + $this->parseFragment() : $this->parseField(); |
|
573 | 572 | } |
574 | 573 | |
575 | 574 | /** |
@@ -607,16 +606,15 @@ discard block |
||
607 | 606 | private function parseArguments($isConst) |
608 | 607 | { |
609 | 608 | $parseFn = $isConst ? |
610 | - function () { |
|
609 | + function() { |
|
611 | 610 | return $this->parseConstArgument(); |
612 | 611 | } : |
613 | - function () { |
|
612 | + function() { |
|
614 | 613 | return $this->parseArgument(); |
615 | 614 | }; |
616 | 615 | |
617 | 616 | return $this->peek(Token::PAREN_L) ? |
618 | - $this->many(Token::PAREN_L, $parseFn, Token::PAREN_R) : |
|
619 | - new NodeList([]); |
|
617 | + $this->many(Token::PAREN_L, $parseFn, Token::PAREN_R) : new NodeList([]); |
|
620 | 618 | } |
621 | 619 | |
622 | 620 | /** |
@@ -808,7 +806,7 @@ discard block |
||
808 | 806 | break; |
809 | 807 | |
810 | 808 | case Token::DOLLAR: |
811 | - if (! $isConst) { |
|
809 | + if (!$isConst) { |
|
812 | 810 | return $this->parseVariable(); |
813 | 811 | } |
814 | 812 | break; |
@@ -855,9 +853,9 @@ discard block |
||
855 | 853 | private function parseArray($isConst) |
856 | 854 | { |
857 | 855 | $start = $this->lexer->token; |
858 | - $parseFn = $isConst ? function () { |
|
856 | + $parseFn = $isConst ? function() { |
|
859 | 857 | return $this->parseConstValue(); |
860 | - } : function () { |
|
858 | + } : function() { |
|
861 | 859 | return $this->parseVariableValue(); |
862 | 860 | }; |
863 | 861 | |
@@ -878,7 +876,7 @@ discard block |
||
878 | 876 | $start = $this->lexer->token; |
879 | 877 | $this->expect(Token::BRACE_L); |
880 | 878 | $fields = []; |
881 | - while (! $this->skip(Token::BRACE_R)) { |
|
879 | + while (!$this->skip(Token::BRACE_R)) { |
|
882 | 880 | $fields[] = $this->parseObjectField($isConst); |
883 | 881 | } |
884 | 882 | |
@@ -1065,7 +1063,7 @@ discard block |
||
1065 | 1063 | |
1066 | 1064 | $operationTypes = $this->many( |
1067 | 1065 | Token::BRACE_L, |
1068 | - function () { |
|
1066 | + function() { |
|
1069 | 1067 | return $this->parseOperationTypeDefinition(); |
1070 | 1068 | }, |
1071 | 1069 | Token::BRACE_R |
@@ -1158,7 +1156,7 @@ discard block |
||
1158 | 1156 | $types[] = $this->parseNamedType(); |
1159 | 1157 | } while ($this->skip(Token::AMP) || |
1160 | 1158 | // Legacy support for the SDL? |
1161 | - (! empty($this->lexer->options['allowLegacySDLImplementsInterfaces']) && $this->peek(Token::NAME)) |
|
1159 | + (!empty($this->lexer->options['allowLegacySDLImplementsInterfaces']) && $this->peek(Token::NAME)) |
|
1162 | 1160 | ); |
1163 | 1161 | } |
1164 | 1162 | |
@@ -1172,7 +1170,7 @@ discard block |
||
1172 | 1170 | private function parseFieldsDefinition() |
1173 | 1171 | { |
1174 | 1172 | // Legacy support for the SDL? |
1175 | - if (! empty($this->lexer->options['allowLegacySDLEmptyFields']) && |
|
1173 | + if (!empty($this->lexer->options['allowLegacySDLEmptyFields']) && |
|
1176 | 1174 | $this->peek(Token::BRACE_L) && |
1177 | 1175 | $this->lexer->lookahead()->kind === Token::BRACE_R |
1178 | 1176 | ) { |
@@ -1185,7 +1183,7 @@ discard block |
||
1185 | 1183 | return $this->peek(Token::BRACE_L) |
1186 | 1184 | ? $this->many( |
1187 | 1185 | Token::BRACE_L, |
1188 | - function () { |
|
1186 | + function() { |
|
1189 | 1187 | return $this->parseFieldDefinition(); |
1190 | 1188 | }, |
1191 | 1189 | Token::BRACE_R |
@@ -1223,13 +1221,13 @@ discard block |
||
1223 | 1221 | */ |
1224 | 1222 | private function parseArgumentDefs() |
1225 | 1223 | { |
1226 | - if (! $this->peek(Token::PAREN_L)) { |
|
1224 | + if (!$this->peek(Token::PAREN_L)) { |
|
1227 | 1225 | return new NodeList([]); |
1228 | 1226 | } |
1229 | 1227 | |
1230 | 1228 | return $this->many( |
1231 | 1229 | Token::PAREN_L, |
1232 | - function () { |
|
1230 | + function() { |
|
1233 | 1231 | return $this->parseInputValueDef(); |
1234 | 1232 | }, |
1235 | 1233 | Token::PAREN_R |
@@ -1362,7 +1360,7 @@ discard block |
||
1362 | 1360 | return $this->peek(Token::BRACE_L) |
1363 | 1361 | ? $this->many( |
1364 | 1362 | Token::BRACE_L, |
1365 | - function () { |
|
1363 | + function() { |
|
1366 | 1364 | return $this->parseEnumValueDefinition(); |
1367 | 1365 | }, |
1368 | 1366 | Token::BRACE_R |
@@ -1420,7 +1418,7 @@ discard block |
||
1420 | 1418 | return $this->peek(Token::BRACE_L) |
1421 | 1419 | ? $this->many( |
1422 | 1420 | Token::BRACE_L, |
1423 | - function () { |
|
1421 | + function() { |
|
1424 | 1422 | return $this->parseInputValueDef(); |
1425 | 1423 | }, |
1426 | 1424 | Token::BRACE_R |
@@ -1559,7 +1557,7 @@ discard block |
||
1559 | 1557 | $directives = $this->parseDirectives(true); |
1560 | 1558 | $types = $this->parseUnionMemberTypes(); |
1561 | 1559 | if (count($directives) === 0 && |
1562 | - ! $types |
|
1560 | + !$types |
|
1563 | 1561 | ) { |
1564 | 1562 | throw $this->unexpected(); |
1565 | 1563 | } |