@@ -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); |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | $fieldName = ''; |
52 | 52 | return [ |
53 | 53 | NodeKind::FIELD => [ |
54 | - 'enter' => static function (FieldNode $node) use (&$fieldName) { |
|
54 | + 'enter' => static function(FieldNode $node) use (&$fieldName) { |
|
55 | 55 | $fieldName = $node->name->value; |
56 | 56 | }, |
57 | 57 | ], |
58 | - NodeKind::NULL => static function (NullValueNode $node) use ($context, &$fieldName) { |
|
58 | + NodeKind::NULL => static function(NullValueNode $node) use ($context, &$fieldName) { |
|
59 | 59 | $type = $context->getInputType(); |
60 | - if (! ($type instanceof NonNull)) { |
|
60 | + if (!($type instanceof NonNull)) { |
|
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | ) |
69 | 69 | ); |
70 | 70 | }, |
71 | - NodeKind::LST => function (ListValueNode $node) use ($context, &$fieldName) { |
|
71 | + NodeKind::LST => function(ListValueNode $node) use ($context, &$fieldName) { |
|
72 | 72 | // Note: TypeInfo will traverse into a list's item type, so look to the |
73 | 73 | // parent input type to check if it is a list. |
74 | 74 | $type = Type::getNullableType($context->getParentInputType()); |
75 | - if (! $type instanceof ListOfType) { |
|
75 | + if (!$type instanceof ListOfType) { |
|
76 | 76 | $this->isValidScalar($context, $node, $fieldName); |
77 | 77 | |
78 | 78 | return Visitor::skipNode(); |
79 | 79 | } |
80 | 80 | }, |
81 | - NodeKind::OBJECT => function (ObjectValueNode $node) use ($context, &$fieldName) { |
|
81 | + NodeKind::OBJECT => function(ObjectValueNode $node) use ($context, &$fieldName) { |
|
82 | 82 | // Note: TypeInfo will traverse into a list's item type, so look to the |
83 | 83 | // parent input type to check if it is a list. |
84 | 84 | $type = Type::getNamedType($context->getInputType()); |
85 | - if (! $type instanceof InputObjectType) { |
|
85 | + if (!$type instanceof InputObjectType) { |
|
86 | 86 | $this->isValidScalar($context, $node, $fieldName); |
87 | 87 | |
88 | 88 | return Visitor::skipNode(); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $nodeFields = iterator_to_array($node->fields); |
94 | 94 | $fieldNodeMap = array_combine( |
95 | 95 | array_map( |
96 | - static function ($field) { |
|
96 | + static function($field) { |
|
97 | 97 | return $field->name->value; |
98 | 98 | }, |
99 | 99 | $nodeFields |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | ); |
103 | 103 | foreach ($inputFields as $fieldName => $fieldDef) { |
104 | 104 | $fieldType = $fieldDef->getType(); |
105 | - if (isset($fieldNodeMap[$fieldName]) || ! ($fieldType instanceof NonNull)) { |
|
105 | + if (isset($fieldNodeMap[$fieldName]) || !($fieldType instanceof NonNull)) { |
|
106 | 106 | continue; |
107 | 107 | } |
108 | 108 | |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | ); |
115 | 115 | } |
116 | 116 | }, |
117 | - NodeKind::OBJECT_FIELD => static function (ObjectFieldNode $node) use ($context) { |
|
117 | + NodeKind::OBJECT_FIELD => static function(ObjectFieldNode $node) use ($context) { |
|
118 | 118 | $parentType = Type::getNamedType($context->getParentInputType()); |
119 | 119 | $fieldType = $context->getInputType(); |
120 | - if ($fieldType || ! ($parentType instanceof InputObjectType)) { |
|
120 | + if ($fieldType || !($parentType instanceof InputObjectType)) { |
|
121 | 121 | return; |
122 | 122 | } |
123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $node->name->value, |
126 | 126 | array_keys($parentType->getFields()) |
127 | 127 | ); |
128 | - $didYouMean = $suggestions |
|
128 | + $didYouMean = $suggestions |
|
129 | 129 | ? 'Did you mean ' . Utils::orList($suggestions) . '?' |
130 | 130 | : null; |
131 | 131 | |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | ) |
137 | 137 | ); |
138 | 138 | }, |
139 | - NodeKind::ENUM => function (EnumValueNode $node) use ($context, &$fieldName) { |
|
139 | + NodeKind::ENUM => function(EnumValueNode $node) use ($context, &$fieldName) { |
|
140 | 140 | $type = Type::getNamedType($context->getInputType()); |
141 | - if (! $type instanceof EnumType) { |
|
141 | + if (!$type instanceof EnumType) { |
|
142 | 142 | $this->isValidScalar($context, $node, $fieldName); |
143 | - } elseif (! $type->getValue($node->value)) { |
|
143 | + } elseif (!$type->getValue($node->value)) { |
|
144 | 144 | $context->reportError( |
145 | 145 | new Error( |
146 | 146 | self::getBadValueMessage( |
@@ -155,16 +155,16 @@ discard block |
||
155 | 155 | ); |
156 | 156 | } |
157 | 157 | }, |
158 | - NodeKind::INT => function (IntValueNode $node) use ($context, &$fieldName) { |
|
158 | + NodeKind::INT => function(IntValueNode $node) use ($context, &$fieldName) { |
|
159 | 159 | $this->isValidScalar($context, $node, $fieldName); |
160 | 160 | }, |
161 | - NodeKind::FLOAT => function (FloatValueNode $node) use ($context, &$fieldName) { |
|
161 | + NodeKind::FLOAT => function(FloatValueNode $node) use ($context, &$fieldName) { |
|
162 | 162 | $this->isValidScalar($context, $node, $fieldName); |
163 | 163 | }, |
164 | - NodeKind::STRING => function (StringValueNode $node) use ($context, &$fieldName) { |
|
164 | + NodeKind::STRING => function(StringValueNode $node) use ($context, &$fieldName) { |
|
165 | 165 | $this->isValidScalar($context, $node, $fieldName); |
166 | 166 | }, |
167 | - NodeKind::BOOLEAN => function (BooleanValueNode $node) use ($context, &$fieldName) { |
|
167 | + NodeKind::BOOLEAN => function(BooleanValueNode $node) use ($context, &$fieldName) { |
|
168 | 168 | $this->isValidScalar($context, $node, $fieldName); |
169 | 169 | }, |
170 | 170 | ]; |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | // Report any error at the full type expected by the location. |
182 | 182 | $locationType = $context->getInputType(); |
183 | 183 | |
184 | - if (! $locationType) { |
|
184 | + if (!$locationType) { |
|
185 | 185 | return; |
186 | 186 | } |
187 | 187 | |
188 | 188 | $type = Type::getNamedType($locationType); |
189 | 189 | |
190 | - if (! $type instanceof ScalarType) { |
|
190 | + if (!$type instanceof ScalarType) { |
|
191 | 191 | $context->reportError( |
192 | 192 | new Error( |
193 | 193 | self::getBadValueMessage( |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $suggestions = Utils::suggestionList( |
246 | 246 | Printer::doPrint($node), |
247 | 247 | array_map( |
248 | - static function (EnumValueDefinition $value) { |
|
248 | + static function(EnumValueDefinition $value) { |
|
249 | 249 | return $value->name; |
250 | 250 | }, |
251 | 251 | $type->getValues() |
@@ -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 | ]; |