Commit f659d6ca authored by catch's avatar catch

Issue #2901726 by mfernea, gmario, finn.lewis, robertoperuzzo, rachel_norfolk:...

Issue #2901726 by mfernea, gmario, finn.lewis, robertoperuzzo, rachel_norfolk: Fix 'Squiz.Functions.MultiLineFunctionDeclaration' coding standard
parent 942b70b4
......@@ -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) . '$/';
......
......@@ -25,7 +25,7 @@ public static function register() {
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;
}
......
......@@ -376,7 +376,7 @@ public static function lcfirst($text) {
*/
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);
}
......
......@@ -175,7 +175,7 @@ public function getAll() {
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);
......
......@@ -178,7 +178,7 @@ public function getAll() {
*/
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);
......
......@@ -278,7 +278,7 @@ protected function getCacheKey($name) {
*/
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);
......
......@@ -306,7 +306,7 @@ protected function getConfigCacheKey($name, $immutable) {
* 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;
......
......@@ -185,7 +185,7 @@ public function installOptionalConfig(StorageInterface $storage = NULL, $depende
$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
......
......@@ -233,7 +233,7 @@ public function getConfigDependencyManager() {
// 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;
......
......@@ -88,7 +88,7 @@ public function execute() {
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;
});
}
......
......@@ -128,7 +128,7 @@ public function __toString() {
// 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);
......
......@@ -100,7 +100,7 @@ public function __toString() {
// 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);
......
......@@ -108,7 +108,7 @@ public function format($format, $settings = []) {
$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])) {
......
......@@ -916,7 +916,7 @@ public function getTranslationStatus($langcode) {
* {@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]);
......
......@@ -153,10 +153,10 @@ protected function initFieldValues(ContentEntityInterface $entity, array $values
*/
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;
......
......@@ -77,7 +77,7 @@ public static function valueCallback(&$element, $input, FormStateInterface $form
// 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);
......
......@@ -346,7 +346,7 @@ protected function buildBundleFieldDefinitions($entity_type_id, $bundle, array $
// 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);
......
......@@ -50,7 +50,7 @@ public function execute() {
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;
});
}
......
......@@ -296,13 +296,13 @@ public function requiresDedicatedTableStorage(FieldStorageDefinitionInterface $s
*/
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));
......
......@@ -1529,7 +1529,7 @@ protected function createEntitySchemaIndexes(array $entity_schema, FieldStorageD
// 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 @@ protected function deleteEntitySchemaIndexes(array $entity_schema_data, FieldSto
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)) {
......
......@@ -93,7 +93,7 @@ public function onController(FilterControllerEvent $event) {
// 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 @@ public function onController(FilterControllerEvent $event) {
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);
});
......
......@@ -176,7 +176,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
*/
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);
......
......@@ -169,7 +169,7 @@ public function mail($module, $key, $to, $langcode, $params = [], $reply = NULL,
// 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);
});
}
......
......@@ -139,7 +139,7 @@ public static function getCheckedCheckboxes(array $input) {
//
// @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);
......
......@@ -139,7 +139,7 @@ public function renderResponse(array $main_content, Request $request, RouteMatch
// 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 @@ protected function prepare(array $main_content, Request $request, RouteMatchInte
// ::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
......
......@@ -309,7 +309,7 @@ protected function doRender(&$elements, $is_root_call = FALSE) {
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.");
......
......@@ -130,7 +130,7 @@ public static function getPathWithoutDefaults(Route $route) {
// 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);
......
......@@ -610,7 +610,7 @@ public function safeJoin(\Twig_Environment $env, $value, $glue = '') {
$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));
......
......@@ -225,7 +225,7 @@ public function getModuleUpdateFunctions($module_name) {
$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 @@ protected function scanExtensionsAndLoadUpdateFiles() {
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;
});
......
......@@ -112,7 +112,7 @@ public function generate($text, Url $url) {
}
// 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;
}
......
......@@ -92,7 +92,7 @@ public function execute($object = NULL) {
$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.
......
......@@ -86,7 +86,7 @@ public function fetch(FeedInterface $feed) {
$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;
}
],
......
......@@ -141,7 +141,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
];
$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));
......
......@@ -374,7 +374,7 @@ protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholde
}
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)));
......
......@@ -84,7 +84,7 @@ public function testBlockFilter() {
* @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;
......
......@@ -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];
......
......@@ -126,7 +126,7 @@ public function getConfig(Editor $editor) {
* {@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 @@ protected function generateACFSettings(Editor $editor) {
}
// 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 @@ protected function generateACFSettings(Editor $editor) {
// 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 @@ protected function generateACFSettings(Editor $editor) {
// 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)) {
......
......@@ -194,7 +194,7 @@ public function settingsForm(array $form, FormStateInterface $form_state, Editor
}
}
// 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 @@ public function buildContentsCssJSSetting(Editor $editor) {
];
$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);
......
......@@ -179,7 +179,7 @@ public function testExistingFormat() {
// 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.
......
......@@ -67,7 +67,7 @@ public function testImageButtonDisplay() {
$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')));
......
......@@ -55,7 +55,7 @@ public function testCkeditorAjaxAddCss() {
// 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 @@ public function testCkeditorAjaxAddCss() {
// 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);
});
......
......@@ -136,7 +136,7 @@ public function testSendMailMessages(MessageInterface $message, AccountInterface
$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']);
......
......@@ -71,7 +71,7 @@ public function buildForm(array $form, FormStateInterface $form_state, ContentEn
$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;
});
......
......@@ -42,7 +42,7 @@ public function getValidTransitions(ContentEntityInterface $entity, AccountInter
$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());
});
}
......
......@@ -52,7 +52,7 @@ public function testStateFieldFormatter($field_value, $formatter_settings, $expe
]);
$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);
});
......
......@@ -181,19 +181,19 @@ public function testMultipleSyncedValues() {
// 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;
},
];
......
......@@ -46,7 +46,7 @@ protected function setUp() {
public function testEditorFileReferenceFilter() {
$filter = $this->filters['editor_file_reference'];
$test = function($input) use ($filter) {
$test = function ($input) use ($filter) {
return $filter->process($input, 'und');
};
......
......@@ -57,7 +57,7 @@ public function testHandlerUI() {
// 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 @@ public function testHandlerUIAggregation() {
// 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);
......
......@@ -174,7 +174,7 @@ public function testTextFieldInstances() {
// 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);
......
......@@ -149,7 +149,7 @@ public function testTextFields() {
// 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);
......