@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | $current->server->all() |
99 | 99 | ); |
100 | 100 | |
101 | - $request->attributes->set('_graphql_subrequest', function () use ($buffer) { |
|
102 | - return array_map(function ($item) { |
|
101 | + $request->attributes->set('_graphql_subrequest', function() use ($buffer) { |
|
102 | + return array_map(function($item) { |
|
103 | 103 | return $item['extract']($item['url']); |
104 | 104 | }, $buffer); |
105 | 105 | }); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $response->addCacheableDependency($url); |
146 | 146 | } |
147 | 147 | |
148 | - return array_map(function ($value) use ($response) { |
|
148 | + return array_map(function($value) use ($response) { |
|
149 | 149 | return new CacheableValue($value, [$response]); |
150 | 150 | }, $response->getResult()); |
151 | 151 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | */ |
40 | 40 | public function __sleep() { |
41 | 41 | // TODO: Find a better way to solve this. |
42 | - return array_filter(array_keys(get_object_vars($this)), function ($prop) { |
|
42 | + return array_filter(array_keys(get_object_vars($this)), function($prop) { |
|
43 | 43 | return $prop != 'errors'; |
44 | 44 | }); |
45 | 45 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function executeBatch(ServerConfig $config, array $params) { |
133 | 133 | $adapter = new SyncPromiseAdapter(); |
134 | - $result = array_map(function ($params) use ($adapter, $config) { |
|
134 | + $result = array_map(function($params) use ($adapter, $config) { |
|
135 | 135 | return $this->executeOperationWithReporting($adapter, $config, $params, TRUE); |
136 | 136 | }, $params); |
137 | 137 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $result = $this->executeOperation($adapter, $config, $params, $batching); |
152 | 152 | |
153 | 153 | // Format and print errors. |
154 | - return $result->then(function (QueryResult $result) use ($config) { |
|
154 | + return $result->then(function(QueryResult $result) use ($config) { |
|
155 | 155 | if ($config->getErrorsHandler()) { |
156 | 156 | $result->setErrorsHandler($config->getErrorsHandler()); |
157 | 157 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | } |
242 | 242 | |
243 | 243 | $result = $this->doExecuteOperation($adapter, $config, $params, $document, $validate); |
244 | - return $result->then(function (QueryResult $result) use ($contextCacheId, $params, $document) { |
|
244 | + return $result->then(function(QueryResult $result) use ($contextCacheId, $params, $document) { |
|
245 | 245 | // Write this query into the cache if it is cacheable. |
246 | 246 | if ($result->getCacheMaxAge() !== 0) { |
247 | 247 | $contexts = $result->getCacheContexts(); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | protected function executeUncachableOperation(PromiseAdapter $adapter, ServerConfig $config, OperationParams $params, DocumentNode $document, $validate = TRUE) { |
269 | 269 | $result = $this->doExecuteOperation($adapter, $config, $params, $document, $validate); |
270 | - return $result->then(function (QueryResult $result) { |
|
270 | + return $result->then(function(QueryResult $result) { |
|
271 | 271 | // Mark the query result as uncacheable. |
272 | 272 | $result->mergeCacheMaxAge(0); |
273 | 273 | return $result; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $resolver |
309 | 309 | ); |
310 | 310 | |
311 | - return $promise->then(function (ExecutionResult $result) use ($context) { |
|
311 | + return $promise->then(function(ExecutionResult $result) use ($context) { |
|
312 | 312 | $metadata = (new CacheableMetadata()) |
313 | 313 | ->addCacheContexts($context->getCacheContexts()) |
314 | 314 | ->addCacheTags($context->getCacheTags()) |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | */ |
331 | 331 | protected function validateOperationParams(OperationParams $params) { |
332 | 332 | $errors = (new Helper())->validateOperationParams($params); |
333 | - return array_map(function (RequestError $error) { |
|
333 | + return array_map(function(RequestError $error) { |
|
334 | 334 | return Error::createLocatedError($error, NULL, NULL); |
335 | 335 | }, $errors); |
336 | 336 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $schema = $config->getSchema(); |
354 | 354 | $info = new TypeInfo($schema); |
355 | 355 | $validation = new ValidationContext($schema, $document, $info); |
356 | - $visitors = array_values(array_map(function (AbstractValidationRule $rule) use ($validation, $params) { |
|
356 | + $visitors = array_values(array_map(function(AbstractValidationRule $rule) use ($validation, $params) { |
|
357 | 357 | // Set current variable values for QueryComplexity validation rule case. |
358 | 358 | // @see \GraphQL\GraphQL::promiseToExecute for equivalent |
359 | 359 | if ($rule instanceof QueryComplexity && !empty($params->variables)) { |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | * The filtered list of context id's. |
510 | 510 | */ |
511 | 511 | protected function filterCacheContexts(array $contexts) { |
512 | - return array_filter($contexts, function ($context) { |
|
512 | + return array_filter($contexts, function($context) { |
|
513 | 513 | return strpos($context, 'languages:') !== 0; |
514 | 514 | }); |
515 | 515 | } |
@@ -207,16 +207,13 @@ |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | return $this->executeUncachableOperation($adapter, $config, $params, $document, !$persisted); |
210 | - } |
|
211 | - catch (CacheableRequestError $exception) { |
|
210 | + } catch (CacheableRequestError $exception) { |
|
212 | 211 | return $adapter->createFulfilled( |
213 | 212 | new QueryResult(NULL, [Error::createLocatedError($exception)], [], $exception) |
214 | 213 | ); |
215 | - } |
|
216 | - catch (RequestError $exception) { |
|
214 | + } catch (RequestError $exception) { |
|
217 | 215 | return $adapter->createFulfilled(new QueryResult(NULL, [Error::createLocatedError($exception)])); |
218 | - } |
|
219 | - catch (Error $exception) { |
|
216 | + } catch (Error $exception) { |
|
220 | 217 | return $adapter->createFulfilled(new QueryResult(NULL, [$exception])); |
221 | 218 | } |
222 | 219 | } |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | $subscriptionMap = $this->buildSubscriptionMap($this->subscriptionManager); |
107 | 107 | |
108 | 108 | $managers = array_merge([$this->fieldManager, $this->mutationManager, $this->subscriptionManager], iterator_to_array($this->typeManagers)); |
109 | - $cacheTags = array_reduce($managers, function ($carry, CacheableDependencyInterface $current) { |
|
109 | + $cacheTags = array_reduce($managers, function($carry, CacheableDependencyInterface $current) { |
|
110 | 110 | return Cache::mergeTags($carry, $current->getCacheTags()); |
111 | 111 | }, []); |
112 | 112 | |
113 | - $cacheContexts = array_reduce($managers, function ($carry, CacheableDependencyInterface $current) { |
|
113 | + $cacheContexts = array_reduce($managers, function($carry, CacheableDependencyInterface $current) { |
|
114 | 114 | return Cache::mergeContexts($carry, $current->getCacheContexts()); |
115 | 115 | }, []); |
116 | 116 | |
117 | - $cacheMaxAge = array_reduce($managers, function ($carry, CacheableDependencyInterface $current) { |
|
117 | + $cacheMaxAge = array_reduce($managers, function($carry, CacheableDependencyInterface $current) { |
|
118 | 118 | return Cache::mergeMaxAges($carry, $current->getCacheMaxAge()); |
119 | 119 | }, Cache::PERMANENT); |
120 | 120 | |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | // the class from the plugin definition to be able to statically create |
150 | 150 | // the type instance without loading the plugin managers at all at |
151 | 151 | // run-time. |
152 | - $types = array_reduce(array_keys($managers), function ($carry, $type) use ($managers) { |
|
152 | + $types = array_reduce(array_keys($managers), function($carry, $type) use ($managers) { |
|
153 | 153 | $manager = $managers[$type]; |
154 | 154 | $definitions = $manager->getDefinitions(); |
155 | 155 | |
156 | - return array_reduce(array_keys($definitions), function ($carry, $id) use ($type, $definitions) { |
|
156 | + return array_reduce(array_keys($definitions), function($carry, $id) use ($type, $definitions) { |
|
157 | 157 | $current = $definitions[$id]; |
158 | 158 | $name = $current['name']; |
159 | 159 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | // plugin instantiation at run-time unless a plugin is actually called from |
176 | 176 | // the graphql query execution. Plugins should take care of not having to |
177 | 177 | // instantiate their plugin instances during schema composition. |
178 | - return array_map(function ($type) use ($managers) { |
|
178 | + return array_map(function($type) use ($managers) { |
|
179 | 179 | $manager = $managers[$type['type']]; |
180 | 180 | /** @var \Drupal\graphql\Plugin\TypePluginInterface $instance */ |
181 | 181 | $instance = $manager->getInstance(['id' => $type['id']]); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * The optimized list of data type to type name references. |
197 | 197 | */ |
198 | 198 | protected function buildTypeReferenceMap(array $types) { |
199 | - $references = array_reduce(array_keys($types), function ($references, $name) use ($types) { |
|
199 | + $references = array_reduce(array_keys($types), function($references, $name) use ($types) { |
|
200 | 200 | $current = $types[$name]; |
201 | 201 | $reference = $current['reference']; |
202 | 202 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | return $references; |
211 | 211 | }, []); |
212 | 212 | |
213 | - return array_map(function ($reference) { |
|
213 | + return array_map(function($reference) { |
|
214 | 214 | return $reference['name']; |
215 | 215 | }, $references); |
216 | 216 | } |
@@ -228,11 +228,11 @@ discard block |
||
228 | 228 | */ |
229 | 229 | protected function buildFieldAssociationMap(FieldPluginManager $manager, $types) { |
230 | 230 | $definitions = $manager->getDefinitions(); |
231 | - $fields = array_reduce(array_keys($definitions), function ($carry, $id) use ($definitions, $types) { |
|
231 | + $fields = array_reduce(array_keys($definitions), function($carry, $id) use ($definitions, $types) { |
|
232 | 232 | $current = $definitions[$id]; |
233 | 233 | $parents = $current['parents'] ?: ['Root']; |
234 | 234 | |
235 | - return array_reduce($parents, function ($carry, $parent) use ($current, $id, $types) { |
|
235 | + return array_reduce($parents, function($carry, $parent) use ($current, $id, $types) { |
|
236 | 236 | // Allow plugins to define a different name for each parent. |
237 | 237 | if (strpos($parent, ':') !== FALSE) { |
238 | 238 | list($parent, $name) = explode(':', $parent); |
@@ -277,13 +277,13 @@ discard block |
||
277 | 277 | |
278 | 278 | // Only return fields for types that are actually fieldable. |
279 | 279 | $fieldable = [GRAPHQL_TYPE_PLUGIN, GRAPHQL_INTERFACE_PLUGIN]; |
280 | - $fields = array_intersect_key($fields, array_filter($types, function ($type) use ($fieldable) { |
|
280 | + $fields = array_intersect_key($fields, array_filter($types, function($type) use ($fieldable) { |
|
281 | 281 | return in_array($type['type'], $fieldable); |
282 | 282 | }) + ['Root' => NULL]); |
283 | 283 | |
284 | 284 | // We only need the plugin ids in this map. |
285 | - return array_map(function ($fields) { |
|
286 | - return array_map(function ($field) { |
|
285 | + return array_map(function($fields) { |
|
286 | + return array_map(function($field) { |
|
287 | 287 | return $field['id']; |
288 | 288 | }, $fields); |
289 | 289 | }, $fields); |
@@ -299,19 +299,19 @@ discard block |
||
299 | 299 | * The optimized list of types and their associated unions/interfaces. |
300 | 300 | */ |
301 | 301 | protected function buildTypeAssociationMap(array $types) { |
302 | - $assocations = array_filter(array_map(function ($type) use ($types) { |
|
302 | + $assocations = array_filter(array_map(function($type) use ($types) { |
|
303 | 303 | // If this is an object type, just return a mapping for it's interfaces. |
304 | 304 | if ($type['type'] === 'type') { |
305 | - return array_map(function () use ($type) { |
|
305 | + return array_map(function() use ($type) { |
|
306 | 306 | return [$type['definition']['name']]; |
307 | 307 | }, array_flip($type['definition']['interfaces'])); |
308 | 308 | } |
309 | 309 | |
310 | 310 | // For interfaces, find all object types that declare to implement it. |
311 | 311 | if ($type['type'] === 'interface') { |
312 | - return [$type['definition']['name'] => array_values(array_map(function ($type) { |
|
312 | + return [$type['definition']['name'] => array_values(array_map(function($type) { |
|
313 | 313 | return $type['definition']['name']; |
314 | - }, array_filter($types, function ($subType) use ($type) { |
|
314 | + }, array_filter($types, function($subType) use ($type) { |
|
315 | 315 | return $subType['type'] === 'type' && in_array($type['definition']['name'], $subType['definition']['interfaces']); |
316 | 316 | })))]; |
317 | 317 | } |
@@ -320,9 +320,9 @@ discard block |
||
320 | 320 | if ($type['type'] === 'union') { |
321 | 321 | $explicit = $type['definition']['types']; |
322 | 322 | |
323 | - $implicit = array_values(array_map(function ($type) { |
|
323 | + $implicit = array_values(array_map(function($type) { |
|
324 | 324 | return $type['definition']['name']; |
325 | - }, array_filter($types, function ($subType) use ($type) { |
|
325 | + }, array_filter($types, function($subType) use ($type) { |
|
326 | 326 | return $subType['type'] === 'type' && in_array($type['definition']['name'], $subType['definition']['unions']); |
327 | 327 | }))); |
328 | 328 | |
@@ -333,15 +333,15 @@ discard block |
||
333 | 333 | }, $types)); |
334 | 334 | |
335 | 335 | $assocations = array_map('array_unique', array_reduce($assocations, 'array_merge_recursive', [])); |
336 | - $assocations = array_map(function ($parent) use ($types) { |
|
337 | - $children = array_map(function ($child) use ($types) { |
|
336 | + $assocations = array_map(function($parent) use ($types) { |
|
337 | + $children = array_map(function($child) use ($types) { |
|
338 | 338 | return $types[$child] + ['name' => $child]; |
339 | 339 | }, $parent); |
340 | 340 | |
341 | - uasort($children,[SortArray::class, 'sortByWeightElement']); |
|
341 | + uasort($children, [SortArray::class, 'sortByWeightElement']); |
|
342 | 342 | $children = array_reverse($children); |
343 | 343 | |
344 | - return array_map(function ($child) { |
|
344 | + return array_map(function($child) { |
|
345 | 345 | return $child['name']; |
346 | 346 | }, $children); |
347 | 347 | }, $assocations); |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | * The optimized list of all registered fields. |
362 | 362 | */ |
363 | 363 | protected function buildFieldMap(FieldPluginManager $manager, $association) { |
364 | - return array_reduce($association, function ($carry, $fields) use ($manager) { |
|
365 | - return array_reduce($fields, function ($carry, $id) use ($manager) { |
|
364 | + return array_reduce($association, function($carry, $fields) use ($manager) { |
|
365 | + return array_reduce($fields, function($carry, $id) use ($manager) { |
|
366 | 366 | if (!isset($carry[$id])) { |
367 | 367 | $instance = $manager->getInstance(['id' => $id]); |
368 | 368 | $definition = $manager->getDefinition($id); |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | */ |
391 | 391 | protected function buildMutationMap(MutationPluginManager $manager) { |
392 | 392 | $definitions = $manager->getDefinitions(); |
393 | - $mutations = array_reduce(array_keys($definitions), function ($carry, $id) use ($definitions) { |
|
393 | + $mutations = array_reduce(array_keys($definitions), function($carry, $id) use ($definitions) { |
|
394 | 394 | $current = $definitions[$id]; |
395 | 395 | $name = $current['name']; |
396 | 396 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | return $carry; |
406 | 406 | }, []); |
407 | 407 | |
408 | - return array_map(function ($definition) use ($manager) { |
|
408 | + return array_map(function($definition) use ($manager) { |
|
409 | 409 | $id = $definition['id']; |
410 | 410 | $instance = $manager->getInstance(['id' => $id]); |
411 | 411 | |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | */ |
427 | 427 | protected function buildSubscriptionMap(SubscriptionPluginManager $manager) { |
428 | 428 | $definitions = $manager->getDefinitions(); |
429 | - $subscriptions = array_reduce(array_keys($definitions), function ($carry, $id) use ($definitions) { |
|
429 | + $subscriptions = array_reduce(array_keys($definitions), function($carry, $id) use ($definitions) { |
|
430 | 430 | $current = $definitions[$id]; |
431 | 431 | $name = $current['name']; |
432 | 432 | |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | return $carry; |
442 | 442 | }, []); |
443 | 443 | |
444 | - return array_map(function ($definition) use ($manager) { |
|
444 | + return array_map(function($definition) use ($manager) { |
|
445 | 445 | $id = $definition['id']; |
446 | 446 | $instance = $manager->getInstance(['id' => $id]); |
447 | 447 |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | if ($this->hasMutations()) { |
202 | 202 | $config->setMutation(new ObjectType([ |
203 | 203 | 'name' => 'Mutation', |
204 | - 'fields' => function () { |
|
204 | + 'fields' => function() { |
|
205 | 205 | return $this->getMutations(); |
206 | 206 | }, |
207 | 207 | ])); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | if ($this->hasSubscriptions()) { |
211 | 211 | $config->setSubscription(new ObjectType([ |
212 | 212 | 'name' => 'Subscription', |
213 | - 'fields' => function () { |
|
213 | + 'fields' => function() { |
|
214 | 214 | return $this->getSubscriptions(); |
215 | 215 | }, |
216 | 216 | ])); |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | |
219 | 219 | $config->setQuery(new ObjectType([ |
220 | 220 | 'name' => 'Query', |
221 | - 'fields' => function () { |
|
221 | + 'fields' => function() { |
|
222 | 222 | return $this->getFields('Root'); |
223 | 223 | }, |
224 | 224 | ])); |
225 | 225 | |
226 | - $config->setTypes(function () { |
|
226 | + $config->setTypes(function() { |
|
227 | 227 | return $this->getTypes(); |
228 | 228 | }); |
229 | 229 | |
230 | - $config->setTypeLoader(function ($name) { |
|
230 | + $config->setTypeLoader(function($name) { |
|
231 | 231 | return $this->getType($name); |
232 | 232 | }); |
233 | 233 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | // Each document (e.g. in a batch query) gets its own resolve context. This |
256 | 256 | // allows us to collect the cache metadata and contextual values (e.g. |
257 | 257 | // inheritance for language) for each query separately. |
258 | - $config->setContext(function ($params, $document, $operation) use ($globals) { |
|
258 | + $config->setContext(function($params, $document, $operation) use ($globals) { |
|
259 | 259 | // Each document (e.g. in a batch query) gets its own resolve context. This |
260 | 260 | // allows us to collect the cache metadata and contextual values (e.g. |
261 | 261 | // inheritance for language) for each query separately. |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | return $context; |
277 | 277 | }); |
278 | 278 | |
279 | - $config->setValidationRules(function (OperationParams $params, DocumentNode $document, $operation) { |
|
279 | + $config->setValidationRules(function(OperationParams $params, DocumentNode $document, $operation) { |
|
280 | 280 | if (isset($params->queryId) && empty($params->getOriginalInput('query'))) { |
281 | 281 | // Assume that pre-parsed documents are already validated. This allows |
282 | 282 | // us to store pre-validated query documents e.g. for persisted queries |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $config->setSchema($this->getSchema()); |
294 | 294 | |
295 | 295 | // Always log the errors. |
296 | - $config->setErrorsHandler(function (array $errors, callable $formatter) { |
|
296 | + $config->setErrorsHandler(function(array $errors, callable $formatter) { |
|
297 | 297 | /** @var \GraphQL\Error\Error $error */ |
298 | 298 | foreach ($errors as $error) { |
299 | 299 | $this->logger->error($error->getMessage()); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $fields = $this->pluginDefinition['field_map']; |
342 | 342 | |
343 | 343 | if (isset($association[$type])) { |
344 | - return $this->processFields(array_map(function ($id) use ($fields) { |
|
344 | + return $this->processFields(array_map(function($id) use ($fields) { |
|
345 | 345 | return $fields[$id]; |
346 | 346 | }, $association[$type])); |
347 | 347 | } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | * {@inheritdoc} |
368 | 368 | */ |
369 | 369 | public function getTypes() { |
370 | - return array_map(function ($name) { |
|
370 | + return array_map(function($name) { |
|
371 | 371 | return $this->getType($name); |
372 | 372 | }, array_keys($this->pluginDefinition['type_map'])); |
373 | 373 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * {@inheritdoc} |
453 | 453 | */ |
454 | 454 | public function processArguments(array $args) { |
455 | - return array_filter(array_map(function ($arg) { |
|
455 | + return array_filter(array_map(function($arg) { |
|
456 | 456 | try { |
457 | 457 | $type = $this->processType($arg['type']); |
458 | 458 | } |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | public function processType(array $type) { |
479 | 479 | [$type, $decorators] = $type; |
480 | 480 | |
481 | - return array_reduce($decorators, function ($type, $decorator) { |
|
481 | + return array_reduce($decorators, function($type, $decorator) { |
|
482 | 482 | return $decorator($type); |
483 | 483 | }, $this->getType($type)); |
484 | 484 | } |
@@ -455,8 +455,7 @@ |
||
455 | 455 | return array_filter(array_map(function ($arg) { |
456 | 456 | try { |
457 | 457 | $type = $this->processType($arg['type']); |
458 | - } |
|
459 | - catch (\Exception $e) { |
|
458 | + } catch (\Exception $e) { |
|
460 | 459 | // Allow optional arguments that are removed if the input type is |
461 | 460 | // not defined. |
462 | 461 | if (empty($arg['optional'])) { |
@@ -26,7 +26,7 @@ |
||
26 | 26 | 'deprecationReason' => $definition['deprecationReason'], |
27 | 27 | 'type' => $builder->processType($definition['type']), |
28 | 28 | 'args' => $builder->processArguments($definition['args']), |
29 | - 'resolve' => function ($value, $args, $context, $info) use ($manager, $id) { |
|
29 | + 'resolve' => function($value, $args, $context, $info) use ($manager, $id) { |
|
30 | 30 | $instance = $manager->getInstance(['id' => $id]); |
31 | 31 | return call_user_func_array([$instance, 'resolve'], [$value, $args, $context, $info]); |
32 | 32 | }, |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'deprecationReason' => $definition['deprecationReason'], |
61 | 61 | 'type' => $builder->processType($definition['type']), |
62 | 62 | 'args' => $builder->processArguments($definition['args']), |
63 | - 'resolve' => function ($value, array $args, ResolveContext $context, ResolveInfo $info) use ($manager, $id) { |
|
63 | + 'resolve' => function($value, array $args, ResolveContext $context, ResolveInfo $info) use ($manager, $id) { |
|
64 | 64 | $instance = $manager->getInstance(['id' => $id]); |
65 | 65 | return $instance->resolve($value, $args, $context, $info); |
66 | 66 | }, |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | protected function isLanguageAwareField() { |
142 | 142 | if (is_null($this->isLanguageAware)) { |
143 | - $this->isLanguageAware = (boolean) count(array_filter($this->getPluginDefinition()['response_cache_contexts'], function ($context) { |
|
143 | + $this->isLanguageAware = (boolean) count(array_filter($this->getPluginDefinition()['response_cache_contexts'], function($context) { |
|
144 | 144 | return strpos($context, 'languages:') === 0; |
145 | 145 | })); |
146 | 146 | } |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | |
157 | 157 | $renderContext = new RenderContext(); |
158 | 158 | |
159 | - $executor = function () use ($callback, $renderContext, $value, $args, $context, $info) { |
|
160 | - return $this->getRenderer()->executeInRenderContext($renderContext, function () use ($callback, $value, $args, $context, $info) { |
|
159 | + $executor = function() use ($callback, $renderContext, $value, $args, $context, $info) { |
|
160 | + return $this->getRenderer()->executeInRenderContext($renderContext, function() use ($callback, $value, $args, $context, $info) { |
|
161 | 161 | $result = $callback($value, $args, $context, $info); |
162 | 162 | if ($result instanceof \Generator) { |
163 | 163 | $result = iterator_to_array($result); |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | |
177 | 177 | if (is_callable($result)) { |
178 | 178 | return new Deferred( |
179 | - function () use ($result, $value, $args, $context, $info, $isLanguageAware, $languageContext) { |
|
179 | + function() use ($result, $value, $args, $context, $info, $isLanguageAware, $languageContext) { |
|
180 | 180 | if ($isLanguageAware) { |
181 | 181 | return $languageContext |
182 | 182 | ->executeInLanguageContext( |
183 | - function () use ($result, $value, $args, $context, $info) { |
|
183 | + function() use ($result, $value, $args, $context, $info) { |
|
184 | 184 | return $this->resolveDeferred($result, $value, $args, $context, $info); |
185 | 185 | }, |
186 | 186 | $context->getContext('language', $info) |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | * arbitrary value if it isn't). |
217 | 217 | */ |
218 | 218 | protected function unwrapResult($result, ResolveInfo $info) { |
219 | - $result = array_map(function ($item) { |
|
219 | + $result = array_map(function($item) { |
|
220 | 220 | return $item instanceof ValueWrapperInterface ? $item->getValue() : $item; |
221 | 221 | }, $result); |
222 | 222 | |
223 | - $result = array_map(function ($item) { |
|
223 | + $result = array_map(function($item) { |
|
224 | 224 | return $item instanceof MarkupInterface ? $item->__toString() : $item; |
225 | 225 | }, $result); |
226 | 226 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $self->mergeCacheMaxAge($definition['response_cache_max_age']); |
266 | 266 | } |
267 | 267 | |
268 | - return array_merge([$self], array_filter($result, function ($item) { |
|
268 | + return array_merge([$self], array_filter($result, function($item) { |
|
269 | 269 | return $item instanceof CacheableDependencyInterface; |
270 | 270 | })); |
271 | 271 | } |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | 'name' => $definition['name'], |
26 | 26 | 'description' => $definition['description'], |
27 | 27 | 'contexts' => $definition['contexts'], |
28 | - 'fields' => function () use ($builder, $definition) { |
|
28 | + 'fields' => function() use ($builder, $definition) { |
|
29 | 29 | $fields = $builder->getFields($definition['name']); |
30 | 30 | |
31 | 31 | if (!empty($definition['interfaces'])) { |
32 | - $inherited = array_map(function ($name) use ($builder) { |
|
32 | + $inherited = array_map(function($name) use ($builder) { |
|
33 | 33 | return $builder->getFields($name); |
34 | 34 | }, $definition['interfaces']); |
35 | 35 | |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | |
40 | 40 | return $fields; |
41 | 41 | }, |
42 | - 'interfaces' => function () use ($builder, $definition) { |
|
43 | - return array_filter(array_map(function ($name) use ($builder) { |
|
42 | + 'interfaces' => function() use ($builder, $definition) { |
|
43 | + return array_filter(array_map(function($name) use ($builder) { |
|
44 | 44 | return $builder->getType($name); |
45 | - }, $definition['interfaces']), function ($type) { |
|
45 | + }, $definition['interfaces']), function($type) { |
|
46 | 46 | return $type instanceof InterfaceType; |
47 | 47 | }); |
48 | 48 | }, |
49 | - 'isTypeOf' => function ($object, $context, ResolveInfo $info) use ($manager, $id) { |
|
49 | + 'isTypeOf' => function($object, $context, ResolveInfo $info) use ($manager, $id) { |
|
50 | 50 | $instance = $manager->getInstance(['id' => $id]); |
51 | 51 | return $instance->applies($object, $context, $info); |
52 | 52 | }, |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | return new InterfaceType([ |
23 | 23 | 'name' => $definition['name'], |
24 | 24 | 'description' => $definition['description'], |
25 | - 'contexts' => function () use ($builder, $definition) { |
|
25 | + 'contexts' => function() use ($builder, $definition) { |
|
26 | 26 | $types = $builder->getSubTypes($definition['name']); |
27 | 27 | |
28 | - return array_reduce($types, function ($carry, $current) use ($builder) { |
|
28 | + return array_reduce($types, function($carry, $current) use ($builder) { |
|
29 | 29 | $type = $builder->getType($current); |
30 | 30 | if (!empty($type->config['contexts'])) { |
31 | 31 | $contexts = $type->config['contexts']; |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | return $carry; |
37 | 37 | }, $definition['contexts']); |
38 | 38 | }, |
39 | - 'fields' => function () use ($builder, $definition) { |
|
39 | + 'fields' => function() use ($builder, $definition) { |
|
40 | 40 | $fields = $builder->getFields($definition['name']); |
41 | 41 | |
42 | 42 | if (!empty($definition['interfaces'])) { |
43 | - $inherited = array_map(function ($name) use ($builder) { |
|
43 | + $inherited = array_map(function($name) use ($builder) { |
|
44 | 44 | return $builder->getFields($name); |
45 | 45 | }, $definition['interfaces']); |
46 | 46 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | return $fields; |
52 | 52 | }, |
53 | - 'resolveType' => function ($value, $context, $info) use ($builder, $definition) { |
|
53 | + 'resolveType' => function($value, $context, $info) use ($builder, $definition) { |
|
54 | 54 | return $builder->resolveType($definition['name'], $value, $context, $info); |
55 | 55 | }, |
56 | 56 | ]); |