@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | $this->spreadPathIndexByName = []; |
42 | 42 | |
43 | 43 | return [ |
44 | - NodeKind::OPERATION_DEFINITION => static function () { |
|
44 | + NodeKind::OPERATION_DEFINITION => static function() { |
|
45 | 45 | return Visitor::skipNode(); |
46 | 46 | }, |
47 | - NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) use ($context) { |
|
47 | + NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $node) use ($context) { |
|
48 | 48 | $this->detectCycleRecursive($node, $context); |
49 | 49 | |
50 | 50 | return Visitor::skipNode(); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | private function detectCycleRecursive(FragmentDefinitionNode $fragment, ValidationContext $context) |
56 | 56 | { |
57 | - if (! empty($this->visitedFrags[$fragment->name->value])) { |
|
57 | + if (!empty($this->visitedFrags[$fragment->name->value])) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | } else { |
84 | 84 | $cyclePath = array_slice($this->spreadPath, $cycleIndex); |
85 | - $fragmentNames = Utils::map(array_slice($cyclePath, 0, -1), static function ($s) { |
|
85 | + $fragmentNames = Utils::map(array_slice($cyclePath, 0, -1), static function($s) { |
|
86 | 86 | return $s->name->value; |
87 | 87 | }); |
88 | 88 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | return sprintf( |
106 | 106 | 'Cannot spread fragment "%s" within itself%s.', |
107 | 107 | $fragName, |
108 | - ! empty($spreadNames) ? ' via ' . implode(', ', $spreadNames) : '' |
|
108 | + !empty($spreadNames) ? ' via ' . implode(', ', $spreadNames) : '' |
|
109 | 109 | ); |
110 | 110 | } |
111 | 111 | } |
@@ -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 | ); |