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 '

' . $label . '

'; diff --git a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php index 5fcc5cd92507..2fe4a8335d0a 100644 --- a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php +++ b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php @@ -191,7 +191,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase { $this->requestMatcher->expects($this->exactly(1)) ->method('matchRequest') - ->will($this->returnCallback(function(Request $request) use ($route_1) { + ->will($this->returnCallback(function (Request $request) use ($route_1) { if ($request->getPathInfo() == '/example') { return [ RouteObjectInterface::ROUTE_NAME => 'example', @@ -227,7 +227,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase { $this->requestMatcher->expects($this->exactly(2)) ->method('matchRequest') - ->will($this->returnCallback(function(Request $request) use ($route_1, $route_2) { + ->will($this->returnCallback(function (Request $request) use ($route_1, $route_2) { if ($request->getPathInfo() == '/example/bar') { return [ RouteObjectInterface::ROUTE_NAME => 'example_bar', @@ -357,7 +357,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase { $this->requestMatcher->expects($this->exactly(1)) ->method('matchRequest') - ->will($this->returnCallback(function(Request $request) use ($route_1) { + ->will($this->returnCallback(function (Request $request) use ($route_1) { if ($request->getPathInfo() == '/user/1') { return [ RouteObjectInterface::ROUTE_NAME => 'user_page', diff --git a/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php b/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php index c2014d508923..2423668e18fb 100644 --- a/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php +++ b/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php @@ -137,7 +137,7 @@ class MenuLinkTreeTest extends UnitTestCase { ] ]; - $get_built_element = function(MenuLinkTreeElement $element) { + $get_built_element = function (MenuLinkTreeElement $element) { $return = [ 'attributes' => new Attribute(), 'title' => $element->link->getTitle(), diff --git a/core/modules/taxonomy/tests/src/Unit/Plugin/migrate/cckfield/TaxonomyTermReferenceCckTest.php b/core/modules/taxonomy/tests/src/Unit/Plugin/migrate/cckfield/TaxonomyTermReferenceCckTest.php index 5e646e062551..981969fc8d02 100644 --- a/core/modules/taxonomy/tests/src/Unit/Plugin/migrate/cckfield/TaxonomyTermReferenceCckTest.php +++ b/core/modules/taxonomy/tests/src/Unit/Plugin/migrate/cckfield/TaxonomyTermReferenceCckTest.php @@ -37,7 +37,7 @@ class TaxonomyTermReferenceCckTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to setProcessOfProperty(). $migration->setProcessOfProperty(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/taxonomy/tests/src/Unit/Plugin/migrate/field/TaxonomyTermReferenceFieldTest.php b/core/modules/taxonomy/tests/src/Unit/Plugin/migrate/field/TaxonomyTermReferenceFieldTest.php index de88d7d91f11..974fc158cdb9 100644 --- a/core/modules/taxonomy/tests/src/Unit/Plugin/migrate/field/TaxonomyTermReferenceFieldTest.php +++ b/core/modules/taxonomy/tests/src/Unit/Plugin/migrate/field/TaxonomyTermReferenceFieldTest.php @@ -36,7 +36,7 @@ class TaxonomyTermReferenceFieldTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to setProcessOfProperty(). $migration->setProcessOfProperty(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/text/tests/src/Unit/Migrate/TextCckTest.php b/core/modules/text/tests/src/Unit/Migrate/TextCckTest.php index 73d7e2e62340..2d2c6550039c 100644 --- a/core/modules/text/tests/src/Unit/Migrate/TextCckTest.php +++ b/core/modules/text/tests/src/Unit/Migrate/TextCckTest.php @@ -38,7 +38,7 @@ class TextCckTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to setProcessOfProperty(). $migration->setProcessOfProperty(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/text/tests/src/Unit/Migrate/d6/TextFieldTest.php b/core/modules/text/tests/src/Unit/Migrate/d6/TextFieldTest.php index 44fb04e71b92..a49b9aff2106 100644 --- a/core/modules/text/tests/src/Unit/Migrate/d6/TextFieldTest.php +++ b/core/modules/text/tests/src/Unit/Migrate/d6/TextFieldTest.php @@ -38,7 +38,7 @@ class TextFieldTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to setProcessOfProperty(). $migration->setProcessOfProperty(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/text/tests/src/Unit/Plugin/migrate/cckfield/TextCckTest.php b/core/modules/text/tests/src/Unit/Plugin/migrate/cckfield/TextCckTest.php index 6f2d967029a9..0847c1263ee4 100644 --- a/core/modules/text/tests/src/Unit/Plugin/migrate/cckfield/TextCckTest.php +++ b/core/modules/text/tests/src/Unit/Plugin/migrate/cckfield/TextCckTest.php @@ -38,7 +38,7 @@ class TextCckTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to setProcessOfProperty(). $migration->setProcessOfProperty(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/text/tests/src/Unit/Plugin/migrate/field/d6/TextFieldTest.php b/core/modules/text/tests/src/Unit/Plugin/migrate/field/d6/TextFieldTest.php index 52418fe3719c..836398920629 100644 --- a/core/modules/text/tests/src/Unit/Plugin/migrate/field/d6/TextFieldTest.php +++ b/core/modules/text/tests/src/Unit/Plugin/migrate/field/d6/TextFieldTest.php @@ -37,7 +37,7 @@ class TextFieldTest extends UnitTestCase { // process pipeline created by the plugin, we need to ensure that // getProcess() always returns the last input to setProcessOfProperty(). $migration->setProcessOfProperty(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/user/src/Entity/Role.php b/core/modules/user/src/Entity/Role.php index 0e7ef0e5cbf5..0226f94b7814 100644 --- a/core/modules/user/src/Entity/Role.php +++ b/core/modules/user/src/Entity/Role.php @@ -173,7 +173,7 @@ class Role extends ConfigEntityBase implements RoleInterface { if (!isset($this->weight) && ($roles = $storage->loadMultiple())) { // Set a role weight to make this new role last. - $max = array_reduce($roles, function($max, $role) { + $max = array_reduce($roles, function ($max, $role) { return $max > $role->weight ? $max : $role->weight; }); $this->weight = $max + 1; diff --git a/core/modules/user/src/Plugin/views/argument/Uid.php b/core/modules/user/src/Plugin/views/argument/Uid.php index b2a022a2ac3c..5efbecd531eb 100644 --- a/core/modules/user/src/Plugin/views/argument/Uid.php +++ b/core/modules/user/src/Plugin/views/argument/Uid.php @@ -54,7 +54,7 @@ class Uid extends NumericArgument { * A list of usernames. */ public function titleQuery() { - return array_map(function($account) { + return array_map(function ($account) { return $account->label(); }, $this->storage->loadMultiple($this->value)); } diff --git a/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php b/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php index c4f70656c82f..4f7d4cdb310e 100644 --- a/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php +++ b/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php @@ -169,7 +169,7 @@ class HandlerFilterUserNameTest extends ViewTestBase { } // Pass in just valid user IDs in the entity_autocomplete target_id format. - $options['query']['uid'] = array_map(function($account) { + $options['query']['uid'] = array_map(function ($account) { return ['target_id' => $account->id()]; }, $this->accounts); diff --git a/core/modules/views/src/Controller/ViewAjaxController.php b/core/modules/views/src/Controller/ViewAjaxController.php index 2e0ea1841f9a..4aefdabd8e08 100644 --- a/core/modules/views/src/Controller/ViewAjaxController.php +++ b/core/modules/views/src/Controller/ViewAjaxController.php @@ -181,7 +181,7 @@ class ViewAjaxController implements ContainerInjectionInterface { $view->dom_id = $dom_id; $context = new RenderContext(); - $preview = $this->renderer->executeInRenderContext($context, function() use ($view, $display_id, $args) { + $preview = $this->renderer->executeInRenderContext($context, function () use ($view, $display_id, $args) { return $view->preview($display_id, $args); }); if (!$context->isEmpty()) { diff --git a/core/modules/views/src/EntityViewsData.php b/core/modules/views/src/EntityViewsData.php index 248a74c4b17e..70a4574c2741 100644 --- a/core/modules/views/src/EntityViewsData.php +++ b/core/modules/views/src/EntityViewsData.php @@ -307,7 +307,7 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac // Add the entity type key to each table generated. $entity_type_id = $this->entityType->id(); - array_walk($data, function(&$table_data) use ($entity_type_id){ + array_walk($data, function (&$table_data) use ($entity_type_id) { $table_data['table']['entity type'] = $entity_type_id; }); diff --git a/core/modules/views/src/Plugin/views/area/HTTPStatusCode.php b/core/modules/views/src/Plugin/views/area/HTTPStatusCode.php index 6cf6ba224197..5d3f42adf2a4 100644 --- a/core/modules/views/src/Plugin/views/area/HTTPStatusCode.php +++ b/core/modules/views/src/Plugin/views/area/HTTPStatusCode.php @@ -42,7 +42,7 @@ class HTTPStatusCode extends AreaPluginBase { ] + $options; // Add the HTTP status code, so it's easier for people to find it. - array_walk($options, function($title, $code) use(&$options) { + array_walk($options, function ($title, $code) use (&$options) { $options[$code] = $this->t('@code (@title)', ['@code' => $code, '@title' => $title]); }); diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php index ab056f59a719..612b0fc64b6f 100644 --- a/core/modules/views/src/Plugin/views/query/Sql.php +++ b/core/modules/views/src/Plugin/views/query/Sql.php @@ -1469,7 +1469,7 @@ class Sql extends QueryPluginBase { // Setup the result row objects. $view->result = iterator_to_array($result); - array_walk($view->result, function(ResultRow $row, $index) { + array_walk($view->result, function (ResultRow $row, $index) { $row->index = $index; }); diff --git a/core/modules/views/src/Views.php b/core/modules/views/src/Views.php index 014beaefe158..dd241f714b60 100644 --- a/core/modules/views/src/Views.php +++ b/core/modules/views/src/Views.php @@ -512,7 +512,7 @@ class Views { throw new \Exception('Invalid plugin type used. Valid types are "plugin" or "handler".'); } - return array_keys(array_filter(static::$plugins, function($plugin_type) use ($type) { + return array_keys(array_filter(static::$plugins, function ($plugin_type) use ($type) { return $plugin_type == $type; })); } diff --git a/core/modules/views/tests/src/Kernel/ModuleTest.php b/core/modules/views/tests/src/Kernel/ModuleTest.php index 68612b78f40b..9fe9df641647 100644 --- a/core/modules/views/tests/src/Kernel/ModuleTest.php +++ b/core/modules/views/tests/src/Kernel/ModuleTest.php @@ -158,13 +158,13 @@ class ModuleTest extends ViewsKernelTestBase { $this->assertEquals(array_keys($all_views), array_keys(Views::getAllViews()), 'Views::getAllViews works as expected.'); // Test Views::getEnabledViews(). - $expected_enabled = array_filter($all_views, function($view) { + $expected_enabled = array_filter($all_views, function ($view) { return views_view_is_enabled($view); }); $this->assertEquals(array_keys($expected_enabled), array_keys(Views::getEnabledViews()), 'Expected enabled views returned.'); // Test Views::getDisabledViews(). - $expected_disabled = array_filter($all_views, function($view) { + $expected_disabled = array_filter($all_views, function ($view) { return views_view_is_disabled($view); }); $this->assertEquals(array_keys($expected_disabled), array_keys(Views::getDisabledViews()), 'Expected disabled views returned.'); diff --git a/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php b/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php index a2bec23a05cd..ace420484489 100644 --- a/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php +++ b/core/modules/views/tests/src/Kernel/RenderCacheIntegrationTest.php @@ -164,7 +164,7 @@ class RenderCacheIntegrationTest extends ViewsKernelTestBase { $this->pass('Test arguments'); // Custom assert for a single result row. - $single_entity_assertions = function(array $build, EntityInterface $entity) { + $single_entity_assertions = function (array $build, EntityInterface $entity) { $this->setRawContent($build['#markup']); $result = $this->cssSelect('div.views-row'); diff --git a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php index b49d0c32fb7b..73902140520c 100644 --- a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php +++ b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php @@ -432,7 +432,7 @@ class ViewExecutableTest extends ViewsKernelTestBase { $count = 0; foreach ($view->displayHandlers as $id => $display) { - $match = function($value) use ($display) { + $match = function ($value) use ($display) { return strpos($value, $display->display['display_title']) !== FALSE; }; $this->assertTrue(array_filter($validate[$id], $match), format_string('Error message found for @id display', ['@id' => $id])); diff --git a/core/modules/views/tests/src/Kernel/ViewsHooksTest.php b/core/modules/views/tests/src/Kernel/ViewsHooksTest.php index aceda8f6e687..b61a5d9d2a3d 100644 --- a/core/modules/views/tests/src/Kernel/ViewsHooksTest.php +++ b/core/modules/views/tests/src/Kernel/ViewsHooksTest.php @@ -106,7 +106,7 @@ class ViewsHooksTest extends ViewsKernelTestBase { ], '#substitutions' => ['#value' => []], ]; - $element = \Drupal::service('renderer')->executeInRenderContext(new RenderContext(), function() use ($element) { + $element = \Drupal::service('renderer')->executeInRenderContext(new RenderContext(), function () use ($element) { return views_pre_render_views_form_views_form($element); }); $this->setRawContent((string) $element['output']['#markup']); diff --git a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php index 822239f01204..d65acaab2c8c 100644 --- a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php +++ b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php @@ -74,7 +74,7 @@ class ViewAjaxControllerTest extends UnitTestCase { $this->renderer = $this->getMock('\Drupal\Core\Render\RendererInterface'); $this->renderer->expects($this->any()) ->method('render') - ->will($this->returnCallback(function(array &$elements) { + ->will($this->returnCallback(function (array &$elements) { $elements['#attached'] = []; return isset($elements['#markup']) ? $elements['#markup'] : ''; })); diff --git a/core/modules/views/tests/src/Unit/EntityViewsDataTest.php b/core/modules/views/tests/src/Unit/EntityViewsDataTest.php index a9821e010bae..db5ce1887c9d 100644 --- a/core/modules/views/tests/src/Unit/EntityViewsDataTest.php +++ b/core/modules/views/tests/src/Unit/EntityViewsDataTest.php @@ -616,7 +616,7 @@ class EntityViewsDataTest extends UnitTestCase { $table_mapping->expects($this->any()) ->method('getFieldTableName') - ->willReturnCallback(function($field) { + ->willReturnCallback(function ($field) { if ($field == 'uuid') { return 'entity_test_mul'; } @@ -790,7 +790,7 @@ class EntityViewsDataTest extends UnitTestCase { $table_mapping->expects($this->any()) ->method('getFieldTableName') - ->willReturnCallback(function($field) { + ->willReturnCallback(function ($field) { if ($field == 'uuid') { return 'entity_test_mulrev'; } diff --git a/core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php b/core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php index 76f0cd8683d3..927551f7b58f 100644 --- a/core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php +++ b/core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php @@ -101,7 +101,7 @@ class RouteSubscriberTest extends UnitTestCase { // should only call the second display. $display_1->expects($this->once()) ->method('collectRoutes') - ->willReturnCallback(function() use ($collection) { + ->willReturnCallback(function () use ($collection) { $collection->add('views.test_id.page_1', new Route('test_route', ['_controller' => 'Drupal\views\Routing\ViewPageController'])); return ['test_id.page_1' => 'views.test_id.page_1']; }); @@ -111,7 +111,7 @@ class RouteSubscriberTest extends UnitTestCase { $display_2->expects($this->once()) ->method('collectRoutes') - ->willReturnCallback(function() use ($collection) { + ->willReturnCallback(function () use ($collection) { $collection->add('views.test_id.page_2', new Route('test_route', ['_controller' => 'Drupal\views\Routing\ViewPageController'])); return ['test_id.page_2' => 'views.test_id.page_2']; }); diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php index e8ff8d7d9656..a7bcf81de6f2 100644 --- a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php @@ -548,7 +548,7 @@ class FieldPluginBaseTest extends UnitTestCase { '#type' => 'inline_template', '#template' => 'test-path/' . explode('/', $path)[1], '#context' => ['foo' => 123], - '#post_render' => [function() {}], + '#post_render' => [function () {}], ]; $this->renderer->expects($this->once()) @@ -612,7 +612,7 @@ class FieldPluginBaseTest extends UnitTestCase { '#type' => 'inline_template', '#template' => $path, '#context' => ['foo' => $context['context_path']], - '#post_render' => [function() {}], + '#post_render' => [function () {}], ]; $this->renderer->expects($this->once()) @@ -740,7 +740,7 @@ class FieldPluginBaseTest extends UnitTestCase { '#type' => 'inline_template', '#template' => $test_class, '#context' => $tokens, - '#post_render' => [function() {}], + '#post_render' => [function () {}], ]; // We're not testing the token rendering itself, just that the function diff --git a/core/modules/views/tests/src/Unit/ViewExecutableTest.php b/core/modules/views/tests/src/Unit/ViewExecutableTest.php index e0aada0285d8..b6d3c912b01a 100644 --- a/core/modules/views/tests/src/Unit/ViewExecutableTest.php +++ b/core/modules/views/tests/src/Unit/ViewExecutableTest.php @@ -362,7 +362,7 @@ class ViewExecutableTest extends UnitTestCase { foreach (['field', 'filter', 'argument', 'sort'] as $handler_type) { $display->expects($this->atLeastOnce()) ->method('setOption') - ->with($this->callback(function($argument) { + ->with($this->callback(function ($argument) { return $argument; }), [ 'test_field' => [ @@ -405,7 +405,7 @@ class ViewExecutableTest extends UnitTestCase { foreach (['field', 'filter', 'argument', 'sort'] as $handler_type) { $display->expects($this->atLeastOnce()) ->method('setOption') - ->with($this->callback(function($argument) { + ->with($this->callback(function ($argument) { return $argument; }), [ 'test_field' => [ diff --git a/core/modules/views/tests/src/Unit/ViewsDataHelperTest.php b/core/modules/views/tests/src/Unit/ViewsDataHelperTest.php index 2289f236e6ce..b08938c234e0 100644 --- a/core/modules/views/tests/src/Unit/ViewsDataHelperTest.php +++ b/core/modules/views/tests/src/Unit/ViewsDataHelperTest.php @@ -97,7 +97,7 @@ class ViewsDataHelperTest extends UnitTestCase { foreach ($handler_types as $handler_type) { $fields = $data_helper->fetchFields('views_test_data', $handler_type); $expected_keys = $expected[$handler_type]; - array_walk($expected_keys, function(&$item) { + array_walk($expected_keys, function (&$item) { $item = "views_test_data.$item"; }); $this->assertEquals($expected_keys, array_keys($fields), "Handlers of type $handler_type are not listed as expected"); @@ -108,7 +108,7 @@ class ViewsDataHelperTest extends UnitTestCase { $fields = $data_helper->fetchFields('views_test_data', 'area', FALSE, $sub_type); $expected_keys = $expected[$sub_type]; - array_walk($expected_keys, function(&$item) { + array_walk($expected_keys, function (&$item) { $item = "views_test_data.$item"; }); $this->assertEquals($expected_keys, array_keys($fields), "Sub_type $sub_type is not filtered as expected."); diff --git a/core/modules/views/views.post_update.php b/core/modules/views/views.post_update.php index 0f84d7b55a7c..28c0f5c7ad9b 100644 --- a/core/modules/views/views.post_update.php +++ b/core/modules/views/views.post_update.php @@ -128,7 +128,7 @@ function views_post_update_cleanup_duplicate_views_data() { */ function views_post_update_field_formatter_dependencies() { $views = View::loadMultiple(); - array_walk($views, function(View $view) { + array_walk($views, function (View $view) { $view->save(); }); } @@ -138,7 +138,7 @@ function views_post_update_field_formatter_dependencies() { */ function views_post_update_taxonomy_index_tid() { $views = View::loadMultiple(); - array_walk($views, function(View $view) { + array_walk($views, function (View $view) { $old_dependencies = $view->getDependencies(); $new_dependencies = $view->calculateDependencies()->getDependencies(); if ($old_dependencies !== $new_dependencies) { @@ -152,7 +152,7 @@ function views_post_update_taxonomy_index_tid() { */ function views_post_update_serializer_dependencies() { $views = View::loadMultiple(); - array_walk($views, function(View $view) { + array_walk($views, function (View $view) { $old_dependencies = $view->getDependencies(); $new_dependencies = $view->calculateDependencies()->getDependencies(); if ($old_dependencies !== $new_dependencies) { @@ -209,7 +209,7 @@ function views_post_update_revision_metadata_fields() { // The table names are fixed automatically in // \Drupal\views\Entity\View::preSave(), so we just need to re-save all views. $views = View::loadMultiple(); - array_walk($views, function(View $view) { + array_walk($views, function (View $view) { $view->save(); }); } diff --git a/core/modules/views/views.views.inc b/core/modules/views/views.views.inc index ed6fa07dba35..526f350f7fbe 100644 --- a/core/modules/views/views.views.inc +++ b/core/modules/views/views.views.inc @@ -266,7 +266,7 @@ function views_entity_field_label($entity_type, $field_name) { // Sort the field labels by it most used label and return the most used one. // If the counts are equal, sort by the label to ensure the result is // deterministic. - uksort($label_counter, function($a, $b) use ($label_counter) { + uksort($label_counter, function ($a, $b) use ($label_counter) { if ($label_counter[$a] === $label_counter[$b]) { return strcmp($a, $b); } diff --git a/core/modules/views_ui/src/Form/Ajax/AddHandler.php b/core/modules/views_ui/src/Form/Ajax/AddHandler.php index 0a04000a6a16..ec0c6554bd80 100644 --- a/core/modules/views_ui/src/Form/Ajax/AddHandler.php +++ b/core/modules/views_ui/src/Form/Ajax/AddHandler.php @@ -176,7 +176,7 @@ class AddHandler extends ViewsFormBase { $view->getStandardButtons($form, $form_state, 'views_ui_add_handler_form', $this->t('Add and configure @types', ['@types' => $ltitle])); // Remove the default submit function. - $form['actions']['submit']['#submit'] = array_filter($form['actions']['submit']['#submit'], function($var) { + $form['actions']['submit']['#submit'] = array_filter($form['actions']['submit']['#submit'], function ($var) { return !(is_array($var) && isset($var[1]) && $var[1] == 'standardSubmit'); }); $form['actions']['submit']['#submit'][] = [$view, 'submitItemAdd']; diff --git a/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php b/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php index af2c4e2a6f0e..7291dc2e8de8 100644 --- a/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php +++ b/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php @@ -166,7 +166,7 @@ class DisplayPathTest extends UITestBase { unset($menu_options['@attributes']); // Convert array to make the next assertion possible. - $menu_options = array_map(function($element) { + $menu_options = array_map(function ($element) { return $element->getText(); }, $menu_options); diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php index 03325ce05c0b..cab99bd7bc99 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php @@ -118,7 +118,7 @@ class ViewsListingTest extends JavascriptTestBase { * @return array */ protected function filterVisibleElements($elements) { - $elements = array_filter($elements, function($element) { + $elements = array_filter($elements, function ($element) { return $element->isVisible(); }); return $elements; diff --git a/core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/PredefinedStatesWorkflowTestType.php b/core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/PredefinedStatesWorkflowTestType.php index 006258061edc..aab488aae000 100644 --- a/core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/PredefinedStatesWorkflowTestType.php +++ b/core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/PredefinedStatesWorkflowTestType.php @@ -30,7 +30,7 @@ class PredefinedStatesWorkflowTestType extends WorkflowTypeBase { 'bet' => new State($this, 'bet', 'Bet'), 'raise' => new State($this, 'raise', 'Raise'), 'fold' => new State($this, 'fold', 'Fold'), - ], function($state) use ($state_ids) { + ], function ($state) use ($state_ids) { return is_array($state_ids) ? in_array($state->id(), $state_ids) : TRUE; }); } diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 5b07e1e868c1..49d458359703 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -218,6 +218,23 @@ 0 + + + 0 + + + 0 + + + + 0 + + + 0 + + + 0 + diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php index 81d379f915bf..10ae70153376 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php @@ -64,7 +64,7 @@ JS; public function waitForElement($selector, $locator, $timeout = 10000) { $page = $this->session->getPage(); - $result = $page->waitFor($timeout / 1000, function() use ($page, $selector, $locator) { + $result = $page->waitFor($timeout / 1000, function () use ($page, $selector, $locator) { return $page->find($selector, $locator); }); @@ -90,7 +90,7 @@ JS; public function waitForElementVisible($selector, $locator, $timeout = 10000) { $page = $this->session->getPage(); - $result = $page->waitFor($timeout / 1000, function() use ($page, $selector, $locator) { + $result = $page->waitFor($timeout / 1000, function () use ($page, $selector, $locator) { $element = $page->find($selector, $locator); if (!empty($element) && $element->isVisible()) { return $element; diff --git a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php index 911d523a0eeb..a375db7e8c87 100644 --- a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php +++ b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php @@ -83,7 +83,7 @@ class UpdatePathTestBaseTest extends UpdatePathTestBase { $select->range(0, 5); $select->fields('watchdog', ['message']); - $container_cannot_be_saved_messages = array_filter(iterator_to_array($select->execute()), function($row) { + $container_cannot_be_saved_messages = array_filter(iterator_to_array($select->execute()), function ($row) { return strpos($row->message, 'Container cannot be saved to cache.') !== FALSE; }); $this->assertEqual([], $container_cannot_be_saved_messages); diff --git a/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php b/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php index 4c5448718ed2..66005de42883 100644 --- a/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php +++ b/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php @@ -54,7 +54,7 @@ class GetFilenameTest extends KernelTestBase { $non_existing_module = uniqid("", TRUE); // Set a custom error handler so we can ignore the file not found error. - set_error_handler(function($severity, $message, $file, $line) { + set_error_handler(function ($severity, $message, $file, $line) { // Skip error handling if this is a "file not found" error. if (strstr($message, 'is missing from the file system:')) { \Drupal::state()->set('get_filename_test_triggered_error', TRUE); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php index b4308726096c..cedf6851a8b5 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php @@ -247,24 +247,24 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { ->create(['name' => $this->randomString()]); // Test content entity autocreation. - $this->assertUserAutocreate($entity, function(EntityInterface $entity, UserInterface $user) { + $this->assertUserAutocreate($entity, function (EntityInterface $entity, UserInterface $user) { $entity->set('user_id', $user); }); - $this->assertUserAutocreate($entity, function(EntityInterface $entity, UserInterface $user) { + $this->assertUserAutocreate($entity, function (EntityInterface $entity, UserInterface $user) { $entity->set('user_id', $user, FALSE); }); - $this->assertUserAutocreate($entity, function(EntityInterface $entity, UserInterface $user) { + $this->assertUserAutocreate($entity, function (EntityInterface $entity, UserInterface $user) { $entity->user_id->setValue($user); }); - $this->assertUserAutocreate($entity, function(EntityInterface $entity, UserInterface $user) { + $this->assertUserAutocreate($entity, function (EntityInterface $entity, UserInterface $user) { $entity->user_id[0]->get('entity')->setValue($user); }); - $this->assertUserAutocreate($entity, function(EntityInterface $entity, UserInterface $user) { + $this->assertUserAutocreate($entity, function (EntityInterface $entity, UserInterface $user) { $entity->user_id->setValue(['entity' => $user, 'target_id' => NULL]); }); try { $message = 'Setting both the entity and an invalid target_id property fails.'; - $this->assertUserAutocreate($entity, function(EntityInterface $entity, UserInterface $user) { + $this->assertUserAutocreate($entity, function (EntityInterface $entity, UserInterface $user) { $user->save(); $entity->user_id->setValue(['entity' => $user, 'target_id' => $this->generateRandomEntityId()]); }); @@ -273,32 +273,32 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { catch (\InvalidArgumentException $e) { $this->pass($message); } - $this->assertUserAutocreate($entity, function(EntityInterface $entity, UserInterface $user) { + $this->assertUserAutocreate($entity, function (EntityInterface $entity, UserInterface $user) { $entity->user_id = $user; }); - $this->assertUserAutocreate($entity, function(EntityInterface $entity, UserInterface $user) { + $this->assertUserAutocreate($entity, function (EntityInterface $entity, UserInterface $user) { $entity->user_id->entity = $user; }); // Test config entity autocreation. - $this->assertUserRoleAutocreate($entity, function(EntityInterface $entity, RoleInterface $role) { + $this->assertUserRoleAutocreate($entity, function (EntityInterface $entity, RoleInterface $role) { $entity->set('user_role', $role); }); - $this->assertUserRoleAutocreate($entity, function(EntityInterface $entity, RoleInterface $role) { + $this->assertUserRoleAutocreate($entity, function (EntityInterface $entity, RoleInterface $role) { $entity->set('user_role', $role, FALSE); }); - $this->assertUserRoleAutocreate($entity, function(EntityInterface $entity, RoleInterface $role) { + $this->assertUserRoleAutocreate($entity, function (EntityInterface $entity, RoleInterface $role) { $entity->user_role->setValue($role); }); - $this->assertUserRoleAutocreate($entity, function(EntityInterface $entity, RoleInterface $role) { + $this->assertUserRoleAutocreate($entity, function (EntityInterface $entity, RoleInterface $role) { $entity->user_role[0]->get('entity')->setValue($role); }); - $this->assertUserRoleAutocreate($entity, function(EntityInterface $entity, RoleInterface $role) { + $this->assertUserRoleAutocreate($entity, function (EntityInterface $entity, RoleInterface $role) { $entity->user_role->setValue(['entity' => $role, 'target_id' => NULL]); }); try { $message = 'Setting both the entity and an invalid target_id property fails.'; - $this->assertUserRoleAutocreate($entity, function(EntityInterface $entity, RoleInterface $role) { + $this->assertUserRoleAutocreate($entity, function (EntityInterface $entity, RoleInterface $role) { $role->save(); $entity->user_role->setValue(['entity' => $role, 'target_id' => $this->generateRandomEntityId(TRUE)]); }); @@ -307,10 +307,10 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { catch (\InvalidArgumentException $e) { $this->pass($message); } - $this->assertUserRoleAutocreate($entity, function(EntityInterface $entity, RoleInterface $role) { + $this->assertUserRoleAutocreate($entity, function (EntityInterface $entity, RoleInterface $role) { $entity->user_role = $role; }); - $this->assertUserRoleAutocreate($entity, function(EntityInterface $entity, RoleInterface $role) { + $this->assertUserRoleAutocreate($entity, function (EntityInterface $entity, RoleInterface $role) { $entity->user_role->entity = $role; }); diff --git a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php index 033451ac000a..cd0afa2d039d 100644 --- a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php @@ -111,7 +111,7 @@ class MenuLinkTreeTest extends KernelTestBase { $parameters = new MenuTreeParameters(); $tree = $this->linkTree->load('mock', $parameters); - $count = function(array $tree) { + $count = function (array $tree) { $sum = function ($carry, MenuLinkTreeElement $item) { return $carry + $item->count(); }; diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php index a3492ed223fa..4c6e22a8ea4b 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php @@ -71,7 +71,7 @@ abstract class DiscoveryTestBase extends KernelTestBase { * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertDefinitionIdentical(array $definition, array $expected_definition) { - $func = function (&$item){ + $func = function (&$item) { if ($item instanceof TranslatableMarkup) { $item = (string) $item; } diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php index c79f2cfc9f4d..e3e3fae2fe8c 100644 --- a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php +++ b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php @@ -399,7 +399,7 @@ class TypedDataTest extends KernelTestBase { // Check that an all-pass filter leaves the list untouched. $value = ['zero', 'one']; $typed_data = $this->createTypedData(ListDataDefinition::create('string'), $value); - $typed_data->filter(function(TypedDataInterface $item) { + $typed_data->filter(function (TypedDataInterface $item) { return TRUE; }); $this->assertEqual($typed_data->count(), 2); @@ -411,7 +411,7 @@ class TypedDataTest extends KernelTestBase { // Check that a none-pass filter empties the list. $value = ['zero', 'one']; $typed_data = $this->createTypedData(ListDataDefinition::create('string'), $value); - $typed_data->filter(function(TypedDataInterface $item) { + $typed_data->filter(function (TypedDataInterface $item) { return FALSE; }); $this->assertEqual($typed_data->count(), 0); @@ -419,7 +419,7 @@ class TypedDataTest extends KernelTestBase { // Check that filtering correctly renumbers elements. $value = ['zero', 'one', 'two']; $typed_data = $this->createTypedData(ListDataDefinition::create('string'), $value); - $typed_data->filter(function(TypedDataInterface $item) { + $typed_data->filter(function (TypedDataInterface $item) { return $item->getValue() !== 'one'; }); $this->assertEqual($typed_data->count(), 2); diff --git a/core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php b/core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php index 0b627c57a093..02d63841e22a 100644 --- a/core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php +++ b/core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php @@ -15,7 +15,7 @@ trait FileSystemModuleDiscoveryDataProviderTrait { */ public function coreModuleListDataProvider() { $module_dirs = array_keys(iterator_to_array(new \FilesystemIterator(__DIR__ . '/../../../modules/'))); - $module_names = array_map(function($path) { + $module_names = array_map(function ($path) { return str_replace(__DIR__ . '/../../../modules/', '', $path); }, $module_dirs); $modules_keyed = array_combine($module_names, $module_names); diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index abdedd9c037d..e7c79f380a33 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -1070,7 +1070,7 @@ abstract class BrowserTestBase extends TestCase { * The formatted HTML string. */ protected function formatHtmlOutputHeaders(array $headers) { - $flattened_headers = array_map(function($header) { + $flattened_headers = array_map(function ($header) { if (is_array($header)) { return implode(';', array_map('trim', $header)); } diff --git a/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php b/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php index 208440be7496..f41824416c4f 100644 --- a/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php +++ b/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php @@ -157,7 +157,7 @@ class InspectorTest extends TestCase { 'strchr', [$this, 'callMe'], [__CLASS__, 'callMeStatic'], - function() { + function () { return TRUE; } ])); @@ -166,7 +166,7 @@ class InspectorTest extends TestCase { 'strchr', [$this, 'callMe'], [__CLASS__, 'callMeStatic'], - function() { + function () { return TRUE; }, "I'm not callable" diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php index 7b8fc87d7849..14a34c05a7d2 100644 --- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php @@ -517,7 +517,7 @@ class ContainerTest extends TestCase { $configurator = $this->prophesize('\Drupal\Tests\Component\DependencyInjection\MockConfiguratorInterface'); $configurator->configureService(Argument::type('object')) ->shouldBeCalled(1) - ->will(function($args) use ($container) { + ->will(function ($args) use ($container) { $args[0]->setContainer($container); }); $container->set('configurator', $configurator->reveal()); diff --git a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php index fffd26eef072..03d39d3f1540 100644 --- a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php +++ b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php @@ -64,7 +64,7 @@ class DrupalComponentTest extends TestCase { protected function assertNoCoreUsage($class_path) { $contents = file_get_contents($class_path); preg_match_all('/^.*Drupal\\\Core.*$/m', $contents, $matches); - $matches = array_filter($matches[0], function($line) { + $matches = array_filter($matches[0], function ($line) { // Filter references to @see as they don't really matter. return strpos($line, '@see') === FALSE; }); diff --git a/core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php b/core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php index e8d52bb5b594..4760c1955b29 100644 --- a/core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php +++ b/core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php @@ -21,7 +21,7 @@ class RegexDirectoryIteratorTest extends TestCase { $iterator = new RegexDirectoryIterator(vfsStream::url('root'), $regex); // Create an array of filenames to assert against. - $file_list = array_map(function(\SplFileInfo $file) { + $file_list = array_map(function (\SplFileInfo $file) { return $file->getFilename(); }, array_values(iterator_to_array($iterator))); diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php index 1aa2a365701e..2ed15bbfe29b 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php @@ -46,7 +46,7 @@ class DiscoveryCachedTraitTest extends TestCase { $trait->expects($this->once()) ->method('getDefinitions') // Use a callback method, so we can perform the side-effects. - ->willReturnCallback(function() use ($reflection_definitions, $trait, $get_definitions) { + ->willReturnCallback(function () use ($reflection_definitions, $trait, $get_definitions) { $reflection_definitions->setValue($trait, $get_definitions); return $get_definitions; }); diff --git a/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php b/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php index 3d1a41d11257..7e8fbefd1d1c 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php @@ -172,9 +172,7 @@ class ArgumentsPluginId { */ class ArgumentsMany { - public function __construct( - $configuration, $plugin_definition, $plugin_id, $foo = 'default_value', $what_am_i_doing_here = 'what_default' - ) { + public function __construct($configuration, $plugin_definition, $plugin_id, $foo = 'default_value', $what_am_i_doing_here = 'what_default') { // No-op. } diff --git a/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php b/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php index 0c92331197a0..f15f14b85a4c 100644 --- a/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php @@ -41,22 +41,22 @@ class ArgumentsResolverTest extends TestCase { // Test an optional parameter with no provided value. $data[] = [ - function($foo = 'foo') {}, [], [], [] , ['foo'], + function ($foo = 'foo') {}, [], [], [] , ['foo'], ]; // Test an optional parameter with a provided value. $data[] = [ - function($foo = 'foo') {}, ['foo' => 'bar'], [], [], ['bar'], + function ($foo = 'foo') {}, ['foo' => 'bar'], [], [], ['bar'], ]; // Test with a provided value. $data[] = [ - function($foo) {}, ['foo' => 'bar'], [], [], ['bar'], + function ($foo) {}, ['foo' => 'bar'], [], [], ['bar'], ]; // Test with an explicitly NULL value. $data[] = [ - function($foo) {}, [], ['foo' => NULL], [], [NULL], + function ($foo) {}, [], ['foo' => NULL], [], [NULL], ]; // Test with a raw value that overrides the provided upcast value, since @@ -64,7 +64,7 @@ class ArgumentsResolverTest extends TestCase { $scalars = ['foo' => 'baz']; $objects = ['foo' => new \stdClass()]; $data[] = [ - function($foo) {}, $scalars, $objects, [], ['baz'], + function ($foo) {}, $scalars, $objects, [], ['baz'], ]; return $data; @@ -74,7 +74,7 @@ class ArgumentsResolverTest extends TestCase { * Tests getArgument() with an object. */ public function testGetArgumentObject() { - $callable = function(\stdClass $object) {}; + $callable = function (\stdClass $object) {}; $object = new \stdClass(); $arguments = (new ArgumentsResolver([], ['object' => $object], []))->getArguments($callable); @@ -85,7 +85,7 @@ class ArgumentsResolverTest extends TestCase { * Tests getArgument() with a wildcard object for a parameter with a custom name. */ public function testGetWildcardArgument() { - $callable = function(\stdClass $custom_name) {}; + $callable = function (\stdClass $custom_name) {}; $object = new \stdClass(); $arguments = (new ArgumentsResolver([], [], [$object]))->getArguments($callable); @@ -107,12 +107,12 @@ class ArgumentsResolverTest extends TestCase { $wildcards = [$a3]; $resolver = new ArgumentsResolver([], $objects, $wildcards); - $callable = function(Test1Interface $t1, TestClass $tc, Test2Interface $t2) {}; + $callable = function (Test1Interface $t1, TestClass $tc, Test2Interface $t2) {}; $arguments = $resolver->getArguments($callable); $this->assertSame([$a1, $a2, $a3], $arguments); // Test again, but with the arguments in a different order. - $callable = function(Test2Interface $t2, TestClass $tc, Test1Interface $t1) {}; + $callable = function (Test2Interface $t2, TestClass $tc, Test1Interface $t1) {}; $arguments = $resolver->getArguments($callable); $this->assertSame([$a3, $a2, $a1], $arguments); } @@ -127,7 +127,7 @@ class ArgumentsResolverTest extends TestCase { $wildcards = [$a]; $resolver = new ArgumentsResolver([], [], $wildcards); - $callable = function($route) {}; + $callable = function ($route) {}; $this->setExpectedException(\RuntimeException::class, 'requires a value for the "$route" argument.'); $resolver->getArguments($callable); } @@ -142,7 +142,7 @@ class ArgumentsResolverTest extends TestCase { $scalars = ['route' => 'foo']; $resolver = new ArgumentsResolver($scalars, [], []); - $callable = function($route) {}; + $callable = function ($route) {}; $arguments = $resolver->getArguments($callable); $this->assertSame(['foo'], $arguments); } @@ -155,7 +155,7 @@ class ArgumentsResolverTest extends TestCase { $scalars = ['foo' => 'baz']; $resolver = new ArgumentsResolver($scalars, $objects, []); - $callable = function(\stdClass $foo) {}; + $callable = function (\stdClass $foo) {}; $this->setExpectedException(\RuntimeException::class, 'requires a value for the "$foo" argument.'); $resolver->getArguments($callable); } @@ -176,7 +176,7 @@ class ArgumentsResolverTest extends TestCase { */ public function providerTestHandleUnresolvedArgument() { $data = []; - $data[] = [function($foo) {}]; + $data[] = [function ($foo) {}]; $data[] = [[new TestClass(), 'access']]; $data[] = ['Drupal\Tests\Component\Utility\test_access_arguments_resolver_access']; return $data; diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php index 5bd622061d10..0b694c65006b 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php @@ -860,7 +860,7 @@ class AccessResultTest extends UnitTestCase { * tested in ::testOrIf(). */ public function testOrIfCacheabilityMerging() { - $merge_both_directions = function(AccessResult $a, AccessResult $b) { + $merge_both_directions = function (AccessResult $a, AccessResult $b) { // A globally cacheable access result. $a->setCacheMaxAge(3600); // Another access result that is cacheable per permissions. diff --git a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php index c7f1f3d562c9..4ff4b8312884 100644 --- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php @@ -76,7 +76,7 @@ class CssCollectionRendererUnitTest extends UnitTestCase { * @see testRender */ public function providerTestRender() { - $create_link_element = function($href, $media = 'all', $browsers = []) { + $create_link_element = function ($href, $media = 'all', $browsers = []) { return [ '#type' => 'html_tag', '#tag' => 'link', @@ -88,7 +88,7 @@ class CssCollectionRendererUnitTest extends UnitTestCase { '#browsers' => $browsers, ]; }; - $create_style_element = function($value, $media, $browsers = []) { + $create_style_element = function ($value, $media, $browsers = []) { $style_element = [ '#type' => 'html_tag', '#tag' => 'style', @@ -101,7 +101,7 @@ class CssCollectionRendererUnitTest extends UnitTestCase { return $style_element; }; - $create_file_css_asset = function($data, $media = 'all', $preprocess = TRUE) { + $create_file_css_asset = function ($data, $media = 'all', $preprocess = TRUE) { return ['group' => 0, 'type' => 'file', 'media' => $media, 'preprocess' => $preprocess, 'data' => $data, 'browsers' => []]; }; diff --git a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php index 0b7aa25146a3..5c4166834e31 100644 --- a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php +++ b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php @@ -74,7 +74,7 @@ class ControllerResolverTest extends UnitTestCase { * @group legacy */ public function testGetArguments() { - $controller = function(EntityInterface $entity, $user, RouteMatchInterface $route_match, ServerRequestInterface $psr_7) { + $controller = function (EntityInterface $entity, $user, RouteMatchInterface $route_match, ServerRequestInterface $psr_7) { }; $mock_entity = $this->getMockBuilder('Drupal\Core\Entity\Entity') ->disableOriginalConstructor() diff --git a/core/tests/Drupal/Tests/Core/Database/ConditionTest.php b/core/tests/Drupal/Tests/Core/Database/ConditionTest.php index 13b629342402..db2c89d1e770 100644 --- a/core/tests/Drupal/Tests/Core/Database/ConditionTest.php +++ b/core/tests/Drupal/Tests/Core/Database/ConditionTest.php @@ -44,7 +44,7 @@ class ConditionTest extends UnitTestCase { $query_placeholder = $this->prophesize(PlaceholderInterface::class); $counter = 0; - $query_placeholder->nextPlaceholder()->will(function() use (&$counter) { + $query_placeholder->nextPlaceholder()->will(function () use (&$counter) { return $counter++; }); $query_placeholder->uniqueIdentifier()->willReturn(4); @@ -85,7 +85,7 @@ class ConditionTest extends UnitTestCase { $query_placeholder = $this->prophesize(PlaceholderInterface::class); $counter = 0; - $query_placeholder->nextPlaceholder()->will(function() use (&$counter) { + $query_placeholder->nextPlaceholder()->will(function () use (&$counter) { return $counter++; }); $query_placeholder->uniqueIdentifier()->willReturn(4); @@ -153,7 +153,7 @@ class ConditionTest extends UnitTestCase { $query_placeholder = $this->prophesize(PlaceholderInterface::class); $counter = 0; - $query_placeholder->nextPlaceholder()->will(function() use (&$counter) { + $query_placeholder->nextPlaceholder()->will(function () use (&$counter) { return $counter++; }); $query_placeholder->uniqueIdentifier()->willReturn(4); diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php index db92ca9d0a1d..d16ece2097dd 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php @@ -1344,14 +1344,14 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { $this->dbSchemaHandler->expects($this->any()) ->method('createTable') ->with( - $this->callback(function($table_name) use (&$invocation_count, $expected_table_names) { + $this->callback(function ($table_name) use (&$invocation_count, $expected_table_names) { return $expected_table_names[$invocation_count] == $table_name; }), - $this->callback(function($table_schema) use (&$invocation_count, $expected_table_schemas) { + $this->callback(function ($table_schema) use (&$invocation_count, $expected_table_schemas) { return $expected_table_schemas[$invocation_count] == $table_schema; }) ) - ->will($this->returnCallback(function() use (&$invocation_count) { + ->will($this->returnCallback(function () use (&$invocation_count) { $invocation_count++; })); } @@ -1496,7 +1496,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { ->willReturn(TRUE); $this->dbSchemaHandler->expects($this->atLeastOnce()) ->method('addIndex') - ->with('entity_test', 'entity_test__b588603cb9', [['long_index_name', 10]], $this->callback(function($actual_value) use ($expected) { + ->with('entity_test', 'entity_test__b588603cb9', [['long_index_name', 10]], $this->callback(function ($actual_value) use ($expected) { $this->assertEquals($expected['entity_test']['indexes'], $actual_value['indexes']); $this->assertEquals($expected['entity_test']['fields'], $actual_value['fields']); // If the parameters don't match, the assertions above will throw an diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php index 351788c6e7a2..de7baa996d7a 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php @@ -1452,7 +1452,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase { public function providerPrepareCallback() { $function = 'sleep'; $shorthand_form_method = '::submit()'; - $closure = function() {}; + $closure = function () {}; $static_method_string = __METHOD__; $static_method_array = [__CLASS__, __FUNCTION__]; $object_method_array = [$this, __FUNCTION__]; diff --git a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php index 67decbed0ecd..54fcfbd73d9a 100644 --- a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php +++ b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php @@ -50,7 +50,7 @@ class EntityConverterTest extends UnitTestCase { public function testApplies(array $definition, $name, Route $route, $applies) { $this->entityManager->expects($this->any()) ->method('hasDefinition') - ->willReturnCallback(function($entity_type) { + ->willReturnCallback(function ($entity_type) { return 'entity_test' == $entity_type; }); $this->assertEquals($applies, $this->entityConverter->applies($definition, $name, $route)); diff --git a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php index b9f8b07fe8dc..573febcc2a4d 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php @@ -86,7 +86,7 @@ class RendererBubblingTest extends RendererTestBase { $this->cacheFactory->expects($this->atLeastOnce()) ->method('get') ->with($bin) - ->willReturnCallback(function($requested_bin) use ($bin, $custom_cache) { + ->willReturnCallback(function ($requested_bin) use ($bin, $custom_cache) { if ($requested_bin === $bin) { return $custom_cache; } @@ -315,7 +315,7 @@ class RendererBubblingTest extends RendererTestBase { 'tags' => ['b'], ], 'grandchild' => [ - '#access_callback' => function() use (&$current_user_role) { + '#access_callback' => function () use (&$current_user_role) { // Only role A cannot access this subtree. return $current_user_role !== 'A'; }, diff --git a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php index fb0c0c52278c..253a3580dc35 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php @@ -65,7 +65,7 @@ class RendererPlaceholdersTest extends RendererTestBase { public function providerPlaceholders() { $args = [$this->randomContextValue()]; - $generate_placeholder_markup = function($cache_keys = NULL) use ($args) { + $generate_placeholder_markup = function ($cache_keys = NULL) use ($args) { $token_render_array = [ '#lazy_builder' => ['Drupal\Tests\Core\Render\PlaceholdersTest::callback', $args], ]; diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTest.php b/core/tests/Drupal/Tests/Core/Render/RendererTest.php index f3ea379b6348..010ffc2add87 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererTest.php @@ -179,7 +179,7 @@ class RendererTest extends RendererTestBase { $data[] = [ [ '#markup' => 'foo', - '#pre_render' => [function($elements) { + '#pre_render' => [function ($elements) { $elements['#markup'] .= ''; return $elements; } @@ -192,7 +192,7 @@ class RendererTest extends RendererTestBase { [ '#markup' => 'foo', '#allowed_tags' => ['script'], - '#pre_render' => [function($elements) { + '#pre_render' => [function ($elements) { $elements['#markup'] .= ''; return $elements; } @@ -205,7 +205,7 @@ class RendererTest extends RendererTestBase { $data[] = [ [ '#plain_text' => 'foo', - '#pre_render' => [function($elements) { + '#pre_render' => [function ($elements) { $elements['#plain_text'] .= ''; return $elements; } @@ -225,12 +225,12 @@ class RendererTest extends RendererTestBase { '#theme_wrappers' => ['container'], '#attributes' => ['class' => ['baz']], ]; - $setup_code_type_link = function() { + $setup_code_type_link = function () { $this->setupThemeContainer(); $this->themeManager->expects($this->at(0)) ->method('render') ->with('common_test_foo', $this->anything()) - ->willReturnCallback(function($theme, $vars) { + ->willReturnCallback(function ($theme, $vars) { return $vars['#foo'] . $vars['#bar']; }); }; @@ -250,12 +250,12 @@ class RendererTest extends RendererTestBase { '#url' => 'https://www.drupal.org', '#title' => 'bar', ]; - $setup_code_type_link = function() { + $setup_code_type_link = function () { $this->setupThemeContainer(); $this->themeManager->expects($this->at(0)) ->method('render') ->with('link', $this->anything()) - ->willReturnCallback(function($theme, $vars) { + ->willReturnCallback(function ($theme, $vars) { $attributes = new Attribute(['href' => $vars['#url']] + (isset($vars['#attributes']) ? $vars['#attributes'] : [])); return '' . $vars['#title'] . ''; }); @@ -287,7 +287,7 @@ class RendererTest extends RendererTestBase { 'container', ], ]; - $setup_code = function() { + $setup_code = function () { $this->setupThemeContainer($this->any()); }; $data[] = [$build, '
' . "\n" . '
' . "\n", $setup_code]; @@ -297,7 +297,7 @@ class RendererTest extends RendererTestBase { '#theme_wrappers' => [['container']], '#attributes' => ['class' => ['foo']], ]; - $setup_code = function() { + $setup_code = function () { $this->setupThemeContainerMultiSuggestion($this->any()); }; $data[] = [$build, '
' . "\n", $setup_code]; @@ -311,7 +311,7 @@ class RendererTest extends RendererTestBase { '#theme' => ['suggestionnotimplemented'], '#markup' => 'foo', ]; - $setup_code = function() { + $setup_code = function () { $this->themeManager->expects($this->once()) ->method('render') ->with(['suggestionnotimplemented'], $this->anything()) @@ -326,7 +326,7 @@ class RendererTest extends RendererTestBase { '#markup' => 'foo', ], ]; - $setup_code = function() { + $setup_code = function () { $this->themeManager->expects($this->once()) ->method('render') ->with(['suggestionnotimplemented'], $this->anything()) @@ -340,7 +340,7 @@ class RendererTest extends RendererTestBase { '#markup' => 'foo', ]; $theme_function_output = $this->randomContextValue(); - $setup_code = function() use ($theme_function_output) { + $setup_code = function () use ($theme_function_output) { $this->themeManager->expects($this->once()) ->method('render') ->with(['common_test_empty'], $this->anything()) @@ -369,7 +369,7 @@ class RendererTest extends RendererTestBase { '#children' => 'baz', 'child' => ['#markup' => 'boo'], ]; - $setup_code = function() { + $setup_code = function () { $this->themeManager->expects($this->once()) ->method('render') ->with('common_test_foo', $this->anything()) @@ -388,7 +388,7 @@ class RendererTest extends RendererTestBase { '#markup' => 'boo', ], ]; - $setup_code = function() { + $setup_code = function () { $this->themeManager->expects($this->never()) ->method('render'); }; @@ -404,7 +404,7 @@ class RendererTest extends RendererTestBase { '#markup' => 'boo', ], ]; - $setup_code = function() { + $setup_code = function () { $this->themeManager->expects($this->never()) ->method('render'); }; @@ -494,7 +494,7 @@ class RendererTest extends RendererTestBase { */ public function testRenderWithAccessCallbackCallable($access) { $build = [ - '#access_callback' => function() use ($access) { + '#access_callback' => function () use ($access) { return $access; } ]; @@ -513,7 +513,7 @@ class RendererTest extends RendererTestBase { public function testRenderWithAccessPropertyAndCallback($access) { $build = [ '#access' => $access, - '#access_callback' => function() { + '#access_callback' => function () { return TRUE; } ]; @@ -625,7 +625,7 @@ class RendererTest extends RendererTestBase { $this->themeManager->expects($matcher ?: $this->at(1)) ->method('render') ->with('container', $this->anything()) - ->willReturnCallback(function($theme, $vars) { + ->willReturnCallback(function ($theme, $vars) { return '' . $vars['#children'] . "\n"; }); } @@ -634,7 +634,7 @@ class RendererTest extends RendererTestBase { $this->themeManager->expects($matcher ?: $this->at(1)) ->method('render') ->with(['container'], $this->anything()) - ->willReturnCallback(function($theme, $vars) { + ->willReturnCallback(function ($theme, $vars) { return '' . $vars['#children'] . "\n"; }); } diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php index 964898cb30c0..258fa22fad23 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php @@ -147,7 +147,7 @@ abstract class RendererTestBase extends UnitTestCase { $current_user_role = &$this->currentUserRole; $this->cacheContextsManager->expects($this->any()) ->method('convertTokensToKeys') - ->willReturnCallback(function($context_tokens) use (&$current_user_role) { + ->willReturnCallback(function ($context_tokens) use (&$current_user_role) { $keys = []; foreach ($context_tokens as $context_id) { switch ($context_id) { diff --git a/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php b/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php index 2d733c3da28e..afe7f4d5f156 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php @@ -49,7 +49,7 @@ class RedirectDestinationTest extends UnitTestCase { protected function setupUrlGenerator() { $this->urlGenerator->expects($this->any()) ->method('generateFromRoute') - ->willReturnCallback(function($route, $parameters, $options) { + ->willReturnCallback(function ($route, $parameters, $options) { $query_string = ''; if (!empty($options['query'])) { $query_string = '?' . UrlHelper::buildQuery($options['query']); diff --git a/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php b/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php index ac19ffadf9a8..6ff00ec89013 100644 --- a/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php +++ b/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php @@ -40,7 +40,7 @@ class PhpTransliterationTest extends UnitTestCase { $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'); $module_handler->expects($this->any()) ->method('alter') - ->will($this->returnCallback(function($hook, &$overrides, $langcode) { + ->will($this->returnCallback(function ($hook, &$overrides, $langcode) { if ($langcode == 'zz') { // The default transliteration of Ä is A, but change it to Z for testing. $overrides[0xC4] = 'Z'; diff --git a/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php index 08b81170343c..9ba110f1262c 100644 --- a/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php +++ b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php @@ -83,7 +83,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase { $translator = $this->getMock('Drupal\Core\Validation\TranslatorInterface'); $translator->expects($this->any()) ->method('trans') - ->willReturnCallback(function($id) { + ->willReturnCallback(function ($id) { return $id; }); $this->contextFactory = new ExecutionContextFactory($translator); diff --git a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php index 50795b31ff66..c53b47405e0b 100644 --- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php @@ -397,7 +397,7 @@ class LinkGeneratorTest extends UnitTestCase { public function testGenerateActive() { $this->urlGenerator->expects($this->exactly(5)) ->method('generateFromRoute') - ->willReturnCallback(function($name, $parameters = [], $options = [], $collect_bubbleable_metadata = FALSE) { + ->willReturnCallback(function ($name, $parameters = [], $options = [], $collect_bubbleable_metadata = FALSE) { switch ($name) { case 'test_route_1': return (new GeneratedUrl())->setGeneratedUrl('/test-route-1'); diff --git a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php index 4df9172799e5..a47d2062ea76 100644 --- a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php @@ -147,7 +147,7 @@ class UnroutedUrlAssemblerTest extends UnitTestCase { $this->setupRequestStack(FALSE); $this->pathProcessor->expects($this->exactly(2)) ->method('processOutbound') - ->willReturnCallback(function($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) { + ->willReturnCallback(function ($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) { if ($bubbleable_metadata) { $bubbleable_metadata->setCacheContexts(['some-cache-context']); } diff --git a/core/tests/Drupal/Tests/EntityViewTrait.php b/core/tests/Drupal/Tests/EntityViewTrait.php index eb46e97e683f..d8c9d924ee18 100644 --- a/core/tests/Drupal/Tests/EntityViewTrait.php +++ b/core/tests/Drupal/Tests/EntityViewTrait.php @@ -35,7 +35,7 @@ trait EntityViewTrait { * @see drupal_render() */ protected function buildEntityView(EntityInterface $entity, $view_mode = 'full', $langcode = NULL, $reset = FALSE) { - $ensure_fully_built = function(&$elements) use (&$ensure_fully_built) { + $ensure_fully_built = function (&$elements) use (&$ensure_fully_built) { // If the default values for this element have not been loaded yet, populate // them. if (isset($elements['#type']) && empty($elements['#defaults_loaded'])) {