@@ -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 |
@@ -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 | ); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function __construct(array $config) |
81 | 81 | { |
82 | - if (! isset($config['name'])) { |
|
82 | + if (!isset($config['name'])) { |
|
83 | 83 | $config['name'] = $this->tryInferName(); |
84 | 84 | } |
85 | 85 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | ? call_user_func($interfaces) |
190 | 190 | : $interfaces; |
191 | 191 | |
192 | - if ($interfaces !== null && ! is_array($interfaces)) { |
|
192 | + if ($interfaces !== null && !is_array($interfaces)) { |
|
193 | 193 | throw new InvariantViolation( |
194 | 194 | sprintf('%s interfaces must be an Array or a callable which returns an Array.', $this->name) |
195 | 195 | ); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | public function __construct($config) |
44 | 44 | { |
45 | - if (! isset($config['name'])) { |
|
45 | + if (!isset($config['name'])) { |
|
46 | 46 | $config['name'] = $this->tryInferName(); |
47 | 47 | } |
48 | 48 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $lookup = $this->getNameLookup(); |
66 | 66 | |
67 | - if (! is_string($name)) { |
|
67 | + if (!is_string($name)) { |
|
68 | 68 | return null; |
69 | 69 | } |
70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | private function getNameLookup() : ArrayObject |
75 | 75 | { |
76 | - if (! $this->nameLookup) { |
|
76 | + if (!$this->nameLookup) { |
|
77 | 77 | /** @var ArrayObject<string, EnumValueDefinition> $lookup */ |
78 | 78 | $lookup = new ArrayObject(); |
79 | 79 | foreach ($this->getValues() as $value) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $config = $this->config; |
96 | 96 | |
97 | 97 | if (isset($config['values'])) { |
98 | - if (! is_array($config['values'])) { |
|
98 | + if (!is_array($config['values'])) { |
|
99 | 99 | throw new InvariantViolation(sprintf('%s values must be an array', $this->name)); |
100 | 100 | } |
101 | 101 | foreach ($config['values'] as $name => $value) { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $values = $this->getValues(); |
212 | 212 | foreach ($values as $value) { |
213 | 213 | Utils::invariant( |
214 | - ! isset($value->config['isDeprecated']), |
|
214 | + !isset($value->config['isDeprecated']), |
|
215 | 215 | sprintf( |
216 | 216 | '%s.%s should provide "deprecationReason" instead of "isDeprecated".', |
217 | 217 | $this->name, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | public function hasType(string $type) : bool |
81 | 81 | { |
82 | - return count(array_filter($this->getReferencedTypes(), static function (string $referencedType) use ($type) { |
|
82 | + return count(array_filter($this->getReferencedTypes(), static function(string $referencedType) use ($type) { |
|
83 | 83 | return $type === $referencedType; |
84 | 84 | })) > 0; |
85 | 85 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | public function hasField(string $field) : bool |
96 | 96 | { |
97 | - return count(array_filter($this->getReferencedFields(), static function (string $referencedField) use ($field) { |
|
97 | + return count(array_filter($this->getReferencedFields(), static function(string $referencedField) use ($field) { |
|
98 | 98 | return $field === $referencedField; |
99 | 99 | })) > 0; |
100 | 100 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function subFields(string $typename) : array |
106 | 106 | { |
107 | - if (! array_key_exists($typename, $this->types)) { |
|
107 | + if (!array_key_exists($typename, $this->types)) { |
|
108 | 108 | return []; |
109 | 109 | } |
110 | 110 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $implementors = []; |
121 | 121 | /** @var FieldNode $fieldNode */ |
122 | 122 | foreach ($fieldNodes as $fieldNode) { |
123 | - if (! $fieldNode->selectionSet) { |
|
123 | + if (!$fieldNode->selectionSet) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | private function mergeFields(Type $parentType, Type $type, array $fields, array $subfields, array &$implementors) : array |
230 | 230 | { |
231 | - if ($this->groupImplementorFields && $parentType instanceof AbstractType && ! $type instanceof AbstractType) { |
|
231 | + if ($this->groupImplementorFields && $parentType instanceof AbstractType && !$type instanceof AbstractType) { |
|
232 | 232 | $implementors[$type->name] = [ |
233 | 233 | 'type' => $type, |
234 | 234 | 'fields' => $this->arrayMergeDeep( |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | foreach ($array2 as $key => & $value) { |
270 | 270 | if (is_numeric($key)) { |
271 | - if (! in_array($value, $merged, true)) { |
|
271 | + if (!in_array($value, $merged, true)) { |
|
272 | 272 | $merged[] = $value; |
273 | 273 | } |
274 | 274 | } elseif (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) { |
@@ -41,7 +41,7 @@ |
||
41 | 41 | || is_int($value) |
42 | 42 | || (is_object($value) && method_exists($value, '__toString')); |
43 | 43 | |
44 | - if (! $canCast) { |
|
44 | + if (!$canCast) { |
|
45 | 45 | throw new Error('ID cannot represent value: ' . Utils::printSafe($value)); |
46 | 46 | } |
47 | 47 |