@@ -25,7 +25,7 @@ |
||
25 | 25 | public function getVisitor(ValidationContext $context) |
26 | 26 | { |
27 | 27 | return [ |
28 | - NodeKind::DOCUMENT => static function (DocumentNode $node) use ($context) { |
|
28 | + NodeKind::DOCUMENT => static function(DocumentNode $node) use ($context) { |
|
29 | 29 | /** @var FragmentDefinitionNode|OperationDefinitionNode|TypeSystemDefinitionNode $definition */ |
30 | 30 | foreach ($node->definitions as $definition) { |
31 | 31 | if ($definition instanceof OperationDefinitionNode || |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public static function allRules() |
126 | 126 | { |
127 | - if (! self::$initRules) { |
|
127 | + if (!self::$initRules) { |
|
128 | 128 | static::$rules = array_merge(static::defaultRules(), self::securityRules(), self::$rules); |
129 | 129 | static::$initRules = true; |
130 | 130 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | return is_array($value) |
265 | 265 | ? count(array_filter( |
266 | 266 | $value, |
267 | - static function ($item) { |
|
267 | + static function($item) { |
|
268 | 268 | return $item instanceof Throwable; |
269 | 269 | } |
270 | 270 | )) === count($value) |
@@ -101,7 +101,7 @@ |
||
101 | 101 | if (self::$warningHandler !== null) { |
102 | 102 | $fn = self::$warningHandler; |
103 | 103 | $fn($errorMessage, $warningId, $messageLevel); |
104 | - } elseif ((self::$enableWarnings & $warningId) > 0 && ! isset(self::$warned[$warningId])) { |
|
104 | + } elseif ((self::$enableWarnings & $warningId) > 0 && !isset(self::$warned[$warningId])) { |
|
105 | 105 | self::$warned[$warningId] = true; |
106 | 106 | trigger_error($errorMessage, $messageLevel); |
107 | 107 | } |
@@ -265,23 +265,23 @@ |
||
265 | 265 | ); |
266 | 266 | } elseif ($hasValue) { |
267 | 267 | if ($argumentValueNode instanceof NullValueNode) { |
268 | - // If the explicit value `null` was provided, an entry in the coerced |
|
269 | - // values must exist as the value `null`. |
|
268 | + // If the explicit value `null` was provided, an entry in the coerced |
|
269 | + // values must exist as the value `null`. |
|
270 | 270 | $coercedValues[$name] = null; |
271 | 271 | } elseif ($argumentValueNode instanceof VariableNode) { |
272 | 272 | $variableName = $argumentValueNode->name->value; |
273 | 273 | Utils::invariant($variableValues !== null, 'Must exist for hasValue to be true.'); |
274 | - // Note: This does no further checking that this variable is correct. |
|
275 | - // This assumes that this query has been validated and the variable |
|
276 | - // usage here is of the correct type. |
|
274 | + // Note: This does no further checking that this variable is correct. |
|
275 | + // This assumes that this query has been validated and the variable |
|
276 | + // usage here is of the correct type. |
|
277 | 277 | $coercedValues[$name] = $variableValues[$variableName] ?? null; |
278 | 278 | } else { |
279 | 279 | $valueNode = $argumentValueNode; |
280 | 280 | $coercedValue = AST::valueFromAST($valueNode, $argType, $variableValues); |
281 | 281 | if (Utils::isInvalid($coercedValue)) { |
282 | - // Note: ValuesOfCorrectType validation should catch this before |
|
283 | - // execution. This is a runtime check to ensure execution does not |
|
284 | - // continue with an invalid argument value. |
|
282 | + // Note: ValuesOfCorrectType validation should catch this before |
|
283 | + // execution. This is a runtime check to ensure execution does not |
|
284 | + // continue with an invalid argument value. |
|
285 | 285 | throw new Error( |
286 | 286 | 'Argument "' . $name . '" has invalid value ' . Printer::doPrint($valueNode) . '.', |
287 | 287 | [$argumentValueNode] |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** @var InputType|Type $varType */ |
68 | 68 | $varType = TypeInfo::typeFromAST($schema, $varDefNode->type); |
69 | 69 | |
70 | - if (! Type::isInputType($varType)) { |
|
70 | + if (!Type::isInputType($varType)) { |
|
71 | 71 | // Must use input types for variables. This should be caught during |
72 | 72 | // validation, however is checked again here for safety. |
73 | 73 | $errors[] = new Error( |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | $hasValue = array_key_exists($varName, $inputs); |
83 | 83 | $value = $hasValue ? $inputs[$varName] : Utils::undefined(); |
84 | 84 | |
85 | - if (! $hasValue && $varDefNode->defaultValue) { |
|
85 | + if (!$hasValue && $varDefNode->defaultValue) { |
|
86 | 86 | // If no value was provided to a variable with a default value, |
87 | 87 | // use the default value. |
88 | 88 | $coercedValues[$varName] = AST::valueFromAST($varDefNode->defaultValue, $varType); |
89 | - } elseif ((! $hasValue || $value === null) && ($varType instanceof NonNull)) { |
|
89 | + } elseif ((!$hasValue || $value === null) && ($varType instanceof NonNull)) { |
|
90 | 90 | // If no value or a nullish value was provided to a variable with a |
91 | 91 | // non-null type (required), produce an error. |
92 | 92 | $errors[] = new Error( |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | - if (! empty($errors)) { |
|
139 | + if (!empty($errors)) { |
|
140 | 140 | return [$errors, null]; |
141 | 141 | } |
142 | 142 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | if (isset($node->directives) && $node->directives instanceof NodeList) { |
161 | 161 | $directiveNode = Utils::find( |
162 | 162 | $node->directives, |
163 | - static function (DirectiveNode $directive) use ($directiveDef) : bool { |
|
163 | + static function(DirectiveNode $directive) use ($directiveDef) : bool { |
|
164 | 164 | return $directive->name->value === $directiveDef->name; |
165 | 165 | } |
166 | 166 | ); |
@@ -233,11 +233,11 @@ discard block |
||
233 | 233 | $isNull = $argumentValueNode instanceof NullValueNode; |
234 | 234 | } |
235 | 235 | |
236 | - if (! $hasValue && $argumentDefinition->defaultValueExists()) { |
|
236 | + if (!$hasValue && $argumentDefinition->defaultValueExists()) { |
|
237 | 237 | // If no argument was provided where the definition has a default value, |
238 | 238 | // use the default value. |
239 | 239 | $coercedValues[$name] = $argumentDefinition->defaultValue; |
240 | - } elseif ((! $hasValue || $isNull) && ($argType instanceof NonNull)) { |
|
240 | + } elseif ((!$hasValue || $isNull) && ($argType instanceof NonNull)) { |
|
241 | 241 | // If no argument or a null value was provided to an argument with a |
242 | 242 | // non-null type (required), produce a field error. |
243 | 243 | if ($isNull) { |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | return $errors |
329 | 329 | ? array_map( |
330 | - static function (Throwable $error) : string { |
|
330 | + static function(Throwable $error) : string { |
|
331 | 331 | return $error->getMessage(); |
332 | 332 | }, |
333 | 333 | $errors |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | Utils::getVariableType($config) |
110 | 110 | ); |
111 | 111 | Utils::invariant( |
112 | - ! $config->types || is_array($config->types) || is_callable($config->types), |
|
112 | + !$config->types || is_array($config->types) || is_callable($config->types), |
|
113 | 113 | '"types" must be array or callable if provided but got: ' . Utils::getVariableType($config->types) |
114 | 114 | ); |
115 | 115 | Utils::invariant( |
116 | - ! $config->directives || is_array($config->directives), |
|
116 | + !$config->directives || is_array($config->directives), |
|
117 | 117 | '"directives" must be Array if provided but got: ' . Utils::getVariableType($config->directives) |
118 | 118 | ); |
119 | 119 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $types = $types(); |
166 | 166 | } |
167 | 167 | |
168 | - if (! is_array($types) && ! $types instanceof Traversable) { |
|
168 | + if (!is_array($types) && !$types instanceof Traversable) { |
|
169 | 169 | throw new InvariantViolation(sprintf( |
170 | 170 | 'Schema types callable must return array or instance of Traversable but got: %s', |
171 | 171 | Utils::getVariableType($types) |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | foreach ($types as $index => $type) { |
176 | - if (! $type instanceof Type) { |
|
176 | + if (!$type instanceof Type) { |
|
177 | 177 | throw new InvariantViolation(sprintf( |
178 | 178 | 'Each entry of schema types must be instance of GraphQL\Type\Definition\Type but entry at %s is %s', |
179 | 179 | $index, |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function getTypeMap() |
198 | 198 | { |
199 | - if (! $this->fullyLoaded) { |
|
199 | + if (!$this->fullyLoaded) { |
|
200 | 200 | $this->resolvedTypes = $this->collectAllTypes(); |
201 | 201 | $this->fullyLoaded = true; |
202 | 202 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $typeMap = TypeInfo::extractTypes($type, $typeMap); |
215 | 215 | } |
216 | 216 | foreach ($this->getDirectives() as $directive) { |
217 | - if (! ($directive instanceof Directive)) { |
|
217 | + if (!($directive instanceof Directive)) { |
|
218 | 218 | continue; |
219 | 219 | } |
220 | 220 | |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | */ |
315 | 315 | public function getType(string $name) : ?Type |
316 | 316 | { |
317 | - if (! isset($this->resolvedTypes[$name])) { |
|
317 | + if (!isset($this->resolvedTypes[$name])) { |
|
318 | 318 | $type = $this->loadType($name); |
319 | - if (! $type) { |
|
319 | + if (!$type) { |
|
320 | 320 | return null; |
321 | 321 | } |
322 | 322 | $this->resolvedTypes[$name] = $type; |
@@ -334,13 +334,13 @@ discard block |
||
334 | 334 | { |
335 | 335 | $typeLoader = $this->config->typeLoader; |
336 | 336 | |
337 | - if (! $typeLoader) { |
|
337 | + if (!$typeLoader) { |
|
338 | 338 | return $this->defaultTypeLoader($typeName); |
339 | 339 | } |
340 | 340 | |
341 | 341 | $type = $typeLoader($typeName); |
342 | 342 | |
343 | - if (! $type instanceof Type) { |
|
343 | + if (!$type instanceof Type) { |
|
344 | 344 | throw new InvariantViolation( |
345 | 345 | sprintf( |
346 | 346 | 'Type loader is expected to return valid type "%s", but it returned %s', |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | foreach ($this->getTypeMap() as $type) { |
396 | 396 | if ($type instanceof ObjectType) { |
397 | 397 | foreach ($type->getInterfaces() as $interface) { |
398 | - if (! ($interface instanceof InterfaceType)) { |
|
398 | + if (!($interface instanceof InterfaceType)) { |
|
399 | 399 | continue; |
400 | 400 | } |
401 | 401 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | $type->assertValid(); |
482 | 482 | |
483 | 483 | // Make sure type loader returns the same instance as registered in other places of schema |
484 | - if (! $this->config->typeLoader) { |
|
484 | + if (!$this->config->typeLoader) { |
|
485 | 485 | continue; |
486 | 486 | } |
487 | 487 |
@@ -77,7 +77,7 @@ |
||
77 | 77 | { |
78 | 78 | $isInt = is_int($value) || (is_float($value) && floor($value) === $value); |
79 | 79 | |
80 | - if (! $isInt) { |
|
80 | + if (!$isInt) { |
|
81 | 81 | throw new Error( |
82 | 82 | 'Int cannot represent non-integer value: ' . |
83 | 83 | Utils::printSafe($value) |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function __construct(array $config) |
35 | 35 | { |
36 | - if (! isset($config['name'])) { |
|
36 | + if (!isset($config['name'])) { |
|
37 | 37 | $config['name'] = $this->tryInferName(); |
38 | 38 | } |
39 | 39 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | public function isPossibleType(Type $type) : bool |
55 | 55 | { |
56 | - if (! $type instanceof ObjectType) { |
|
56 | + if (!$type instanceof ObjectType) { |
|
57 | 57 | return false; |
58 | 58 | } |
59 | 59 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public function getTypes() |
74 | 74 | { |
75 | 75 | if ($this->types === null) { |
76 | - if (! isset($this->config['types'])) { |
|
76 | + if (!isset($this->config['types'])) { |
|
77 | 77 | $types = null; |
78 | 78 | } elseif (is_callable($this->config['types'])) { |
79 | 79 | $types = call_user_func($this->config['types']); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $types = $this->config['types']; |
82 | 82 | } |
83 | 83 | |
84 | - if (! is_array($types)) { |
|
84 | + if (!is_array($types)) { |
|
85 | 85 | throw new InvariantViolation( |
86 | 86 | sprintf( |
87 | 87 | 'Must provide Array of types or a callable which returns such an array for Union %s', |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | parent::assertValid(); |
124 | 124 | |
125 | - if (! isset($this->config['resolveType'])) { |
|
125 | + if (!isset($this->config['resolveType'])) { |
|
126 | 126 | return; |
127 | 127 | } |
128 | 128 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | $float = is_numeric($value) || is_bool($value) ? floatval($value) : null; |
39 | 39 | |
40 | - if ($float === null || ! is_finite($float)) { |
|
40 | + if ($float === null || !is_finite($float)) { |
|
41 | 41 | throw new Error( |
42 | 42 | 'Float cannot represent non numeric value: ' . |
43 | 43 | Utils::printSafe($value) |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | $float = is_float($value) || is_int($value) ? floatval($value) : null; |
58 | 58 | |
59 | - if ($float === null || ! is_finite($float)) { |
|
59 | + if ($float === null || !is_finite($float)) { |
|
60 | 60 | throw new Error( |
61 | 61 | 'Float cannot represent non numeric value: ' . |
62 | 62 | Utils::printSafe($value) |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | || (is_object($value) && method_exists($value, '__toString')) |
39 | 39 | || $value === null; |
40 | 40 | |
41 | - if (! $canCast) { |
|
41 | + if (!$canCast) { |
|
42 | 42 | throw new Error( |
43 | 43 | 'String cannot represent value: ' . Utils::printSafe($value) |
44 | 44 | ); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function parseValue($value) |
58 | 58 | { |
59 | - if (! is_string($value)) { |
|
59 | + if (!is_string($value)) { |
|
60 | 60 | throw new Error( |
61 | 61 | 'String cannot represent a non string value: ' . Utils::printSafe($value) |
62 | 62 | ); |