@@ -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; |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public function getVisitor(ValidationContext $context) |
16 | 16 | { |
17 | 17 | return [ |
18 | - NodeKind::FRAGMENT_SPREAD => static function (FragmentSpreadNode $node) use ($context) { |
|
18 | + NodeKind::FRAGMENT_SPREAD => static function(FragmentSpreadNode $node) use ($context) { |
|
19 | 19 | $fragmentName = $node->name->value; |
20 | 20 | $fragment = $context->getFragment($fragmentName); |
21 | 21 | if ($fragment) { |
@@ -34,15 +34,15 @@ |
||
34 | 34 | $this->knownArgNames = []; |
35 | 35 | |
36 | 36 | return [ |
37 | - NodeKind::FIELD => function () { |
|
37 | + NodeKind::FIELD => function() { |
|
38 | 38 | $this->knownArgNames = []; |
39 | 39 | }, |
40 | - NodeKind::DIRECTIVE => function () { |
|
40 | + NodeKind::DIRECTIVE => function() { |
|
41 | 41 | $this->knownArgNames = []; |
42 | 42 | }, |
43 | - NodeKind::ARGUMENT => function (ArgumentNode $node) use ($context) { |
|
43 | + NodeKind::ARGUMENT => function(ArgumentNode $node) use ($context) { |
|
44 | 44 | $argName = $node->name->value; |
45 | - if (! empty($this->knownArgNames[$argName])) { |
|
45 | + if (!empty($this->knownArgNames[$argName])) { |
|
46 | 46 | $context->reportError(new Error( |
47 | 47 | self::duplicateArgMessage($argName), |
48 | 48 | [$this->knownArgNames[$argName], $node->name] |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | public function getVisitor(ValidationContext $context) |
17 | 17 | { |
18 | 18 | return [ |
19 | - NodeKind::FIELD => static function (FieldNode $node) use ($context) { |
|
19 | + NodeKind::FIELD => static function(FieldNode $node) use ($context) { |
|
20 | 20 | $type = $context->getType(); |
21 | - if (! $type) { |
|
21 | + if (!$type) { |
|
22 | 22 | return; |
23 | 23 | } |
24 | 24 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | [$node->selectionSet] |
30 | 30 | )); |
31 | 31 | } |
32 | - } elseif (! $node->selectionSet) { |
|
32 | + } elseif (!$node->selectionSet) { |
|
33 | 33 | $context->reportError(new Error( |
34 | 34 | self::requiredSubselectionMessage($node->name->value, $type), |
35 | 35 | [$node] |
@@ -27,8 +27,8 @@ |
||
27 | 27 | public function getASTVisitor(ASTValidationContext $context) |
28 | 28 | { |
29 | 29 | return [ |
30 | - 'enter' => static function (Node $node) use ($context) { |
|
31 | - if (! isset($node->directives)) { |
|
30 | + 'enter' => static function(Node $node) use ($context) { |
|
31 | + if (!isset($node->directives)) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 |
@@ -26,17 +26,17 @@ |
||
26 | 26 | $operationCount = 0; |
27 | 27 | |
28 | 28 | return [ |
29 | - NodeKind::DOCUMENT => static function (DocumentNode $node) use (&$operationCount) { |
|
29 | + NodeKind::DOCUMENT => static function(DocumentNode $node) use (&$operationCount) { |
|
30 | 30 | $tmp = Utils::filter( |
31 | 31 | $node->definitions, |
32 | - static function (Node $definition) { |
|
32 | + static function(Node $definition) { |
|
33 | 33 | return $definition instanceof OperationDefinitionNode; |
34 | 34 | } |
35 | 35 | ); |
36 | 36 | |
37 | 37 | $operationCount = count($tmp); |
38 | 38 | }, |
39 | - NodeKind::OPERATION_DEFINITION => static function (OperationDefinitionNode $node) use ( |
|
39 | + NodeKind::OPERATION_DEFINITION => static function(OperationDefinitionNode $node) use ( |
|
40 | 40 | &$operationCount, |
41 | 41 | $context |
42 | 42 | ) { |
@@ -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; |
@@ -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,10 +19,10 @@ discard block |
||
19 | 19 | { |
20 | 20 | return [ |
21 | 21 | NodeKind::FIELD => [ |
22 | - 'leave' => static function (FieldNode $fieldNode) use ($context) { |
|
22 | + 'leave' => static function(FieldNode $fieldNode) use ($context) { |
|
23 | 23 | $fieldDef = $context->getFieldDef(); |
24 | 24 | |
25 | - if (! $fieldDef) { |
|
25 | + if (!$fieldDef) { |
|
26 | 26 | return Visitor::skipNode(); |
27 | 27 | } |
28 | 28 | $argNodes = $fieldNode->arguments ?: []; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | foreach ($fieldDef->args as $argDef) { |
35 | 35 | $argNode = $argNodeMap[$argDef->name] ?? null; |
36 | - if ($argNode || (! ($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) { |
|
36 | + if ($argNode || (!($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) { |
|
37 | 37 | continue; |
38 | 38 | } |
39 | 39 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | }, |
46 | 46 | ], |
47 | 47 | NodeKind::DIRECTIVE => [ |
48 | - 'leave' => static function (DirectiveNode $directiveNode) use ($context) { |
|
48 | + 'leave' => static function(DirectiveNode $directiveNode) use ($context) { |
|
49 | 49 | $directiveDef = $context->getDirective(); |
50 | - if (! $directiveDef) { |
|
50 | + if (!$directiveDef) { |
|
51 | 51 | return Visitor::skipNode(); |
52 | 52 | } |
53 | 53 | $argNodes = $directiveNode->arguments ?: []; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | foreach ($directiveDef->args as $argDef) { |
60 | 60 | $argNode = $argNodeMap[$argDef->name] ?? null; |
61 | - if ($argNode || (! ($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) { |
|
61 | + if ($argNode || (!($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) { |
|
62 | 62 | continue; |
63 | 63 | } |
64 | 64 |