@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | { |
52 | 52 | return self::printFilteredSchema( |
53 | 53 | $schema, |
54 | - static function ($type) { |
|
55 | - return ! Directive::isSpecifiedDirective($type); |
|
54 | + static function($type) { |
|
55 | + return !Directive::isSpecifiedDirective($type); |
|
56 | 56 | }, |
57 | - static function ($type) { |
|
58 | - return ! Type::isBuiltInType($type); |
|
57 | + static function($type) { |
|
58 | + return !Type::isBuiltInType($type); |
|
59 | 59 | }, |
60 | 60 | $options |
61 | 61 | ); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $directives = array_filter( |
70 | 70 | $schema->getDirectives(), |
71 | - static function ($directive) use ($directiveFilter) { |
|
71 | + static function($directive) use ($directiveFilter) { |
|
72 | 72 | return $directiveFilter($directive); |
73 | 73 | } |
74 | 74 | ); |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | array_merge( |
86 | 86 | [self::printSchemaDefinition($schema)], |
87 | 87 | array_map( |
88 | - static function ($directive) use ($options) { |
|
88 | + static function($directive) use ($options) { |
|
89 | 89 | return self::printDirective($directive, $options); |
90 | 90 | }, |
91 | 91 | $directives |
92 | 92 | ), |
93 | 93 | array_map( |
94 | - static function ($type) use ($options) { |
|
94 | + static function($type) use ($options) { |
|
95 | 95 | return self::printType($type, $options); |
96 | 96 | }, |
97 | 97 | $types |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | private static function printDescription($options, $def, $indentation = '', $firstInBlock = true) : string |
168 | 168 | { |
169 | - if (! $def->description) { |
|
169 | + if (!$def->description) { |
|
170 | 170 | return ''; |
171 | 171 | } |
172 | 172 | $lines = self::descriptionLines($def->description, 120 - strlen($indentation)); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | return self::printDescriptionWithComments($lines, $indentation, $firstInBlock); |
175 | 175 | } |
176 | 176 | |
177 | - $description = $indentation && ! $firstInBlock |
|
177 | + $description = $indentation && !$firstInBlock |
|
178 | 178 | ? "\n" . $indentation . '"""' |
179 | 179 | : $indentation . '"""'; |
180 | 180 | |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | substr($lines[0], 0, 1) === ' ' || |
193 | 193 | substr($lines[0], 0, 1) === '\t' |
194 | 194 | ); |
195 | - if (! $hasLeadingSpace) { |
|
195 | + if (!$hasLeadingSpace) { |
|
196 | 196 | $description .= "\n"; |
197 | 197 | } |
198 | 198 | |
199 | 199 | $lineLength = count($lines); |
200 | 200 | for ($i = 0; $i < $lineLength; $i++) { |
201 | - if ($i !== 0 || ! $hasLeadingSpace) { |
|
201 | + if ($i !== 0 || !$hasLeadingSpace) { |
|
202 | 202 | $description .= $indentation; |
203 | 203 | } |
204 | 204 | $description .= self::escapeQuote($lines[$i]) . "\n"; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | private static function printDescriptionWithComments($lines, $indentation, $firstInBlock) : string |
249 | 249 | { |
250 | - $description = $indentation && ! $firstInBlock ? "\n" : ''; |
|
250 | + $description = $indentation && !$firstInBlock ? "\n" : ''; |
|
251 | 251 | foreach ($lines as $line) { |
252 | 252 | if ($line === '') { |
253 | 253 | $description .= $indentation . "#\n"; |
@@ -266,14 +266,14 @@ discard block |
||
266 | 266 | |
267 | 267 | private static function printArgs($options, $args, $indentation = '') : string |
268 | 268 | { |
269 | - if (! $args) { |
|
269 | + if (!$args) { |
|
270 | 270 | return ''; |
271 | 271 | } |
272 | 272 | |
273 | 273 | // If every arg does not have a description, print them on one line. |
274 | 274 | if (Utils::every( |
275 | 275 | $args, |
276 | - static function ($arg) { |
|
276 | + static function($arg) { |
|
277 | 277 | return empty($arg->description); |
278 | 278 | } |
279 | 279 | )) { |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | implode( |
286 | 286 | "\n", |
287 | 287 | array_map( |
288 | - static function ($arg, $i) use ($indentation, $options) { |
|
289 | - return self::printDescription($options, $arg, ' ' . $indentation, ! $i) . ' ' . $indentation . |
|
288 | + static function($arg, $i) use ($indentation, $options) { |
|
289 | + return self::printDescription($options, $arg, ' ' . $indentation, !$i) . ' ' . $indentation . |
|
290 | 290 | self::printInputValue($arg); |
291 | 291 | }, |
292 | 292 | $args, |
@@ -353,11 +353,11 @@ discard block |
||
353 | 353 | private static function printObject(ObjectType $type, array $options) : string |
354 | 354 | { |
355 | 355 | $interfaces = $type->getInterfaces(); |
356 | - $implementedInterfaces = ! empty($interfaces) |
|
356 | + $implementedInterfaces = !empty($interfaces) |
|
357 | 357 | ? ' implements ' . implode( |
358 | 358 | ' & ', |
359 | 359 | array_map( |
360 | - static function ($i) { |
|
360 | + static function($i) { |
|
361 | 361 | return $i->name; |
362 | 362 | }, |
363 | 363 | $interfaces |
@@ -379,8 +379,8 @@ discard block |
||
379 | 379 | return implode( |
380 | 380 | "\n", |
381 | 381 | array_map( |
382 | - static function ($f, $i) use ($options) { |
|
383 | - return self::printDescription($options, $f, ' ', ! $i) . ' ' . |
|
382 | + static function($f, $i) use ($options) { |
|
383 | + return self::printDescription($options, $f, ' ', !$i) . ' ' . |
|
384 | 384 | $f->name . self::printArgs($options, $f->args, ' ') . ': ' . |
385 | 385 | (string) $f->getType() . self::printDeprecated($f); |
386 | 386 | }, |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | return implode( |
440 | 440 | "\n", |
441 | 441 | array_map( |
442 | - static function ($value, $i) use ($options) { |
|
443 | - return self::printDescription($options, $value, ' ', ! $i) . ' ' . |
|
442 | + static function($value, $i) use ($options) { |
|
443 | + return self::printDescription($options, $value, ' ', !$i) . ' ' . |
|
444 | 444 | $value->name . self::printDeprecated($value); |
445 | 445 | }, |
446 | 446 | $values, |
@@ -463,8 +463,8 @@ discard block |
||
463 | 463 | implode( |
464 | 464 | "\n", |
465 | 465 | array_map( |
466 | - static function ($f, $i) use ($options) { |
|
467 | - return self::printDescription($options, $f, ' ', ! $i) . ' ' . self::printInputValue($f); |
|
466 | + static function($f, $i) use ($options) { |
|
467 | + return self::printDescription($options, $f, ' ', !$i) . ' ' . self::printInputValue($f); |
|
468 | 468 | }, |
469 | 469 | $fields, |
470 | 470 | array_keys($fields) |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function then(Promise $promise, ?callable $onFulfilled = null, ?callable $onRejected = null) : Promise |
39 | 39 | { |
40 | 40 | $deferred = new Deferred(); |
41 | - $onResolve = static function (?Throwable $reason, $value) use ($onFulfilled, $onRejected, $deferred) : void { |
|
41 | + $onResolve = static function(?Throwable $reason, $value) use ($onFulfilled, $onRejected, $deferred) : void { |
|
42 | 42 | if ($reason === null && $onFulfilled !== null) { |
43 | 43 | self::resolveWithCallable($deferred, $onFulfilled, $value); |
44 | 44 | } elseif ($reason === null) { |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | $deferred = new Deferred(); |
66 | 66 | |
67 | 67 | $resolver( |
68 | - static function ($value) use ($deferred) : void { |
|
68 | + static function($value) use ($deferred) : void { |
|
69 | 69 | $deferred->resolve($value); |
70 | 70 | }, |
71 | - static function (Throwable $exception) use ($deferred) : void { |
|
71 | + static function(Throwable $exception) use ($deferred) : void { |
|
72 | 72 | $deferred->fail($exception); |
73 | 73 | } |
74 | 74 | ); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $deferred = new Deferred(); |
115 | 115 | |
116 | - $onResolve = static function (?Throwable $reason, ?array $values) use ($promisesOrValues, $deferred) : void { |
|
116 | + $onResolve = static function(?Throwable $reason, ?array $values) use ($promisesOrValues, $deferred) : void { |
|
117 | 117 | if ($reason === null) { |
118 | 118 | $deferred->resolve(array_replace($promisesOrValues, $values)); |
119 | 119 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function convertThenable($thenable) |
33 | 33 | { |
34 | - if (! $thenable instanceof SyncPromise) { |
|
34 | + if (!$thenable instanceof SyncPromise) { |
|
35 | 35 | // End-users should always use Deferred (and don't use SyncPromise directly) |
36 | 36 | throw new InvariantViolation('Expected instance of GraphQL\Deferred, got ' . Utils::printSafe($thenable)); |
37 | 37 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | if ($promiseOrValue instanceof Promise) { |
111 | 111 | $result[$index] = null; |
112 | 112 | $promiseOrValue->then( |
113 | - static function ($value) use ($index, &$count, $total, &$result, $all) : void { |
|
113 | + static function($value) use ($index, &$count, $total, &$result, $all) : void { |
|
114 | 114 | $result[$index] = $value; |
115 | 115 | $count++; |
116 | 116 | if ($count < $total) { |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $taskQueue = SyncPromise::getQueue(); |
145 | 145 | |
146 | 146 | while ($promise->adoptedPromise->state === SyncPromise::PENDING && |
147 | - ! $taskQueue->isEmpty() |
|
147 | + !$taskQueue->isEmpty() |
|
148 | 148 | ) { |
149 | 149 | SyncPromise::runQueue(); |
150 | 150 | $this->onWait($promise); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | public static function runQueue() : void |
49 | 49 | { |
50 | 50 | $q = self::$queue; |
51 | - while ($q !== null && ! $q->isEmpty()) { |
|
51 | + while ($q !== null && !$q->isEmpty()) { |
|
52 | 52 | $task = $q->dequeue(); |
53 | 53 | $task(); |
54 | 54 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if ($executor === null) { |
63 | 63 | return; |
64 | 64 | } |
65 | - self::getQueue()->enqueue(function () use ($executor) : void { |
|
65 | + self::getQueue()->enqueue(function() use ($executor) : void { |
|
66 | 66 | try { |
67 | 67 | $this->resolve($executor()); |
68 | 68 | } catch (Throwable $e) { |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | } |
81 | 81 | if (is_object($value) && method_exists($value, 'then')) { |
82 | 82 | $value->then( |
83 | - function ($resolvedValue) : void { |
|
83 | + function($resolvedValue) : void { |
|
84 | 84 | $this->resolve($resolvedValue); |
85 | 85 | }, |
86 | - function ($reason) : void { |
|
86 | + function($reason) : void { |
|
87 | 87 | $this->reject($reason); |
88 | 88 | } |
89 | 89 | ); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | public function reject($reason) : self |
111 | 111 | { |
112 | - if (! $reason instanceof Throwable) { |
|
112 | + if (!$reason instanceof Throwable) { |
|
113 | 113 | throw new Exception('SyncPromise::reject() has to be called with an instance of \Throwable'); |
114 | 114 | } |
115 | 115 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | ); |
140 | 140 | |
141 | 141 | foreach ($this->waiting as $descriptor) { |
142 | - self::getQueue()->enqueue(function () use ($descriptor) : void { |
|
142 | + self::getQueue()->enqueue(function() use ($descriptor) : void { |
|
143 | 143 | /** @var self $promise */ |
144 | 144 | [$promise, $onFulfilled, $onRejected] = $descriptor; |
145 | 145 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | /** |
196 | 196 | * @param callable(Throwable) : mixed $onRejected |
197 | 197 | */ |
198 | - public function catch(callable $onRejected) : self |
|
198 | + public function catch (callable $onRejected) : self |
|
199 | 199 | { |
200 | 200 | return $this->then(null, $onRejected); |
201 | 201 | } |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | |
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) || ($fieldDef->defaultValueExists())) { |
|
105 | + if (isset($fieldNodeMap[$fieldName]) || !($fieldType instanceof NonNull) || ($fieldDef->defaultValueExists())) { |
|
106 | 106 | continue; |
107 | 107 | } |
108 | 108 | |
@@ -114,11 +114,11 @@ 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 | /** @var ScalarType|EnumType|InputObjectType|ListOfType|NonNull $fieldType */ |
120 | 120 | $fieldType = $context->getInputType(); |
121 | - if ($fieldType || ! ($parentType instanceof InputObjectType)) { |
|
121 | + if ($fieldType || !($parentType instanceof InputObjectType)) { |
|
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $node->name->value, |
127 | 127 | array_keys($parentType->getFields()) |
128 | 128 | ); |
129 | - $didYouMean = $suggestions |
|
129 | + $didYouMean = $suggestions |
|
130 | 130 | ? 'Did you mean ' . Utils::orList($suggestions) . '?' |
131 | 131 | : null; |
132 | 132 | |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | ) |
138 | 138 | ); |
139 | 139 | }, |
140 | - NodeKind::ENUM => function (EnumValueNode $node) use ($context, &$fieldName) { |
|
140 | + NodeKind::ENUM => function(EnumValueNode $node) use ($context, &$fieldName) { |
|
141 | 141 | $type = Type::getNamedType($context->getInputType()); |
142 | - if (! $type instanceof EnumType) { |
|
142 | + if (!$type instanceof EnumType) { |
|
143 | 143 | $this->isValidScalar($context, $node, $fieldName); |
144 | - } elseif (! $type->getValue($node->value)) { |
|
144 | + } elseif (!$type->getValue($node->value)) { |
|
145 | 145 | $context->reportError( |
146 | 146 | new Error( |
147 | 147 | self::getBadValueMessage( |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | ); |
157 | 157 | } |
158 | 158 | }, |
159 | - NodeKind::INT => function (IntValueNode $node) use ($context, &$fieldName) { |
|
159 | + NodeKind::INT => function(IntValueNode $node) use ($context, &$fieldName) { |
|
160 | 160 | $this->isValidScalar($context, $node, $fieldName); |
161 | 161 | }, |
162 | - NodeKind::FLOAT => function (FloatValueNode $node) use ($context, &$fieldName) { |
|
162 | + NodeKind::FLOAT => function(FloatValueNode $node) use ($context, &$fieldName) { |
|
163 | 163 | $this->isValidScalar($context, $node, $fieldName); |
164 | 164 | }, |
165 | - NodeKind::STRING => function (StringValueNode $node) use ($context, &$fieldName) { |
|
165 | + NodeKind::STRING => function(StringValueNode $node) use ($context, &$fieldName) { |
|
166 | 166 | $this->isValidScalar($context, $node, $fieldName); |
167 | 167 | }, |
168 | - NodeKind::BOOLEAN => function (BooleanValueNode $node) use ($context, &$fieldName) { |
|
168 | + NodeKind::BOOLEAN => function(BooleanValueNode $node) use ($context, &$fieldName) { |
|
169 | 169 | $this->isValidScalar($context, $node, $fieldName); |
170 | 170 | }, |
171 | 171 | ]; |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | /** @var ScalarType|EnumType|InputObjectType|ListOfType|NonNull $locationType */ |
187 | 187 | $locationType = $context->getInputType(); |
188 | 188 | |
189 | - if (! $locationType) { |
|
189 | + if (!$locationType) { |
|
190 | 190 | return; |
191 | 191 | } |
192 | 192 | |
193 | 193 | $type = Type::getNamedType($locationType); |
194 | 194 | |
195 | - if (! $type instanceof ScalarType) { |
|
195 | + if (!$type instanceof ScalarType) { |
|
196 | 196 | $context->reportError( |
197 | 197 | new Error( |
198 | 198 | self::getBadValueMessage( |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $suggestions = Utils::suggestionList( |
240 | 240 | Printer::doPrint($node), |
241 | 241 | array_map( |
242 | - static function (EnumValueDefinition $value) : string { |
|
242 | + static function(EnumValueDefinition $value) : string { |
|
243 | 243 | return $value->name; |
244 | 244 | }, |
245 | 245 | $type->getValues() |