@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $instance = new static(); |
44 | 44 | foreach ($config as $key => $value) { |
45 | 45 | $method = 'set' . ucfirst($key); |
46 | - if (! method_exists($instance, $method)) { |
|
46 | + if (!method_exists($instance, $method)) { |
|
47 | 47 | throw new InvariantViolation(sprintf('Unknown server config option "%s"', $key)); |
48 | 48 | } |
49 | 49 | $instance->$method($value); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function setValidationRules($validationRules) |
157 | 157 | { |
158 | - if (! is_callable($validationRules) && ! is_array($validationRules) && $validationRules !== null) { |
|
158 | + if (!is_callable($validationRules) && !is_array($validationRules) && $validationRules !== null) { |
|
159 | 159 | throw new InvariantViolation( |
160 | 160 | 'Server config expects array of validation rules or callable returning such array, but got ' . |
161 | 161 | Utils::printSafe($validationRules) |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if ($error->nodes) { |
66 | 66 | /** @var Node $node */ |
67 | 67 | foreach ($error->nodes as $node) { |
68 | - if (! $node->loc) { |
|
68 | + if (!$node->loc) { |
|
69 | 69 | continue; |
70 | 70 | } |
71 | 71 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - return ! $printedLocations |
|
88 | + return !$printedLocations |
|
89 | 89 | ? $error->getMessage() |
90 | 90 | : implode("\n\n", array_merge([$error->getMessage()], $printedLocations)) . "\n"; |
91 | 91 | } |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | if ($e instanceof Error) { |
190 | 190 | $locations = Utils::map( |
191 | 191 | $e->getLocations(), |
192 | - function (SourceLocation $loc) { |
|
192 | + function(SourceLocation $loc) { |
|
193 | 193 | return $loc->toSerializableArray(); |
194 | 194 | } |
195 | 195 | ); |
196 | - if (! empty($locations)) { |
|
196 | + if (!empty($locations)) { |
|
197 | 197 | $formattedError['locations'] = $locations; |
198 | 198 | } |
199 | - if (! empty($e->path)) { |
|
199 | + if (!empty($e->path)) { |
|
200 | 200 | $formattedError['path'] = $e->path; |
201 | 201 | } |
202 | - if (! empty($e->getExtensions())) { |
|
202 | + if (!empty($e->getExtensions())) { |
|
203 | 203 | $formattedError['extensions'] = $e->getExtensions(); |
204 | 204 | } |
205 | 205 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public static function addDebugEntries(array $formattedError, $e, $debug) |
225 | 225 | { |
226 | - if (! $debug) { |
|
226 | + if (!$debug) { |
|
227 | 227 | return $formattedError; |
228 | 228 | } |
229 | 229 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $debug = (int) $debug; |
237 | 237 | |
238 | 238 | if ($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) { |
239 | - if (! $e instanceof Error) { |
|
239 | + if (!$e instanceof Error) { |
|
240 | 240 | throw $e; |
241 | 241 | } |
242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
248 | - $isInternal = ! $e instanceof ClientAware || ! $e->isClientSafe(); |
|
248 | + $isInternal = !$e instanceof ClientAware || !$e->isClientSafe(); |
|
249 | 249 | |
250 | 250 | if (($debug & Debug::INCLUDE_DEBUG_MESSAGE) && $isInternal) { |
251 | 251 | // Displaying debugMessage as a first entry: |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | ]; |
261 | 261 | } |
262 | 262 | |
263 | - $isTrivial = $e instanceof Error && ! $e->getPrevious(); |
|
263 | + $isTrivial = $e instanceof Error && !$e->getPrevious(); |
|
264 | 264 | |
265 | - if (! $isTrivial) { |
|
265 | + if (!$isTrivial) { |
|
266 | 266 | $debugging = $e->getPrevious() ?: $e; |
267 | 267 | $formattedError['trace'] = static::toSafeTrace($debugging); |
268 | 268 | } |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | */ |
281 | 281 | public static function prepareFormatter(?callable $formatter = null, $debug) |
282 | 282 | { |
283 | - $formatter = $formatter ?: function ($e) { |
|
283 | + $formatter = $formatter ?: function($e) { |
|
284 | 284 | return FormattedError::createFromException($e); |
285 | 285 | }; |
286 | 286 | if ($debug) { |
287 | - $formatter = function ($e) use ($formatter, $debug) { |
|
287 | + $formatter = function($e) use ($formatter, $debug) { |
|
288 | 288 | return FormattedError::addDebugEntries($formatter($e), $e, $debug); |
289 | 289 | }; |
290 | 290 | } |
@@ -307,18 +307,18 @@ discard block |
||
307 | 307 | // Remove invariant entries as they don't provide much value: |
308 | 308 | ($trace[0]['class'] . '::' . $trace[0]['function'] === 'GraphQL\Utils\Utils::invariant')) { |
309 | 309 | array_shift($trace); |
310 | - } elseif (! isset($trace[0]['file'])) { |
|
310 | + } elseif (!isset($trace[0]['file'])) { |
|
311 | 311 | // Remove root call as it's likely error handler trace: |
312 | 312 | array_shift($trace); |
313 | 313 | } |
314 | 314 | |
315 | 315 | return array_map( |
316 | - function ($err) { |
|
316 | + function($err) { |
|
317 | 317 | $safeErr = array_intersect_key($err, ['file' => true, 'line' => true]); |
318 | 318 | |
319 | 319 | if (isset($err['function'])) { |
320 | 320 | $func = $err['function']; |
321 | - $args = ! empty($err['args']) ? array_map([__CLASS__, 'printVar'], $err['args']) : []; |
|
321 | + $args = !empty($err['args']) ? array_map([__CLASS__, 'printVar'], $err['args']) : []; |
|
322 | 322 | $funcStr = $func . '(' . implode(', ', $args) . ')'; |
323 | 323 | |
324 | 324 | if (isset($err['class'])) { |
@@ -384,9 +384,9 @@ discard block |
||
384 | 384 | { |
385 | 385 | $formatted = ['message' => $error]; |
386 | 386 | |
387 | - if (! empty($locations)) { |
|
387 | + if (!empty($locations)) { |
|
388 | 388 | $formatted['locations'] = array_map( |
389 | - function ($loc) { |
|
389 | + function($loc) { |
|
390 | 390 | return $loc->toArray(); |
391 | 391 | }, |
392 | 392 | $locations |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | |
26 | 26 | return [ |
27 | 27 | NodeKind::OPERATION_DEFINITION => [ |
28 | - 'enter' => function () use (&$variableNameDefined) { |
|
28 | + 'enter' => function() use (&$variableNameDefined) { |
|
29 | 29 | $variableNameDefined = []; |
30 | 30 | }, |
31 | - 'leave' => function (OperationDefinitionNode $operation) use (&$variableNameDefined, $context) { |
|
31 | + 'leave' => function(OperationDefinitionNode $operation) use (&$variableNameDefined, $context) { |
|
32 | 32 | $usages = $context->getRecursiveVariableUsages($operation); |
33 | 33 | |
34 | 34 | foreach ($usages as $usage) { |
35 | 35 | $node = $usage['node']; |
36 | 36 | $varName = $node->name->value; |
37 | 37 | |
38 | - if (! empty($variableNameDefined[$varName])) { |
|
38 | + if (!empty($variableNameDefined[$varName])) { |
|
39 | 39 | continue; |
40 | 40 | } |
41 | 41 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | }, |
51 | 51 | ], |
52 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $def) use (&$variableNameDefined) { |
|
52 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $def) use (&$variableNameDefined) { |
|
53 | 53 | $variableNameDefined[$def->variable->name->value] = true; |
54 | 54 | }, |
55 | 55 | ]; |
@@ -18,11 +18,11 @@ |
||
18 | 18 | public function getVisitor(ValidationContext $context) |
19 | 19 | { |
20 | 20 | return [ |
21 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $node) use ($context) { |
|
21 | + NodeKind::VARIABLE_DEFINITION => 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,10 +22,10 @@ discard block |
||
22 | 22 | |
23 | 23 | return [ |
24 | 24 | NodeKind::OPERATION_DEFINITION => [ |
25 | - 'enter' => function () { |
|
25 | + 'enter' => function() { |
|
26 | 26 | $this->variableDefs = []; |
27 | 27 | }, |
28 | - 'leave' => function (OperationDefinitionNode $operation) use ($context) { |
|
28 | + 'leave' => function(OperationDefinitionNode $operation) use ($context) { |
|
29 | 29 | $variableNameUsed = []; |
30 | 30 | $usages = $context->getRecursiveVariableUsages($operation); |
31 | 31 | $opName = $operation->name ? $operation->name->value : null; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | foreach ($this->variableDefs as $variableDef) { |
39 | 39 | $variableName = $variableDef->variable->name->value; |
40 | 40 | |
41 | - if (! empty($variableNameUsed[$variableName])) { |
|
41 | + if (!empty($variableNameUsed[$variableName])) { |
|
42 | 42 | continue; |
43 | 43 | } |
44 | 44 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | }, |
51 | 51 | ], |
52 | - NodeKind::VARIABLE_DEFINITION => function ($def) { |
|
52 | + NodeKind::VARIABLE_DEFINITION => function($def) { |
|
53 | 53 | $this->variableDefs[] = $def; |
54 | 54 | }, |
55 | 55 | ]; |
@@ -15,8 +15,8 @@ |
||
15 | 15 | public function getVisitor(ValidationContext $context) |
16 | 16 | { |
17 | 17 | return [ |
18 | - 'enter' => function (Node $node) use ($context) { |
|
19 | - if (! isset($node->directives)) { |
|
18 | + 'enter' => function(Node $node) use ($context) { |
|
19 | + if (!isset($node->directives)) { |
|
20 | 20 | return; |
21 | 21 | } |
22 | 22 |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | public function getVisitor(ValidationContext $context) |
20 | 20 | { |
21 | 21 | return [ |
22 | - NodeKind::INLINE_FRAGMENT => function (InlineFragmentNode $node) use ($context) { |
|
23 | - if (! $node->typeCondition) { |
|
22 | + NodeKind::INLINE_FRAGMENT => 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 => function (FragmentDefinitionNode $node) use ($context) { |
|
37 | + NodeKind::FRAGMENT_DEFINITION => 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 |
@@ -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 => function () { |
|
41 | + NodeKind::FRAGMENT_DEFINITION => function() { |
|
42 | 42 | return Visitor::skipNode(); |
43 | 43 | }, |
44 | 44 | ]; |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | { |
25 | 25 | return [ |
26 | 26 | NodeKind::OPERATION_DEFINITION => [ |
27 | - 'enter' => function () { |
|
27 | + 'enter' => function() { |
|
28 | 28 | $this->varDefMap = []; |
29 | 29 | }, |
30 | - 'leave' => function (OperationDefinitionNode $operation) use ($context) { |
|
30 | + 'leave' => function(OperationDefinitionNode $operation) use ($context) { |
|
31 | 31 | $usages = $context->getRecursiveVariableUsages($operation); |
32 | 32 | |
33 | 33 | foreach ($usages as $usage) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $varName = $node->name->value; |
37 | 37 | $varDef = $this->varDefMap[$varName] ?? null; |
38 | 38 | |
39 | - if (! $varDef || ! $type) { |
|
39 | + if (!$varDef || !$type) { |
|
40 | 40 | continue; |
41 | 41 | } |
42 | 42 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $schema = $context->getSchema(); |
49 | 49 | $varType = TypeInfo::typeFromAST($schema, $varDef->type); |
50 | 50 | |
51 | - if (! $varType || TypeComparators::isTypeSubTypeOf( |
|
51 | + if (!$varType || TypeComparators::isTypeSubTypeOf( |
|
52 | 52 | $schema, |
53 | 53 | $this->effectiveType($varType, $varDef), |
54 | 54 | $type |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | }, |
65 | 65 | ], |
66 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $varDefNode) { |
|
66 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $varDefNode) { |
|
67 | 67 | $this->varDefMap[$varDefNode->variable->name->value] = $varDefNode; |
68 | 68 | }, |
69 | 69 | ]; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | private function effectiveType($varType, $varDef) |
73 | 73 | { |
74 | - return (! $varDef->defaultValue || $varType instanceof NonNull) ? $varType : new NonNull($varType); |
|
74 | + return (!$varDef->defaultValue || $varType instanceof NonNull) ? $varType : new NonNull($varType); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |