diff --git a/core/includes/file.inc b/core/includes/file.inc index 228515df6b36..7f3127eb0d07 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -1030,7 +1030,7 @@ function file_scan_directory($dir, $mask, $options = [], $depth = 0) { // performance boost. if (!isset($options['nomask'])) { $ignore_directories = Settings::get('file_scan_ignore_directories', []); - array_walk($ignore_directories, function(&$value) { + array_walk($ignore_directories, function (&$value) { $value = preg_quote($value, '/'); }); $default_nomask = '/^' . implode('|', $ignore_directories) . '$/'; diff --git a/core/lib/Drupal/Component/Assertion/Handle.php b/core/lib/Drupal/Component/Assertion/Handle.php index 5069b6b4677e..f1e1e6ace0fb 100644 --- a/core/lib/Drupal/Component/Assertion/Handle.php +++ b/core/lib/Drupal/Component/Assertion/Handle.php @@ -25,7 +25,7 @@ class Handle { require __DIR__ . '/global_namespace_php5.php'; } // PHP 5 - create a handler to throw the exception directly. - assert_options(ASSERT_CALLBACK, function($file = '', $line = 0, $code = '', $message = '') { + assert_options(ASSERT_CALLBACK, function ($file = '', $line = 0, $code = '', $message = '') { if (empty($message)) { $message = $code; } diff --git a/core/lib/Drupal/Component/Utility/Unicode.php b/core/lib/Drupal/Component/Utility/Unicode.php index 98db80431c7e..6590704ab5f9 100644 --- a/core/lib/Drupal/Component/Utility/Unicode.php +++ b/core/lib/Drupal/Component/Utility/Unicode.php @@ -376,7 +376,7 @@ EOD; */ public static function ucwords($text) { $regex = '/(^|[' . static::PREG_CLASS_WORD_BOUNDARY . '])([^' . static::PREG_CLASS_WORD_BOUNDARY . '])/u'; - return preg_replace_callback($regex, function(array $matches) { + return preg_replace_callback($regex, function (array $matches) { return $matches[1] . Unicode::strtoupper($matches[2]); }, $text); } diff --git a/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php b/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php index 5f23af49793b..30577ef30df3 100644 --- a/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php +++ b/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php @@ -175,7 +175,7 @@ class CssCollectionOptimizer implements AssetCollectionOptimizerInterface { public function deleteAll() { $this->state->delete('drupal_css_cache_files'); - $delete_stale = function($uri) { + $delete_stale = function ($uri) { // Default stale file threshold is 30 days. if (REQUEST_TIME - filemtime($uri) > \Drupal::config('system.performance')->get('stale_file_threshold')) { file_unmanaged_delete($uri); diff --git a/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php b/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php index 4d49d87b4d81..0a47efc636a8 100644 --- a/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php +++ b/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php @@ -178,7 +178,7 @@ class JsCollectionOptimizer implements AssetCollectionOptimizerInterface { */ public function deleteAll() { $this->state->delete('system.js_cache_files'); - $delete_stale = function($uri) { + $delete_stale = function ($uri) { // Default stale file threshold is 30 days. if (REQUEST_TIME - filemtime($uri) > \Drupal::config('system.performance')->get('stale_file_threshold')) { file_unmanaged_delete($uri); diff --git a/core/lib/Drupal/Core/Config/CachedStorage.php b/core/lib/Drupal/Core/Config/CachedStorage.php index 7286fbcb3212..f43ede2a6375 100644 --- a/core/lib/Drupal/Core/Config/CachedStorage.php +++ b/core/lib/Drupal/Core/Config/CachedStorage.php @@ -278,7 +278,7 @@ class CachedStorage implements StorageInterface, StorageCacheInterface { */ protected function getCacheKeys(array $names) { $prefix = $this->getCollectionPrefix(); - $cache_keys = array_map(function($name) use ($prefix) { + $cache_keys = array_map(function ($name) use ($prefix) { return $prefix . $name; }, $names); diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php index 8c06cd1edf78..e43a36c1f15d 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactory.php +++ b/core/lib/Drupal/Core/Config/ConfigFactory.php @@ -306,7 +306,7 @@ class ConfigFactory implements ConfigFactoryInterface, EventSubscriberInterface * An array of cache keys that match the provided config name. */ protected function getConfigCacheKeys($name) { - return array_filter(array_keys($this->cache), function($key) use ($name) { + return array_filter(array_keys($this->cache), function ($key) use ($name) { // Return TRUE if the key is the name or starts with the configuration // name plus the delimiter. return $key === $name || strpos($key, $name . ':') === 0; diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index b023764ebfbf..242d92097e57 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -185,7 +185,7 @@ class ConfigInstaller implements ConfigInstallerInterface { $existing_config = $this->getActiveStorages()->listAll(); $list = array_unique(array_merge($storage->listAll(), $optional_profile_config)); - $list = array_filter($list, function($config_name) use ($existing_config) { + $list = array_filter($list, function ($config_name) use ($existing_config) { // Only list configuration that: // - does not already exist // - is a configuration entity (this also excludes config that has an diff --git a/core/lib/Drupal/Core/Config/ConfigManager.php b/core/lib/Drupal/Core/Config/ConfigManager.php index 7ec824b52275..8b3b3d66fd8a 100644 --- a/core/lib/Drupal/Core/Config/ConfigManager.php +++ b/core/lib/Drupal/Core/Config/ConfigManager.php @@ -233,7 +233,7 @@ class ConfigManager implements ConfigManagerInterface { // dependencies on the config entity classes. Assume data with UUID is a // config entity. Only configuration entities can be depended on so we can // ignore everything else. - $data = array_map(function($config) { + $data = array_map(function ($config) { $data = $config->get(); if (isset($data['uuid'])) { return $data; diff --git a/core/lib/Drupal/Core/Config/Entity/Query/Query.php b/core/lib/Drupal/Core/Config/Entity/Query/Query.php index 918853d34851..4566cb11d58f 100644 --- a/core/lib/Drupal/Core/Config/Entity/Query/Query.php +++ b/core/lib/Drupal/Core/Config/Entity/Query/Query.php @@ -88,7 +88,7 @@ class Query extends QueryBase implements QueryInterface { foreach ($this->sort as $sort) { $direction = $sort['direction'] == 'ASC' ? -1 : 1; $field = $sort['field']; - uasort($result, function($a, $b) use ($field, $direction) { + uasort($result, function ($a, $b) use ($field, $direction) { return ($a[$field] <= $b[$field]) ? $direction : -$direction; }); } diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php index 3acb482149bd..ce25e647f6c8 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php +++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php @@ -128,7 +128,7 @@ class Insert extends QueryInsert { // Default fields are always placed first for consistency. $insert_fields = array_merge($this->defaultFields, $this->insertFields); - $insert_fields = array_map(function($f) { + $insert_fields = array_map(function ($f) { return $this->connection->escapeField($f); }, $insert_fields); diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/NativeUpsert.php b/core/lib/Drupal/Core/Database/Driver/pgsql/NativeUpsert.php index 95eff55c08bf..03f9db0ddf18 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/NativeUpsert.php +++ b/core/lib/Drupal/Core/Database/Driver/pgsql/NativeUpsert.php @@ -100,7 +100,7 @@ class NativeUpsert extends QueryUpsert { // Default fields are always placed first for consistency. $insert_fields = array_merge($this->defaultFields, $this->insertFields); - $insert_fields = array_map(function($f) { + $insert_fields = array_map(function ($f) { return $this->connection->escapeField($f); }, $insert_fields); diff --git a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php index d5fdbe22b9ff..bb7b821bc30d 100644 --- a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php +++ b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php @@ -108,7 +108,7 @@ class DrupalDateTime extends DateTimePlus { $format = parent::format($format, $settings); // Translates a formatted date string. - $translation_callback = function($matches) use ($langcode) { + $translation_callback = function ($matches) use ($langcode) { $code = $matches[1]; $string = $matches[2]; if (!isset($this->formatTranslationCache[$langcode][$code][$string])) { diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 8818f6291c68..2c62589fa285 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -916,7 +916,7 @@ abstract class ContentEntityBase extends Entity implements \IteratorAggregate, C * {@inheritdoc} */ public function getTranslationLanguages($include_default = TRUE) { - $translations = array_filter($this->translations, function($translation) { + $translations = array_filter($this->translations, function ($translation) { return $translation['status']; }); unset($translations[LanguageInterface::LANGCODE_DEFAULT]); diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php index e92930ab6279..874a3416bc76 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php @@ -153,10 +153,10 @@ abstract class ContentEntityStorageBase extends EntityStorageBase implements Con */ public function createTranslation(ContentEntityInterface $entity, $langcode, array $values = []) { $translation = $entity->getTranslation($langcode); - $definitions = array_filter($translation->getFieldDefinitions(), function(FieldDefinitionInterface $definition) { + $definitions = array_filter($translation->getFieldDefinitions(), function (FieldDefinitionInterface $definition) { return $definition->isTranslatable(); }); - $field_names = array_map(function(FieldDefinitionInterface $definition) { + $field_names = array_map(function (FieldDefinitionInterface $definition) { return $definition->getName(); }, $definitions); $values[$this->langcodeKey] = $langcode; diff --git a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php index 466032d96a01..e82ed81cc2b5 100644 --- a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php +++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php @@ -77,7 +77,7 @@ class EntityAutocomplete extends Textfield { // Potentially the #value is set directly, so it contains the 'target_id' // array structure instead of a string. if ($input !== FALSE && is_array($input)) { - $entity_ids = array_map(function(array $item) { + $entity_ids = array_map(function (array $item) { return $item['target_id']; }, $input); diff --git a/core/lib/Drupal/Core/Entity/EntityFieldManager.php b/core/lib/Drupal/Core/Entity/EntityFieldManager.php index a0fff7e2bcb5..d6e70eef751c 100644 --- a/core/lib/Drupal/Core/Entity/EntityFieldManager.php +++ b/core/lib/Drupal/Core/Entity/EntityFieldManager.php @@ -346,7 +346,7 @@ class EntityFieldManager implements EntityFieldManagerInterface { // Load base field overrides from configuration. These take precedence over // base field overrides returned above. - $base_field_override_ids = array_map(function($field_name) use ($entity_type_id, $bundle) { + $base_field_override_ids = array_map(function ($field_name) use ($entity_type_id, $bundle) { return $entity_type_id . '.' . $bundle . '.' . $field_name; }, array_keys($base_field_definitions)); $base_field_overrides = $this->entityTypeManager->getStorage('base_field_override')->loadMultiple($base_field_override_ids); diff --git a/core/lib/Drupal/Core/Entity/KeyValueStore/Query/Query.php b/core/lib/Drupal/Core/Entity/KeyValueStore/Query/Query.php index 3f7a6a616a28..7a0309262514 100644 --- a/core/lib/Drupal/Core/Entity/KeyValueStore/Query/Query.php +++ b/core/lib/Drupal/Core/Entity/KeyValueStore/Query/Query.php @@ -50,7 +50,7 @@ class Query extends QueryBase { foreach ($this->sort as $sort) { $direction = $sort['direction'] == 'ASC' ? -1 : 1; $field = $sort['field']; - uasort($result, function($a, $b) use ($field, $direction) { + uasort($result, function ($a, $b) use ($field, $direction) { return ($a[$field] <= $b[$field]) ? $direction : -$direction; }); } diff --git a/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php b/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php index 70a3b4e66f4c..fdc72895d969 100644 --- a/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php +++ b/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php @@ -296,13 +296,13 @@ class DefaultTableMapping implements TableMappingInterface { */ public function getDedicatedTableNames() { $table_mapping = $this; - $definitions = array_filter($this->fieldStorageDefinitions, function($definition) use ($table_mapping) { + $definitions = array_filter($this->fieldStorageDefinitions, function ($definition) use ($table_mapping) { return $table_mapping->requiresDedicatedTableStorage($definition); }); - $data_tables = array_map(function($definition) use ($table_mapping) { + $data_tables = array_map(function ($definition) use ($table_mapping) { return $table_mapping->getDedicatedDataTableName($definition); }, $definitions); - $revision_tables = array_map(function($definition) use ($table_mapping) { + $revision_tables = array_map(function ($definition) use ($table_mapping) { return $table_mapping->getDedicatedRevisionTableName($definition); }, $definitions); $dedicated_tables = array_merge(array_values($data_tables), array_values($revision_tables)); diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php index a18a3c5310d6..d180381345e0 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -1529,7 +1529,7 @@ class SqlContentEntityStorageSchema implements DynamicallyFieldableEntityStorage // involving them. Only indexes for which all columns exist are // actually created. $create = FALSE; - $specifier_columns = array_map(function($item) { + $specifier_columns = array_map(function ($item) { return is_string($item) ? $item : reset($item); }, $specifier); if (!isset($column_names) || array_intersect($specifier_columns, $column_names)) { @@ -1580,7 +1580,7 @@ class SqlContentEntityStorageSchema implements DynamicallyFieldableEntityStorage foreach ($index_keys as $key => $drop_method) { if (!empty($schema[$key])) { foreach ($schema[$key] as $name => $specifier) { - $specifier_columns = array_map(function($item) { + $specifier_columns = array_map(function ($item) { return is_string($item) ? $item : reset($item); }, $specifier); if (!isset($column_names) || array_intersect($specifier_columns, $column_names)) { diff --git a/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php index 447b9180561f..75ea5fd86a53 100644 --- a/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php @@ -93,7 +93,7 @@ class EarlyRenderingControllerWrapperSubscriber implements EventSubscriberInterf // See \Symfony\Component\HttpKernel\HttpKernel::handleRaw(). $arguments = $this->controllerResolver->getArguments($event->getRequest(), $controller); - $event->setController(function() use ($controller, $arguments) { + $event->setController(function () use ($controller, $arguments) { return $this->wrapControllerExecutionInRenderContext($controller, $arguments); }); } @@ -118,7 +118,7 @@ class EarlyRenderingControllerWrapperSubscriber implements EventSubscriberInterf protected function wrapControllerExecutionInRenderContext($controller, array $arguments) { $context = new RenderContext(); - $response = $this->renderer->executeInRenderContext($context, function() use ($controller, $arguments) { + $response = $this->renderer->executeInRenderContext($context, function () use ($controller, $arguments) { // Now call the actual controller, just like HttpKernel does. return call_user_func_array($controller, $arguments); }); diff --git a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php index 5442d1542ef6..8d588d48802f 100644 --- a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php +++ b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php @@ -176,7 +176,7 @@ class SiteSettingsForm extends FormBase { */ protected function getDatabaseErrors(array $database, $settings_file) { $errors = install_database_errors($database, $settings_file); - $form_errors = array_filter($errors, function($value) { + $form_errors = array_filter($errors, function ($value) { // Errors keyed by something other than an integer already are linked to // form elements. return is_int($value); diff --git a/core/lib/Drupal/Core/Mail/MailManager.php b/core/lib/Drupal/Core/Mail/MailManager.php index 6de2dd818c61..6a092c9329ad 100644 --- a/core/lib/Drupal/Core/Mail/MailManager.php +++ b/core/lib/Drupal/Core/Mail/MailManager.php @@ -169,7 +169,7 @@ class MailManager extends DefaultPluginManager implements MailManagerInterface { // attachments. Therefore we perform mailing inside its own render context, // to ensure it doesn't leak into the render context for the HTTP response // to the current request. - return $this->renderer->executeInRenderContext(new RenderContext(), function() use ($module, $key, $to, $langcode, $params, $reply, $send) { + return $this->renderer->executeInRenderContext(new RenderContext(), function () use ($module, $key, $to, $langcode, $params, $reply, $send) { return $this->doMail($module, $key, $to, $langcode, $params, $reply, $send); }); } diff --git a/core/lib/Drupal/Core/Render/Element/Checkboxes.php b/core/lib/Drupal/Core/Render/Element/Checkboxes.php index 3663cd57bb4d..35611fd3b9d7 100644 --- a/core/lib/Drupal/Core/Render/Element/Checkboxes.php +++ b/core/lib/Drupal/Core/Render/Element/Checkboxes.php @@ -139,7 +139,7 @@ class Checkboxes extends FormElement { // // @see \Drupal\Core\Render\Element\Checkboxes::valueCallback() // @see https://www.w3.org/TR/html401/interact/forms.html#checkbox - $checked = array_filter($input, function($value) { + $checked = array_filter($input, function ($value) { return $value !== 0; }); return array_keys($checked); diff --git a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php index c76a9728d281..5966668af350 100644 --- a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php @@ -139,7 +139,7 @@ class HtmlRenderer implements MainContentRendererInterface { // RendererInterface::render() instead of RendererInterface::renderRoot(). // @see \Drupal\Core\Render\HtmlResponseAttachmentsProcessor. $render_context = new RenderContext(); - $this->renderer->executeInRenderContext($render_context, function() use (&$html) { + $this->renderer->executeInRenderContext($render_context, function () use (&$html) { // RendererInterface::render() renders the $html render array and updates // it in place. We don't care about the return value (which is just // $html['#markup']), but about the resulting render array. @@ -216,7 +216,7 @@ class HtmlRenderer implements MainContentRendererInterface { // ::renderResponse(). // @todo Remove this once https://www.drupal.org/node/2359901 lands. if (!empty($main_content)) { - $this->renderer->executeInRenderContext(new RenderContext(), function() use (&$main_content) { + $this->renderer->executeInRenderContext(new RenderContext(), function () use (&$main_content) { if (isset($main_content['#cache']['keys'])) { // Retain #title, otherwise, dynamically generated titles would be // missing for controllers whose entire returned render array is diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php index 584f79f908a1..5038851edefd 100644 --- a/core/lib/Drupal/Core/Render/Renderer.php +++ b/core/lib/Drupal/Core/Render/Renderer.php @@ -309,7 +309,7 @@ class Renderer implements RendererInterface { if (count($elements['#lazy_builder']) !== 2) { throw new \DomainException('The #lazy_builder property must have an array as a value, containing two values: the callback, and the arguments for the callback.'); } - if (count($elements['#lazy_builder'][1]) !== count(array_filter($elements['#lazy_builder'][1], function($v) { + if (count($elements['#lazy_builder'][1]) !== count(array_filter($elements['#lazy_builder'][1], function ($v) { return is_null($v) || is_scalar($v); }))) { throw new \DomainException("A #lazy_builder callback's context may only contain scalar values or NULL."); diff --git a/core/lib/Drupal/Core/Routing/RouteCompiler.php b/core/lib/Drupal/Core/Routing/RouteCompiler.php index e4aef439806c..9c430f6811cb 100644 --- a/core/lib/Drupal/Core/Routing/RouteCompiler.php +++ b/core/lib/Drupal/Core/Routing/RouteCompiler.php @@ -130,7 +130,7 @@ class RouteCompiler extends SymfonyRouteCompiler implements RouteCompilerInterfa // Remove placeholders with default values from the outline, so that they // will still match. - $remove = array_map(function($a) { + $remove = array_map(function ($a) { return '/{' . $a . '}'; }, array_keys($defaults)); $path = str_replace($remove, '', $path); diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index 520a8beb25f2..377efe6ddeff 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -610,7 +610,7 @@ class TwigExtension extends \Twig_Extension { $value = iterator_to_array($value, FALSE); } - return implode($glue, array_map(function($item) use ($env) { + return implode($glue, array_map(function ($item) use ($env) { // If $item is not marked safe then it will be escaped. return $this->escapeFilter($env, $item, 'html', NULL, TRUE); }, (array) $value)); diff --git a/core/lib/Drupal/Core/Update/UpdateRegistry.php b/core/lib/Drupal/Core/Update/UpdateRegistry.php index bb0b91f5adea..b24ac67657f3 100644 --- a/core/lib/Drupal/Core/Update/UpdateRegistry.php +++ b/core/lib/Drupal/Core/Update/UpdateRegistry.php @@ -225,7 +225,7 @@ class UpdateRegistry { $this->scanExtensionsAndLoadUpdateFiles(); $all_functions = $this->getAvailableUpdateFunctions(); - return array_filter($all_functions, function($function_name) use ($module_name) { + return array_filter($all_functions, function ($function_name) use ($module_name) { list($function_module_name, ) = explode("_{$this->updateType}_", $function_name); return $function_module_name === $module_name; }); @@ -254,7 +254,7 @@ class UpdateRegistry { public function filterOutInvokedUpdatesByModule($module) { $existing_update_functions = $this->keyValue->get('existing_updates', []); - $remaining_update_functions = array_filter($existing_update_functions, function($function_name) use ($module) { + $remaining_update_functions = array_filter($existing_update_functions, function ($function_name) use ($module) { return strpos($function_name, "{$module}_{$this->updateType}_") !== 0; }); diff --git a/core/lib/Drupal/Core/Utility/LinkGenerator.php b/core/lib/Drupal/Core/Utility/LinkGenerator.php index 8367556445e3..5c6288d4955f 100644 --- a/core/lib/Drupal/Core/Utility/LinkGenerator.php +++ b/core/lib/Drupal/Core/Utility/LinkGenerator.php @@ -112,7 +112,7 @@ class LinkGenerator implements LinkGeneratorInterface { } // Ensure that query values are strings. - array_walk($variables['options']['query'], function(&$value) { + array_walk($variables['options']['query'], function (&$value) { if ($value instanceof MarkupInterface) { $value = (string) $value; } diff --git a/core/modules/action/src/Plugin/Action/GotoAction.php b/core/modules/action/src/Plugin/Action/GotoAction.php index 44e871b92a96..13a9a0d404d0 100644 --- a/core/modules/action/src/Plugin/Action/GotoAction.php +++ b/core/modules/action/src/Plugin/Action/GotoAction.php @@ -92,7 +92,7 @@ class GotoAction extends ConfigurableActionBase implements ContainerFactoryPlugi $url = $this->unroutedUrlAssembler->assemble($uri, $options); } $response = new RedirectResponse($url); - $listener = function($event) use ($response) { + $listener = function ($event) use ($response) { $event->setResponse($response); }; // Add the listener to the event dispatcher. diff --git a/core/modules/aggregator/src/Plugin/aggregator/fetcher/DefaultFetcher.php b/core/modules/aggregator/src/Plugin/aggregator/fetcher/DefaultFetcher.php index 9b88e438c99d..6c6793a59de7 100644 --- a/core/modules/aggregator/src/Plugin/aggregator/fetcher/DefaultFetcher.php +++ b/core/modules/aggregator/src/Plugin/aggregator/fetcher/DefaultFetcher.php @@ -86,7 +86,7 @@ class DefaultFetcher implements FetcherInterface, ContainerFactoryPluginInterfac $actual_uri = NULL; $response = $this->httpClientFactory->fromOptions([ 'allow_redirects' => [ - 'on_redirect' => function(RequestInterface $request, ResponseInterface $response, UriInterface $uri) use (&$actual_uri) { + 'on_redirect' => function (RequestInterface $request, ResponseInterface $response, UriInterface $uri) use (&$actual_uri) { $actual_uri = (string) $uri; } ], diff --git a/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php b/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php index 525ef34f13ae..4e8200b87bc2 100644 --- a/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php +++ b/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php @@ -141,7 +141,7 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor ]; $lengths = [0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000]; - $options = array_map(function($length) { + $options = array_map(function ($length) { return ($length == 0) ? t('Unlimited') : $this->formatPlural($length, '1 character', '@count characters'); }, array_combine($lengths, $lengths)); diff --git a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php index d43822c5f610..92d1a866da9a 100644 --- a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php +++ b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php @@ -374,7 +374,7 @@ class BigPipeTest extends BrowserTestBase { } ksort($placeholder_positions, SORT_NUMERIC); $this->assertEqual(array_keys($expected_big_pipe_placeholders), array_values($placeholder_positions)); - $placeholders = array_map(function(NodeElement $element) { + $placeholders = array_map(function (NodeElement $element) { return $element->getAttribute('data-big-pipe-placeholder-id'); }, $this->cssSelect('[data-big-pipe-placeholder-id]')); $this->assertEqual(count($expected_big_pipe_placeholders), count(array_unique($placeholders))); diff --git a/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php b/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php index 0b34f841025c..5cea220f6ca8 100644 --- a/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php +++ b/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php @@ -84,7 +84,7 @@ class BlockFilterTest extends JavascriptTestBase { * @return NodeElement[] */ protected function filterVisibleElements(array $elements) { - $elements = array_filter($elements, function(NodeElement $element) { + $elements = array_filter($elements, function (NodeElement $element) { return $element->isVisible(); }); return $elements; diff --git a/core/modules/ckeditor/ckeditor.admin.inc b/core/modules/ckeditor/ckeditor.admin.inc index 8a8f68c69bd4..f9316c6a586d 100644 --- a/core/modules/ckeditor/ckeditor.admin.inc +++ b/core/modules/ckeditor/ckeditor.admin.inc @@ -66,7 +66,7 @@ function template_preprocess_ckeditor_settings_toolbar(&$variables) { $rtl = $language_interface->getDirection() === LanguageInterface::DIRECTION_RTL ? '_rtl' : ''; - $build_button_item = function($button, $rtl) { + $build_button_item = function ($button, $rtl) { // Value of the button item. if (isset($button['image_alternative' . $rtl])) { $value = $button['image_alternative' . $rtl]; diff --git a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php index 9a04ce72a20a..6c6990bc2e9c 100644 --- a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php +++ b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php @@ -126,7 +126,7 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter * {@inheritdoc} */ public function getButtons() { - $button = function($name, $direction = 'ltr') { + $button = function ($name, $direction = 'ltr') { // In the markup below, we mostly use the name (which may include spaces), // but in one spot we use it as a CSS class, so strip spaces. // Note: this uses str_replace() instead of Html::cleanCssIdentifier() @@ -420,8 +420,8 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter } // Generate setting that accurately reflects allowed tags and attributes. else { - $get_attribute_values = function($attribute_values, $allowed_values) { - $values = array_keys(array_filter($attribute_values, function($value) use ($allowed_values) { + $get_attribute_values = function ($attribute_values, $allowed_values) { + $values = array_keys(array_filter($attribute_values, function ($value) use ($allowed_values) { if ($allowed_values) { return $value !== FALSE; } @@ -532,7 +532,7 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter // getConfig() method, and override the JavaScript at // Drupal.editors.ckeditor to somehow make validation of values for // attributes other than "class" and "style" work. - $allowed_attributes = array_filter($attributes, function($value) { + $allowed_attributes = array_filter($attributes, function ($value) { return $value !== FALSE; }); if (count($allowed_attributes)) { @@ -567,7 +567,7 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter // implies that all of its possible attribute values are disallowed, // thus we must look at the disallowed attribute values on allowed // attributes. - $disallowed_attributes = array_filter($attributes, function($value) { + $disallowed_attributes = array_filter($attributes, function ($value) { return $value === FALSE; }); if (count($disallowed_attributes)) { diff --git a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php index 255691ff03b9..49ab1b30dd3b 100644 --- a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php @@ -194,7 +194,7 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface { } } // Get a list of all buttons that are provided by all plugins. - $all_buttons = array_reduce($this->ckeditorPluginManager->getButtons(), function($result, $item) { + $all_buttons = array_reduce($this->ckeditorPluginManager->getButtons(), function ($result, $item) { return array_merge($result, array_keys($item)); }, []); // Build a fake Editor object, which we'll use to generate JavaScript @@ -418,7 +418,7 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface { ]; $this->moduleHandler->alter('ckeditor_css', $css, $editor); // Get a list of all enabled plugins' iframe instance CSS files. - $plugins_css = array_reduce($this->ckeditorPluginManager->getCssFiles($editor), function($result, $item) { + $plugins_css = array_reduce($this->ckeditorPluginManager->getCssFiles($editor), function ($result, $item) { return array_merge($result, array_values($item)); }, []); $css = array_merge($css, $plugins_css); diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php index ce3411c30e1e..1ec222746e3f 100644 --- a/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php +++ b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php @@ -179,7 +179,7 @@ class CKEditorAdminTest extends BrowserTestBase { // JavaScript's drupalSettings, and Unicode-escaped) is correctly rendered. $this->drupalGet('admin/config/content/formats/manage/filtered_html'); // Create function to encode HTML as we expect it in drupalSettings. - $json_encode = function($html) { + $json_encode = function ($html) { return trim(Json::encode($html), '"'); }; // Check the Button separator. diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php index e8d0e2d85893..c9df8469d01a 100644 --- a/core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php +++ b/core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php @@ -67,7 +67,7 @@ class CKEditorToolbarButtonTest extends BrowserTestBase { $this->drupalGet('admin/config/content/formats/manage/full_html'); // Check if any image button is loaded in CKEditor json. - $json_encode = function($html) { + $json_encode = function ($html) { return trim(Json::encode($html), '"'); }; $markup = $json_encode(file_url_transform_relative(file_create_url('core/modules/ckeditor/js/plugins/drupalimage/icons/drupalimage.png'))); diff --git a/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php b/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php index f011554391df..b15433d4f757 100644 --- a/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php +++ b/core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php @@ -55,7 +55,7 @@ class AjaxCssTest extends JavascriptTestBase { // but not the iframe. $page->pressButton('Add CSS to inline CKEditor instance'); - $result = $page->waitFor(10, function() use ($style_color) { + $result = $page->waitFor(10, function () use ($style_color) { return ($this->getEditorStyle('edit-inline', 'color') == $style_color) && ($this->getEditorStyle('edit-iframe-value', 'color') != $style_color); }); @@ -70,7 +70,7 @@ class AjaxCssTest extends JavascriptTestBase { // but not the main body. $page->pressButton('Add CSS to iframe CKEditor instance'); - $result = $page->waitFor(10, function() use ($style_color) { + $result = $page->waitFor(10, function () use ($style_color) { return ($this->getEditorStyle('edit-inline', 'color') != $style_color) && ($this->getEditorStyle('edit-iframe-value', 'color') == $style_color); }); diff --git a/core/modules/contact/tests/src/Unit/MailHandlerTest.php b/core/modules/contact/tests/src/Unit/MailHandlerTest.php index ba3bfad81662..04a12b86df58 100644 --- a/core/modules/contact/tests/src/Unit/MailHandlerTest.php +++ b/core/modules/contact/tests/src/Unit/MailHandlerTest.php @@ -136,7 +136,7 @@ class MailHandlerTest extends UnitTestCase { $this->mailManager->expects($this->any()) ->method('mail') ->willReturnCallback( - function($module, $key, $to, $langcode, $params, $from) use (&$results) { + function ($module, $key, $to, $langcode, $params, $from) use (&$results) { $result = array_shift($results); $this->assertEquals($module, $result['module']); $this->assertEquals($key, $result['key']); diff --git a/core/modules/content_moderation/src/Form/EntityModerationForm.php b/core/modules/content_moderation/src/Form/EntityModerationForm.php index 85e18d130d4a..6d768c86d836 100644 --- a/core/modules/content_moderation/src/Form/EntityModerationForm.php +++ b/core/modules/content_moderation/src/Form/EntityModerationForm.php @@ -71,7 +71,7 @@ class EntityModerationForm extends FormBase { $transitions = $this->validation->getValidTransitions($entity, $this->currentUser()); // Exclude self-transitions. - $transitions = array_filter($transitions, function(Transition $transition) use ($current_state) { + $transitions = array_filter($transitions, function (Transition $transition) use ($current_state) { return $transition->to()->id() != $current_state; }); diff --git a/core/modules/content_moderation/src/StateTransitionValidation.php b/core/modules/content_moderation/src/StateTransitionValidation.php index fc09e5eda68b..01b2ad845820 100644 --- a/core/modules/content_moderation/src/StateTransitionValidation.php +++ b/core/modules/content_moderation/src/StateTransitionValidation.php @@ -42,7 +42,7 @@ class StateTransitionValidation implements StateTransitionValidationInterface { $workflow = $this->moderationInfo->getWorkflowForEntity($entity); $current_state = $entity->moderation_state->value ? $workflow->getTypePlugin()->getState($entity->moderation_state->value) : $workflow->getTypePlugin()->getInitialState($entity); - return array_filter($current_state->getTransitions(), function(Transition $transition) use ($workflow, $user) { + return array_filter($current_state->getTransitions(), function (Transition $transition) use ($workflow, $user) { return $user->hasPermission('use ' . $workflow->id() . ' transition ' . $transition->id()); }); } diff --git a/core/modules/content_moderation/tests/src/Kernel/StateFormatterTest.php b/core/modules/content_moderation/tests/src/Kernel/StateFormatterTest.php index b45b34e8b0c8..c32123df927c 100644 --- a/core/modules/content_moderation/tests/src/Kernel/StateFormatterTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/StateFormatterTest.php @@ -52,7 +52,7 @@ class StateFormatterTest extends KernelTestBase { ]); $entity->save(); - $field_output = $this->container->get('renderer')->executeInRenderContext(new RenderContext(), function() use ($entity, $formatter_settings) { + $field_output = $this->container->get('renderer')->executeInRenderContext(new RenderContext(), function () use ($entity, $formatter_settings) { return $entity->moderation_state->view($formatter_settings); }); diff --git a/core/modules/content_translation/tests/src/Kernel/ContentTranslationSyncUnitTest.php b/core/modules/content_translation/tests/src/Kernel/ContentTranslationSyncUnitTest.php index e88d9acc76df..fa5fd1c9b780 100644 --- a/core/modules/content_translation/tests/src/Kernel/ContentTranslationSyncUnitTest.php +++ b/core/modules/content_translation/tests/src/Kernel/ContentTranslationSyncUnitTest.php @@ -181,19 +181,19 @@ class ContentTranslationSyncUnitTest extends KernelTestBase { // their delta. $delta_callbacks = [ // Continuous field values: all values are equal. - function($delta) { + function ($delta) { return TRUE; }, // Alternated field values: only the even ones are equal. - function($delta) { + function ($delta) { return $delta % 2 !== 0; }, // Sparse field values: only the "middle" ones are equal. - function($delta) { + function ($delta) { return $delta === 1 || $delta === 2; }, // Sparse field values: only the "extreme" ones are equal. - function($delta) { + function ($delta) { return $delta === 0 || $delta === 3; }, ]; diff --git a/core/modules/editor/tests/src/Kernel/EditorFileReferenceFilterTest.php b/core/modules/editor/tests/src/Kernel/EditorFileReferenceFilterTest.php index c68ae48e6e33..a70a232aa8f5 100644 --- a/core/modules/editor/tests/src/Kernel/EditorFileReferenceFilterTest.php +++ b/core/modules/editor/tests/src/Kernel/EditorFileReferenceFilterTest.php @@ -46,7 +46,7 @@ class EditorFileReferenceFilterTest extends KernelTestBase { public function testEditorFileReferenceFilter() { $filter = $this->filters['editor_file_reference']; - $test = function($input) use ($filter) { + $test = function ($input) use ($filter) { return $filter->process($input, 'und'); }; diff --git a/core/modules/field/src/Tests/Views/FieldUITest.php b/core/modules/field/src/Tests/Views/FieldUITest.php index ce8208ba65d3..851b7bdff9a9 100644 --- a/core/modules/field/src/Tests/Views/FieldUITest.php +++ b/core/modules/field/src/Tests/Views/FieldUITest.php @@ -57,7 +57,7 @@ class FieldUITest extends FieldTestBase { // Tests the available formatter options. $result = $this->xpath('//select[@id=:id]/option', [':id' => 'edit-options-type']); - $options = array_map(function($item) { + $options = array_map(function ($item) { return (string) $item->attributes()->value[0]; }, $result); // @todo Replace this sort by assertArray once it's in. @@ -111,7 +111,7 @@ class FieldUITest extends FieldTestBase { // Test the click sort column options. // Tests the available formatter options. $result = $this->xpath('//select[@id=:id]/option', [':id' => 'edit-options-click-sort-column']); - $options = array_map(function($item) { + $options = array_map(function ($item) { return (string) $item->attributes()->value[0]; }, $result); sort($options, SORT_STRING); diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php index 7ec5bf41d52a..2c4cdab752e3 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php @@ -174,7 +174,7 @@ class MigrateFieldInstanceTest extends MigrateDrupal7TestBase { // message with the required steps to fix this. $migration = $this->getMigration('d7_field_instance'); $messages = $migration->getIdMap()->getMessageIterator()->fetchAll(); - $errors = array_map(function($message) { + $errors = array_map(function ($message) { return $message->message; }, $messages); $this->assertCount(8, $errors); diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php index b53fa80870e7..272af0ec6850 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php @@ -149,7 +149,7 @@ class MigrateFieldTest extends MigrateDrupal7TestBase { // message with the required steps to fix this. $migration = $this->getMigration('d7_field'); $messages = $migration->getIdMap()->getMessageIterator()->fetchAll(); - $errors = array_map(function($message) { + $errors = array_map(function ($message) { return $message->message; }, $messages); sort($errors); diff --git a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php index 0a91862b351e..06eed1f9ac77 100644 --- a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php +++ b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php @@ -125,7 +125,7 @@ abstract class EntityDisplayFormBase extends EntityForm { */ protected function getFieldDefinitions() { $context = $this->displayContext; - return array_filter($this->entityManager->getFieldDefinitions($this->entity->getTargetEntityTypeId(), $this->entity->getTargetBundle()), function(FieldDefinitionInterface $field_definition) use ($context) { + return array_filter($this->entityManager->getFieldDefinitions($this->entity->getTargetEntityTypeId(), $this->entity->getTargetBundle()), function (FieldDefinitionInterface $field_definition) use ($context) { return $field_definition->isDisplayConfigurable($context); }); } diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php index 7ba011e08eac..750a327dede7 100644 --- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php +++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php @@ -85,7 +85,7 @@ class ManageDisplayTest extends WebTestBase { // Check whether formatter weights are respected. $result = $this->xpath('//select[@id=:id]/option', [':id' => 'edit-fields-field-test-type']); - $options = array_map(function($item) { + $options = array_map(function ($item) { return (string) $item->attributes()->value[0]; }, $result); $expected_options = [ @@ -247,7 +247,7 @@ class ManageDisplayTest extends WebTestBase { // Check whether widget weights are respected. $result = $this->xpath('//select[@id=:id]/option', [':id' => 'edit-fields-field-test-type']); - $options = array_map(function($item) { + $options = array_map(function ($item) { return (string) $item->attributes()->value[0]; }, $result); $expected_options = [ diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 845cc5d62314..b08fad53e0da 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -1208,7 +1208,7 @@ function file_managed_file_save_upload($element, FormStateInterface $form_state) // Value callback expects FIDs to be keys. $files = array_filter($files); - $fids = array_map(function($file) { + $fids = array_map(function ($file) { return $file->id(); }, $files); diff --git a/core/modules/file/src/Plugin/migrate/source/d6/UploadInstance.php b/core/modules/file/src/Plugin/migrate/source/d6/UploadInstance.php index 06c222129233..17c34bf3abd0 100644 --- a/core/modules/file/src/Plugin/migrate/source/d6/UploadInstance.php +++ b/core/modules/file/src/Plugin/migrate/source/d6/UploadInstance.php @@ -25,7 +25,7 @@ class UploadInstance extends DrupalSqlBase { ->fields('nt', ['type']) ->execute() ->fetchCol(); - $variables = array_map(function($type) { + $variables = array_map(function ($type) { return 'upload_' . $type; }, $node_types); diff --git a/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d6/FileCckTest.php b/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d6/FileCckTest.php index 2997596d95f1..6a393df54b03 100644 --- a/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d6/FileCckTest.php +++ b/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d6/FileCckTest.php @@ -38,7 +38,7 @@ class FileCckTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to mergeProcessOfProperty(). $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array')) - ->will(function($arguments) use ($migration) { + ->will(function ($arguments) use ($migration) { $migration->getProcess()->willReturn($arguments[1]); }); $this->migration = $migration->reveal(); diff --git a/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d7/FileCckTest.php b/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d7/FileCckTest.php index 8503eae783c5..9478b32a93a5 100644 --- a/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d7/FileCckTest.php +++ b/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d7/FileCckTest.php @@ -38,7 +38,7 @@ class FileCckTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to mergeProcessOfProperty(). $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array')) - ->will(function($arguments) use ($migration) { + ->will(function ($arguments) use ($migration) { $migration->getProcess()->willReturn($arguments[1]); }); $this->migration = $migration->reveal(); diff --git a/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d7/ImageCckTest.php b/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d7/ImageCckTest.php index 4a8f1ce99691..06695e43360b 100644 --- a/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d7/ImageCckTest.php +++ b/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d7/ImageCckTest.php @@ -37,7 +37,7 @@ class ImageCckTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to mergeProcessOfProperty(). $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array')) - ->will(function($arguments) use ($migration) { + ->will(function ($arguments) use ($migration) { $migration->getProcess()->willReturn($arguments[1]); }); $this->migration = $migration->reveal(); diff --git a/core/modules/file/tests/src/Unit/Plugin/migrate/field/d6/FileFieldTest.php b/core/modules/file/tests/src/Unit/Plugin/migrate/field/d6/FileFieldTest.php index 28d084200469..70f6d6056aa6 100644 --- a/core/modules/file/tests/src/Unit/Plugin/migrate/field/d6/FileFieldTest.php +++ b/core/modules/file/tests/src/Unit/Plugin/migrate/field/d6/FileFieldTest.php @@ -37,7 +37,7 @@ class FileFieldTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to mergeProcessOfProperty(). $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array')) - ->will(function($arguments) use ($migration) { + ->will(function ($arguments) use ($migration) { $migration->getProcess()->willReturn($arguments[1]); }); $this->migration = $migration->reveal(); diff --git a/core/modules/file/tests/src/Unit/Plugin/migrate/field/d7/FileFieldTest.php b/core/modules/file/tests/src/Unit/Plugin/migrate/field/d7/FileFieldTest.php index 15d86a1096ce..e77438289dce 100644 --- a/core/modules/file/tests/src/Unit/Plugin/migrate/field/d7/FileFieldTest.php +++ b/core/modules/file/tests/src/Unit/Plugin/migrate/field/d7/FileFieldTest.php @@ -37,7 +37,7 @@ class FileFieldTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to mergeProcessOfProperty(). $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array')) - ->will(function($arguments) use ($migration) { + ->will(function ($arguments) use ($migration) { $migration->getProcess()->willReturn($arguments[1]); }); $this->migration = $migration->reveal(); diff --git a/core/modules/file/tests/src/Unit/Plugin/migrate/field/d7/ImageFieldTest.php b/core/modules/file/tests/src/Unit/Plugin/migrate/field/d7/ImageFieldTest.php index 61fda0371903..fd11800cbfcb 100644 --- a/core/modules/file/tests/src/Unit/Plugin/migrate/field/d7/ImageFieldTest.php +++ b/core/modules/file/tests/src/Unit/Plugin/migrate/field/d7/ImageFieldTest.php @@ -36,7 +36,7 @@ class ImageFieldTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to mergeProcessOfProperty(). $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array')) - ->will(function($arguments) use ($migration) { + ->will(function ($arguments) use ($migration) { $migration->getProcess()->willReturn($arguments[1]); }); $this->migration = $migration->reveal(); diff --git a/core/modules/filter/src/Element/ProcessedText.php b/core/modules/filter/src/Element/ProcessedText.php index 6e2b3ec43e87..5c7a21234ecc 100644 --- a/core/modules/filter/src/Element/ProcessedText.php +++ b/core/modules/filter/src/Element/ProcessedText.php @@ -82,7 +82,7 @@ class ProcessedText extends RenderElement { return $element; } - $filter_must_be_applied = function(FilterInterface $filter) use ($filter_types_to_skip) { + $filter_must_be_applied = function (FilterInterface $filter) use ($filter_types_to_skip) { $enabled = $filter->status === TRUE; $type = $filter->getType(); // Prevent FilterInterface::TYPE_HTML_RESTRICTOR from being skipped. diff --git a/core/modules/filter/src/Entity/FilterFormat.php b/core/modules/filter/src/Entity/FilterFormat.php index 9dbaa62fd2c2..c757512c7704 100644 --- a/core/modules/filter/src/Entity/FilterFormat.php +++ b/core/modules/filter/src/Entity/FilterFormat.php @@ -269,7 +269,7 @@ class FilterFormat extends ConfigEntityBase implements FilterFormatInterface, En */ public function getHtmlRestrictions() { // Ignore filters that are disabled or don't have HTML restrictions. - $filters = array_filter($this->filters()->getAll(), function($filter) { + $filters = array_filter($this->filters()->getAll(), function ($filter) { if (!$filter->status) { return FALSE; } @@ -286,7 +286,7 @@ class FilterFormat extends ConfigEntityBase implements FilterFormatInterface, En // From the set of remaining filters (they were filtered by array_filter() // above), collect the list of tags and attributes that are allowed by all // filters, i.e. the intersection of all allowed tags and attributes. - $restrictions = array_reduce($filters, function($restrictions, $filter) { + $restrictions = array_reduce($filters, function ($restrictions, $filter) { $new_restrictions = $filter->getHTMLRestrictions(); // The first filter with HTML restrictions provides the initial set. diff --git a/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestRestrictTagsAndAttributes.php b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestRestrictTagsAndAttributes.php index 352506ea5711..c6f62009cdc4 100644 --- a/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestRestrictTagsAndAttributes.php +++ b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestRestrictTagsAndAttributes.php @@ -22,7 +22,7 @@ class FilterTestRestrictTagsAndAttributes extends FilterBase { * {@inheritdoc} */ public function process($text, $langcode) { - $allowed_tags = array_filter($this->settings['restrictions']['allowed'], function($value) { + $allowed_tags = array_filter($this->settings['restrictions']['allowed'], function ($value) { return is_array($value) || (bool) $value !== FALSE; }); return new FilterProcessResult(Xss::filter($text, array_keys($allowed_tags))); diff --git a/core/modules/filter/tests/src/Kernel/FilterKernelTest.php b/core/modules/filter/tests/src/Kernel/FilterKernelTest.php index cf72bbee4563..7b0c029b1b58 100644 --- a/core/modules/filter/tests/src/Kernel/FilterKernelTest.php +++ b/core/modules/filter/tests/src/Kernel/FilterKernelTest.php @@ -44,7 +44,7 @@ class FilterKernelTest extends KernelTestBase { public function testAlignFilter() { $filter = $this->filters['filter_align']; - $test = function($input) use ($filter) { + $test = function ($input) use ($filter) { return $filter->process($input, 'und'); }; @@ -101,7 +101,7 @@ class FilterKernelTest extends KernelTestBase { $renderer = \Drupal::service('renderer'); $filter = $this->filters['filter_caption']; - $test = function($input) use ($filter, $renderer) { + $test = function ($input) use ($filter, $renderer) { return $renderer->executeInRenderContext(new RenderContext(), function () use ($input, $filter) { return $filter->process($input, 'und'); }); @@ -266,7 +266,7 @@ class FilterKernelTest extends KernelTestBase { $align_filter = $this->filters['filter_align']; $caption_filter = $this->filters['filter_caption']; - $test = function($input) use ($align_filter, $caption_filter, $renderer) { + $test = function ($input) use ($align_filter, $caption_filter, $renderer) { return $renderer->executeInRenderContext(new RenderContext(), function () use ($input, $align_filter, $caption_filter) { return $caption_filter->process($align_filter->process($input, 'und'), 'und'); }); diff --git a/core/modules/language/src/HttpKernel/PathProcessorLanguage.php b/core/modules/language/src/HttpKernel/PathProcessorLanguage.php index c4af20c71ed8..8bb4f838e91d 100644 --- a/core/modules/language/src/HttpKernel/PathProcessorLanguage.php +++ b/core/modules/language/src/HttpKernel/PathProcessorLanguage.php @@ -147,7 +147,7 @@ class PathProcessorLanguage implements InboundPathProcessorInterface, OutboundPa // Sort the processors list, so that their functions are called in the // order specified by the weight of the methods. - uksort($this->processors[$scope], function ($method_id_a, $method_id_b) use($weights) { + uksort($this->processors[$scope], function ($method_id_a, $method_id_b) use ($weights) { $a_weight = $weights[$method_id_a]; $b_weight = $weights[$method_id_b]; diff --git a/core/modules/language/src/LanguageServiceProvider.php b/core/modules/language/src/LanguageServiceProvider.php index 4060f75d371e..a7e934aab66b 100644 --- a/core/modules/language/src/LanguageServiceProvider.php +++ b/core/modules/language/src/LanguageServiceProvider.php @@ -70,7 +70,7 @@ class LanguageServiceProvider extends ServiceProviderBase { // and caching. This might prove difficult as this is called before the // container has finished building. $config_storage = BootstrapConfigStorageFactory::get(); - $config_ids = array_filter($config_storage->listAll($prefix), function($config_id) use ($prefix) { + $config_ids = array_filter($config_storage->listAll($prefix), function ($config_id) use ($prefix) { return $config_id != $prefix . LanguageInterface::LANGCODE_NOT_SPECIFIED && $config_id != $prefix . LanguageInterface::LANGCODE_NOT_APPLICABLE; }); return count($config_ids) > 1; diff --git a/core/modules/language/src/Plugin/Condition/Language.php b/core/modules/language/src/Plugin/Condition/Language.php index a5b3d41e8c17..52a89a2d0f74 100644 --- a/core/modules/language/src/Plugin/Condition/Language.php +++ b/core/modules/language/src/Plugin/Condition/Language.php @@ -104,7 +104,7 @@ class Language extends ConditionPluginBase implements ContainerFactoryPluginInte $language_list = $this->languageManager->getLanguages(LanguageInterface::STATE_ALL); $selected = $this->configuration['langcodes']; // Reduce the language list to an array of language names. - $language_names = array_reduce($language_list, function(&$result, $item) use ($selected) { + $language_names = array_reduce($language_list, function (&$result, $item) use ($selected) { // If the current item of the $language_list array is one of the selected // languages, add it to the $results array. if (!empty($selected[$item->getId()])) { diff --git a/core/modules/link/tests/src/Kernel/Plugin/migrate/cckfield/d7/LinkCckTest.php b/core/modules/link/tests/src/Kernel/Plugin/migrate/cckfield/d7/LinkCckTest.php index 77d35e091fa9..896c15c9fca0 100644 --- a/core/modules/link/tests/src/Kernel/Plugin/migrate/cckfield/d7/LinkCckTest.php +++ b/core/modules/link/tests/src/Kernel/Plugin/migrate/cckfield/d7/LinkCckTest.php @@ -44,7 +44,7 @@ class LinkCckTest extends KernelTestBase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to mergeProcessOfProperty(). $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array')) - ->will(function($arguments) use ($migration) { + ->will(function ($arguments) use ($migration) { $migration->getProcess()->willReturn($arguments[1]); }); diff --git a/core/modules/link/tests/src/Kernel/Plugin/migrate/field/d7/LinkFieldTest.php b/core/modules/link/tests/src/Kernel/Plugin/migrate/field/d7/LinkFieldTest.php index 7dea25e77488..494aa028896f 100644 --- a/core/modules/link/tests/src/Kernel/Plugin/migrate/field/d7/LinkFieldTest.php +++ b/core/modules/link/tests/src/Kernel/Plugin/migrate/field/d7/LinkFieldTest.php @@ -43,7 +43,7 @@ class LinkFieldTest extends KernelTestBase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to mergeProcessOfProperty(). $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array')) - ->will(function($arguments) use ($migration) { + ->will(function ($arguments) use ($migration) { $migration->getProcess()->willReturn($arguments[1]); }); diff --git a/core/modules/link/tests/src/Unit/Plugin/migrate/cckfield/LinkCckTest.php b/core/modules/link/tests/src/Unit/Plugin/migrate/cckfield/LinkCckTest.php index f549a0dc1b6d..7029d72412e9 100644 --- a/core/modules/link/tests/src/Unit/Plugin/migrate/cckfield/LinkCckTest.php +++ b/core/modules/link/tests/src/Unit/Plugin/migrate/cckfield/LinkCckTest.php @@ -37,7 +37,7 @@ class LinkCckTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to mergeProcessOfProperty(). $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array')) - ->will(function($arguments) use ($migration) { + ->will(function ($arguments) use ($migration) { $migration->getProcess()->willReturn($arguments[1]); }); diff --git a/core/modules/link/tests/src/Unit/Plugin/migrate/field/d6/LinkFieldTest.php b/core/modules/link/tests/src/Unit/Plugin/migrate/field/d6/LinkFieldTest.php index 645e3e13a9e5..1b07d1ed0b69 100644 --- a/core/modules/link/tests/src/Unit/Plugin/migrate/field/d6/LinkFieldTest.php +++ b/core/modules/link/tests/src/Unit/Plugin/migrate/field/d6/LinkFieldTest.php @@ -36,7 +36,7 @@ class LinkFieldTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to mergeProcessOfProperty(). $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array')) - ->will(function($arguments) use ($migration) { + ->will(function ($arguments) use ($migration) { $migration->getProcess()->willReturn($arguments[1]); }); diff --git a/core/modules/locale/locale.batch.inc b/core/modules/locale/locale.batch.inc index fade1728266a..b509c2542b55 100644 --- a/core/modules/locale/locale.batch.inc +++ b/core/modules/locale/locale.batch.inc @@ -240,7 +240,7 @@ function locale_translation_http_check($uri) { $actual_uri = NULL; $response = \Drupal::service('http_client_factory')->fromOptions([ 'allow_redirects' => [ - 'on_redirect' => function(RequestInterface $request, ResponseInterface $response, UriInterface $request_uri) use (&$actual_uri) { + 'on_redirect' => function (RequestInterface $request, ResponseInterface $response, UriInterface $request_uri) use (&$actual_uri) { $actual_uri = (string) $request_uri; } ], diff --git a/core/modules/locale/locale.translation.inc b/core/modules/locale/locale.translation.inc index 571f7d2247fe..a2816e3fbc0b 100644 --- a/core/modules/locale/locale.translation.inc +++ b/core/modules/locale/locale.translation.inc @@ -67,7 +67,7 @@ function locale_translation_get_projects(array $project_names = []) { locale_translation_build_projects(); } $projects = \Drupal::service('locale.project')->getAll(); - array_walk($projects, function(&$project) { + array_walk($projects, function (&$project) { $project = (object) $project; }); } @@ -329,7 +329,7 @@ function locale_cron_fill_queue() { // Determine which project+language should be updated. $last = REQUEST_TIME - $config->get('translation.update_interval_days') * 3600 * 24; $projects = \Drupal::service('locale.project')->getAll(); - $projects = array_filter($projects, function($project) { + $projects = array_filter($projects, function ($project) { return $project['status'] == 1; }); $files = db_select('locale_file', 'f') diff --git a/core/modules/menu_ui/src/MenuForm.php b/core/modules/menu_ui/src/MenuForm.php index 0bee996755e1..cb27b25d7739 100644 --- a/core/modules/menu_ui/src/MenuForm.php +++ b/core/modules/menu_ui/src/MenuForm.php @@ -221,7 +221,7 @@ class MenuForm extends EntityForm { $this->getRequest()->attributes->set('_menu_admin', FALSE); // Determine the delta; the number of weights to be made available. - $count = function(array $tree) { + $count = function (array $tree) { $sum = function ($carry, MenuLinkTreeElement $item) { return $carry + $item->count(); }; diff --git a/core/modules/migrate/src/Plugin/MigrationPluginManager.php b/core/modules/migrate/src/Plugin/MigrationPluginManager.php index f3b75bc89cb4..b572bb5cc5f0 100644 --- a/core/modules/migrate/src/Plugin/MigrationPluginManager.php +++ b/core/modules/migrate/src/Plugin/MigrationPluginManager.php @@ -64,7 +64,7 @@ class MigrationPluginManager extends DefaultPluginManager implements MigrationPl */ protected function getDiscovery() { if (!isset($this->discovery)) { - $directories = array_map(function($directory) { + $directories = array_map(function ($directory) { return [$directory . '/migration_templates', $directory . '/migrations']; }, $this->moduleHandler->getModuleDirectories()); @@ -125,7 +125,7 @@ class MigrationPluginManager extends DefaultPluginManager implements MigrationPl * An array of migration objects with the given tag. */ public function createInstancesByTag($tag) { - $migrations = array_filter($this->getDefinitions(), function($migration) use ($tag) { + $migrations = array_filter($this->getDefinitions(), function ($migration) use ($tag) { return !empty($migration['migration_tags']) && in_array($tag, $migration['migration_tags']); }); return $this->createInstances(array_keys($migrations)); diff --git a/core/modules/migrate/tests/src/Kernel/MigrateSqlSourceTestBase.php b/core/modules/migrate/tests/src/Kernel/MigrateSqlSourceTestBase.php index 76c941975769..d7058b1a7d26 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateSqlSourceTestBase.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateSqlSourceTestBase.php @@ -39,7 +39,7 @@ abstract class MigrateSqlSourceTestBase extends MigrateSourceTestBase { ->createTable($table, [ // SQLite uses loose affinity typing, so it's OK for every field to // be a text field. - 'fields' => array_map(function() { + 'fields' => array_map(function () { return ['type' => 'text']; }, $pilot), ]); diff --git a/core/modules/migrate/tests/src/Kernel/MigrateTestBase.php b/core/modules/migrate/tests/src/Kernel/MigrateTestBase.php index 2f1a49eaae90..51e61d40ca49 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateTestBase.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateTestBase.php @@ -230,7 +230,7 @@ abstract class MigrateTestBase extends KernelTestBase implements MigrateMessageI $migration = $this->getMigration($migration); } /** @var \Drupal\migrate\Plugin\MigrationInterface $migration */ - $destination = array_map(function() { + $destination = array_map(function () { return NULL; }, $migration->getDestinationPlugin()->getIds()); $row = new Row($row, $migration->getSourcePlugin()->getIds()); diff --git a/core/modules/migrate/tests/src/Unit/MigrateTestCase.php b/core/modules/migrate/tests/src/Unit/MigrateTestCase.php index cbac03a84e5f..20d7662d2901 100644 --- a/core/modules/migrate/tests/src/Unit/MigrateTestCase.php +++ b/core/modules/migrate/tests/src/Unit/MigrateTestCase.php @@ -61,12 +61,12 @@ abstract class MigrateTestCase extends UnitTestCase { // on the test class and use a return callback. $migration->expects($this->any()) ->method('getStatus') - ->willReturnCallback(function() { + ->willReturnCallback(function () { return $this->migrationStatus; }); $migration->expects($this->any()) ->method('setStatus') - ->willReturnCallback(function($status) { + ->willReturnCallback(function ($status) { $this->migrationStatus = $status; }); @@ -147,7 +147,7 @@ abstract class MigrateTestCase extends UnitTestCase { protected function createSchemaFromRow(array $row) { // SQLite uses loose ("affinity") typing, so it is OK for every column to be // a text field. - $fields = array_map(function() { + $fields = array_map(function () { return ['type' => 'text']; }, $row); return ['fields' => $fields]; diff --git a/core/modules/migrate/tests/src/Unit/process/GetTest.php b/core/modules/migrate/tests/src/Unit/process/GetTest.php index b87893550d24..59ce8b68f8d3 100644 --- a/core/modules/migrate/tests/src/Unit/process/GetTest.php +++ b/core/modules/migrate/tests/src/Unit/process/GetTest.php @@ -48,7 +48,7 @@ class GetTest extends MigrateProcessTestCase { $this->plugin->setSource(['test1', 'test2']); $this->row->expects($this->exactly(2)) ->method('getSourceProperty') - ->will($this->returnCallback(function ($argument) use ($map) { + ->will($this->returnCallback(function ($argument) use ($map) { return $map[$argument]; })); $value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty'); @@ -81,7 +81,7 @@ class GetTest extends MigrateProcessTestCase { $this->plugin->setSource(['test1', '@@test2', '@@test3', 'test4']); $this->row->expects($this->exactly(4)) ->method('getSourceProperty') - ->will($this->returnCallback(function ($argument) use ($map) { + ->will($this->returnCallback(function ($argument) use ($map) { return $map[$argument]; })); $value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty'); diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d6/EntityContentBaseTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d6/EntityContentBaseTest.php index 9c5ee58f2c2b..6be7801b6e2f 100644 --- a/core/modules/migrate_drupal/tests/src/Kernel/d6/EntityContentBaseTest.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/EntityContentBaseTest.php @@ -114,7 +114,7 @@ class EntityContentBaseTest extends MigrateDrupal6TestBase { $message = $this->prophesize(MigrateMessageInterface::class); // Match the expected message. Can't use default argument types, because // we need to convert to string from TranslatableMarkup. - $argument = Argument::that(function($msg) { + $argument = Argument::that(function ($msg) { return strpos((string) $msg, "This entity type does not support translation") !== FALSE; }); $message->display($argument, Argument::any()) diff --git a/core/modules/quickedit/quickedit.module b/core/modules/quickedit/quickedit.module index 89d4b8640460..3d270500789f 100644 --- a/core/modules/quickedit/quickedit.module +++ b/core/modules/quickedit/quickedit.module @@ -77,7 +77,7 @@ function quickedit_library_info_alter(&$libraries, $extension) { $theme = Drupal::config('system.theme')->get('admin'); // First let the base theme modify the library, then the actual theme. - $alter_library = function(&$library, $theme) use (&$alter_library) { + $alter_library = function (&$library, $theme) use (&$alter_library) { if (isset($theme) && $theme_path = drupal_get_path('theme', $theme)) { $info = system_get_info('theme', $theme); // Recurse to process base theme(s) first. diff --git a/core/modules/responsive_image/responsive_image.post_update.php b/core/modules/responsive_image/responsive_image.post_update.php index 33fec7194084..de9424f026c2 100644 --- a/core/modules/responsive_image/responsive_image.post_update.php +++ b/core/modules/responsive_image/responsive_image.post_update.php @@ -13,7 +13,7 @@ use Drupal\Core\Entity\Entity\EntityViewDisplay; */ function responsive_image_post_update_recreate_dependencies() { $displays = EntityViewDisplay::loadMultiple(); - array_walk($displays, function(EntityViewDisplayInterface $entity_view_display) { + array_walk($displays, function (EntityViewDisplayInterface $entity_view_display) { $old_dependencies = $entity_view_display->getDependencies(); $new_dependencies = $entity_view_display->calculateDependencies()->getDependencies(); if ($old_dependencies !== $new_dependencies) { diff --git a/core/modules/rest/src/Plugin/views/display/RestExport.php b/core/modules/rest/src/Plugin/views/display/RestExport.php index cd961954a4dd..7aeb3fc61924 100644 --- a/core/modules/rest/src/Plugin/views/display/RestExport.php +++ b/core/modules/rest/src/Plugin/views/display/RestExport.php @@ -407,7 +407,7 @@ class RestExport extends PathPluginBase implements ResponseDisplayPluginInterfac */ public function render() { $build = []; - $build['#markup'] = $this->renderer->executeInRenderContext(new RenderContext(), function() { + $build['#markup'] = $this->renderer->executeInRenderContext(new RenderContext(), function () { return $this->view->style_plugin->render(); }); diff --git a/core/modules/rest/src/Plugin/views/row/DataFieldRow.php b/core/modules/rest/src/Plugin/views/row/DataFieldRow.php index 175db17b5c03..c511877c71db 100644 --- a/core/modules/rest/src/Plugin/views/row/DataFieldRow.php +++ b/core/modules/rest/src/Plugin/views/row/DataFieldRow.php @@ -184,7 +184,7 @@ class DataFieldRow extends RowPluginBase { * A regular one dimensional array of values. */ protected static function extractFromOptionsArray($key, $options) { - return array_map(function($item) use ($key) { + return array_map(function ($item) use ($key) { return isset($item[$key]) ? $item[$key] : NULL; }, $options); } diff --git a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php index ad1a0b30a53c..a15458705770 100644 --- a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php +++ b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php @@ -667,7 +667,7 @@ class StyleSerializerTest extends ViewTestBase { $result = Json::decode($this->drupalGet('test/serialize/node-field', ['query' => ['_format' => 'json']])); $this->assertEqual(count($result[2]['body']), $node->body->count(), 'Expected count of values'); - $this->assertEqual($result[2]['body'], array_map(function($item) { + $this->assertEqual($result[2]['body'], array_map(function ($item) { return $item['value']; }, $node->body->getValue()), 'Expected raw body values found.'); } diff --git a/core/modules/serialization/src/Normalizer/NormalizerBase.php b/core/modules/serialization/src/Normalizer/NormalizerBase.php index 7916a9092af2..5e829f65e701 100644 --- a/core/modules/serialization/src/Normalizer/NormalizerBase.php +++ b/core/modules/serialization/src/Normalizer/NormalizerBase.php @@ -36,7 +36,7 @@ abstract class NormalizerBase extends SerializerAwareNormalizer implements Norma $supported = (array) $this->supportedInterfaceOrClass; - return (bool) array_filter($supported, function($name) use ($data) { + return (bool) array_filter($supported, function ($name) use ($data) { return $data instanceof $name; }); } @@ -56,7 +56,7 @@ abstract class NormalizerBase extends SerializerAwareNormalizer implements Norma $supported = (array) $this->supportedInterfaceOrClass; - $subclass_check = function($name) use ($type) { + $subclass_check = function ($name) use ($type) { return (class_exists($name) || interface_exists($name)) && is_subclass_of($type, $name, TRUE); }; diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index 2213e9347d28..0e0ea2afd400 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -345,7 +345,7 @@ function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpun } else { // Double escape namespaces so they'll work in a regexp. - $escaped_test_classnames = array_map(function($class) { + $escaped_test_classnames = array_map(function ($class) { return addslashes($class); }, $unescaped_test_classnames); diff --git a/core/modules/simpletest/src/AssertContentTrait.php b/core/modules/simpletest/src/AssertContentTrait.php index 5a6c8c06ef5e..3c33e5879fe1 100644 --- a/core/modules/simpletest/src/AssertContentTrait.php +++ b/core/modules/simpletest/src/AssertContentTrait.php @@ -874,7 +874,7 @@ trait AssertContentTrait { // The string cast is necessary because theme functions return // MarkupInterface objects. This means we can assert that $expected // matches the theme output without having to worry about 0 == ''. - $output = (string) $renderer->executeInRenderContext(new RenderContext(), function() use ($callback, $variables) { + $output = (string) $renderer->executeInRenderContext(new RenderContext(), function () use ($callback, $variables) { return \Drupal::theme()->render($callback, $variables); }); $this->verbose( diff --git a/core/modules/system/src/SystemManager.php b/core/modules/system/src/SystemManager.php index d2e03443db49..3fc41829c616 100644 --- a/core/modules/system/src/SystemManager.php +++ b/core/modules/system/src/SystemManager.php @@ -110,7 +110,7 @@ class SystemManager { // Check run-time requirements and status information. $requirements = $this->moduleHandler->invokeAll('requirements', ['runtime']); - uasort($requirements, function($a, $b) { + uasort($requirements, function ($a, $b) { if (!isset($a['weight'])) { if (!isset($b['weight'])) { return strcasecmp($a['title'], $b['title']); diff --git a/core/modules/system/src/Tests/Ajax/CommandsTest.php b/core/modules/system/src/Tests/Ajax/CommandsTest.php index 6970cc30df89..6ae97ae1341a 100644 --- a/core/modules/system/src/Tests/Ajax/CommandsTest.php +++ b/core/modules/system/src/Tests/Ajax/CommandsTest.php @@ -124,7 +124,7 @@ class CommandsTest extends AjaxTestBase { * Regression test: Settings command exists regardless of JS aggregation. */ public function testAttachedSettings() { - $assert = function($message) { + $assert = function ($message) { $response = new AjaxResponse(); $response->setAttachments([ 'library' => ['core/drupalSettings'], diff --git a/core/modules/system/src/Tests/Bootstrap/ErrorContainer.php b/core/modules/system/src/Tests/Bootstrap/ErrorContainer.php index 9ee814f11bfd..e8afa4b1d010 100644 --- a/core/modules/system/src/Tests/Bootstrap/ErrorContainer.php +++ b/core/modules/system/src/Tests/Bootstrap/ErrorContainer.php @@ -15,7 +15,7 @@ class ErrorContainer extends Container { public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) { if ($id === 'http_kernel') { // Enforce a recoverable error. - $callable = function(ErrorContainer $container) { + $callable = function (ErrorContainer $container) { }; $callable(1); } diff --git a/core/modules/system/src/Tests/Common/UrlTest.php b/core/modules/system/src/Tests/Common/UrlTest.php index d72f8e5294c9..1092e1a03228 100644 --- a/core/modules/system/src/Tests/Common/UrlTest.php +++ b/core/modules/system/src/Tests/Common/UrlTest.php @@ -168,7 +168,7 @@ class UrlTest extends WebTestBase { $l = \Drupal::l('foo', Url::fromUri('https://www.drupal.org')); // Test a renderable array passed to the link generator. - $renderer->executeInRenderContext(new RenderContext(), function() use ($renderer, $l) { + $renderer->executeInRenderContext(new RenderContext(), function () use ($renderer, $l) { $renderable_text = ['#markup' => 'foo']; $l_renderable_text = \Drupal::l($renderable_text, Url::fromUri('https://www.drupal.org')); $this->assertEqual($l_renderable_text, $l); diff --git a/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php index 03ae3664de9e..dd526b863a9a 100644 --- a/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php +++ b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php @@ -56,7 +56,7 @@ class ErrorTestController extends ControllerBase { * Generate fatals to test the error handler. */ public function generateFatals() { - $function = function(array $test) { + $function = function (array $test) { }; $function("test-string"); diff --git a/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php b/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php index 684e0be8fc91..363736975328 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php @@ -42,7 +42,7 @@ class EntityViewControllerTest extends BrowserTestBase { * Tests EntityViewController. */ public function testEntityViewController() { - $get_label_markup = function($label) { + $get_label_markup = function ($label) { return '