@@ -15,8 +15,8 @@ |
||
15 | 15 | public function getVisitor(ValidationContext $context) |
16 | 16 | { |
17 | 17 | return [ |
18 | - 'enter' => static function (Node $node) use ($context) { |
|
19 | - if (! isset($node->directives)) { |
|
18 | + 'enter' => static function(Node $node) use ($context) { |
|
19 | + if (!isset($node->directives)) { |
|
20 | 20 | return; |
21 | 21 | } |
22 | 22 |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | $astDefinition = $context->getDocument()->definitions; |
34 | 34 | |
35 | 35 | foreach ($astDefinition as $def) { |
36 | - if (! ($def instanceof DirectiveDefinitionNode)) { |
|
36 | + if (!($def instanceof DirectiveDefinitionNode)) { |
|
37 | 37 | continue; |
38 | 38 | } |
39 | 39 | |
40 | 40 | $locationsMap[$def->name->value] = array_map( |
41 | - static function ($name) { |
|
41 | + static function($name) { |
|
42 | 42 | return $name->value; |
43 | 43 | }, |
44 | 44 | $def->locations |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | return [ |
49 | - NodeKind::DIRECTIVE => function ( |
|
49 | + NodeKind::DIRECTIVE => function( |
|
50 | 50 | DirectiveNode $node, |
51 | 51 | $key, |
52 | 52 | $parent, |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $name = $node->name->value; |
60 | 60 | $locations = $locationsMap[$name] ?? null; |
61 | 61 | |
62 | - if (! $locations) { |
|
62 | + if (!$locations) { |
|
63 | 63 | $context->reportError(new Error( |
64 | 64 | self::unknownDirectiveMessage($name), |
65 | 65 | [$node] |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $candidateLocation = $this->getDirectiveLocationForASTPath($ancestors); |
72 | 72 | |
73 | - if (! $candidateLocation || in_array($candidateLocation, $locations, true)) { |
|
73 | + if (!$candidateLocation || in_array($candidateLocation, $locations, true)) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | $context->reportError( |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | public function getVisitor(ValidationContext $context) |
20 | 20 | { |
21 | 21 | return [ |
22 | - NodeKind::INLINE_FRAGMENT => static function (InlineFragmentNode $node) use ($context) { |
|
23 | - if (! $node->typeCondition) { |
|
22 | + NodeKind::INLINE_FRAGMENT => static function(InlineFragmentNode $node) use ($context) { |
|
23 | + if (!$node->typeCondition) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | 27 | $type = TypeInfo::typeFromAST($context->getSchema(), $node->typeCondition); |
28 | - if (! $type || Type::isCompositeType($type)) { |
|
28 | + if (!$type || Type::isCompositeType($type)) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | [$node->typeCondition] |
35 | 35 | )); |
36 | 36 | }, |
37 | - NodeKind::FRAGMENT_DEFINITION => static function (FragmentDefinitionNode $node) use ($context) { |
|
37 | + NodeKind::FRAGMENT_DEFINITION => static function(FragmentDefinitionNode $node) use ($context) { |
|
38 | 38 | $type = TypeInfo::typeFromAST($context->getSchema(), $node->typeCondition); |
39 | 39 | |
40 | - if (! $type || Type::isCompositeType($type)) { |
|
40 | + if (!$type || Type::isCompositeType($type)) { |
|
41 | 41 | return; |
42 | 42 | } |
43 | 43 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | protected function invokeIfNeeded(ValidationContext $context, array $validators) |
65 | 65 | { |
66 | 66 | // is disabled? |
67 | - if (! $this->isEnabled()) { |
|
67 | + if (!$this->isEnabled()) { |
|
68 | 68 | return []; |
69 | 69 | } |
70 | 70 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | // Importantly this does not include inline fragments. |
82 | 82 | $definitions = $context->getDocument()->definitions; |
83 | 83 | foreach ($definitions as $node) { |
84 | - if (! ($node instanceof FragmentDefinitionNode)) { |
|
84 | + if (!($node instanceof FragmentDefinitionNode)) { |
|
85 | 85 | continue; |
86 | 86 | } |
87 | 87 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | } |
138 | 138 | $responseName = $this->getFieldName($selection); |
139 | - if (! isset($_astAndDefs[$responseName])) { |
|
139 | + if (!isset($_astAndDefs[$responseName])) { |
|
140 | 140 | $_astAndDefs[$responseName] = new ArrayObject(); |
141 | 141 | } |
142 | 142 | // create field context |
@@ -31,7 +31,7 @@ |
||
31 | 31 | return $this->invokeIfNeeded( |
32 | 32 | $context, |
33 | 33 | [ |
34 | - NodeKind::FIELD => static function (FieldNode $node) use ($context) { |
|
34 | + NodeKind::FIELD => static function(FieldNode $node) use ($context) { |
|
35 | 35 | if ($node->name->value !== '__type' && $node->name->value !== '__schema') { |
36 | 36 | return; |
37 | 37 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | { |
24 | 24 | public function getVisitor(ValidationContext $context) |
25 | 25 | { |
26 | - $skip = static function () { |
|
26 | + $skip = static function() { |
|
27 | 27 | return Visitor::skipNode(); |
28 | 28 | }; |
29 | 29 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | NodeKind::INTERFACE_TYPE_DEFINITION => $skip, |
36 | 36 | NodeKind::UNION_TYPE_DEFINITION => $skip, |
37 | 37 | NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $skip, |
38 | - NodeKind::NAMED_TYPE => static function (NamedTypeNode $node) use ($context) { |
|
38 | + NodeKind::NAMED_TYPE => static function(NamedTypeNode $node) use ($context) { |
|
39 | 39 | $schema = $context->getSchema(); |
40 | 40 | $typeName = $node->name->value; |
41 | 41 | $type = $schema->getType($typeName); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public static function unknownTypeMessage($type, array $suggestedTypes) |
62 | 62 | { |
63 | 63 | $message = sprintf('Unknown type "%s".', $type); |
64 | - if (! empty($suggestedTypes)) { |
|
64 | + if (!empty($suggestedTypes)) { |
|
65 | 65 | $suggestions = Utils::quotedOrList($suggestedTypes); |
66 | 66 | |
67 | 67 | $message .= sprintf(' Did you mean %s?', $suggestions); |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | $this->spreadPathIndexByName = []; |
44 | 44 | |
45 | 45 | return [ |
46 | - NodeKind::OPERATION_DEFINITION => static function () { |
|
46 | + NodeKind::OPERATION_DEFINITION => static function() { |
|
47 | 47 | return Visitor::skipNode(); |
48 | 48 | }, |
49 | - NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) use ($context) { |
|
50 | - if (! isset($this->visitedFrags[$node->name->value])) { |
|
49 | + NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $node) use ($context) { |
|
50 | + if (!isset($this->visitedFrags[$node->name->value])) { |
|
51 | 51 | $this->detectCycleRecursive($node, $context); |
52 | 52 | } |
53 | 53 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $spreadName, |
99 | 99 | Utils::map( |
100 | 100 | $cyclePath, |
101 | - static function ($s) { |
|
101 | + static function($s) { |
|
102 | 102 | return $s->name->value; |
103 | 103 | } |
104 | 104 | ) |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | return sprintf( |
120 | 120 | 'Cannot spread fragment "%s" within itself%s.', |
121 | 121 | $fragName, |
122 | - ! empty($spreadNames) ? ' via ' . implode(', ', $spreadNames) : '' |
|
122 | + !empty($spreadNames) ? ' via ' . implode(', ', $spreadNames) : '' |
|
123 | 123 | ); |
124 | 124 | } |
125 | 125 | } |
@@ -18,11 +18,11 @@ |
||
18 | 18 | public function getVisitor(ValidationContext $context) |
19 | 19 | { |
20 | 20 | return [ |
21 | - NodeKind::VARIABLE_DEFINITION => static function (VariableDefinitionNode $node) use ($context) { |
|
21 | + NodeKind::VARIABLE_DEFINITION => static function(VariableDefinitionNode $node) use ($context) { |
|
22 | 22 | $type = TypeInfo::typeFromAST($context->getSchema(), $node->type); |
23 | 23 | |
24 | 24 | // If the variable type is not an input type, return an error. |
25 | - if (! $type || Type::isInputType($type)) { |
|
25 | + if (!$type || Type::isInputType($type)) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $this->knownOperationNames = []; |
23 | 23 | |
24 | 24 | return [ |
25 | - NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) use ($context) { |
|
25 | + NodeKind::OPERATION_DEFINITION => function(OperationDefinitionNode $node) use ($context) { |
|
26 | 26 | $operationName = $node->name; |
27 | 27 | |
28 | 28 | if ($operationName) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | return Visitor::skipNode(); |
40 | 40 | }, |
41 | - NodeKind::FRAGMENT_DEFINITION => static function () { |
|
41 | + NodeKind::FRAGMENT_DEFINITION => static function() { |
|
42 | 42 | return Visitor::skipNode(); |
43 | 43 | }, |
44 | 44 | ]; |