Unverified Commit be6d515c authored by alexpott's avatar alexpott

Issue #2572613 by Malevi4, idebr, pfrenssen, Mile23, RajeevK: Fix...

Issue #2572613 by Malevi4, idebr, pfrenssen, Mile23, RajeevK: Fix 'Drupal.Array.Array.CommaLastItem' coding standard
parent b8f93d5b
......@@ -715,7 +715,7 @@ function drupal_attach_tabledrag(&$element, array $options) {
'subgroup' => NULL,
'source' => NULL,
'hidden' => TRUE,
'limit' => 0
'limit' => 0,
];
$group = $options['group'];
......
......@@ -2050,7 +2050,7 @@ function install_check_requirements($install_state) {
'severity' => REQUIREMENT_ERROR,
'description' => t('The @drupal installer requires that the %default-file file not be modified in any way from the original download.', [
'@drupal' => drupal_install_profile_distribution_name(),
'%default-file' => $default_file
'%default-file' => $default_file,
]),
];
}
......@@ -2111,7 +2111,7 @@ function install_check_requirements($install_state) {
'@drupal' => drupal_install_profile_distribution_name(),
'%file' => $file,
'%default_file' => $default_file,
':install_txt' => base_path() . 'core/INSTALL.txt'
':install_txt' => base_path() . 'core/INSTALL.txt',
]),
];
}
......@@ -2129,7 +2129,7 @@ function install_check_requirements($install_state) {
'description' => t('@drupal requires read permissions to %file at all times. The <a href=":handbook_url">webhosting issues</a> documentation section offers help on this and other topics.', [
'@drupal' => drupal_install_profile_distribution_name(),
'%file' => $file,
':handbook_url' => 'https://www.drupal.org/server-permissions'
':handbook_url' => 'https://www.drupal.org/server-permissions',
]),
];
}
......@@ -2142,7 +2142,7 @@ function install_check_requirements($install_state) {
'description' => t('The @drupal installer requires write permissions to %file during the installation process. The <a href=":handbook_url">webhosting issues</a> documentation section offers help on this and other topics.', [
'@drupal' => drupal_install_profile_distribution_name(),
'%file' => $file,
':handbook_url' => 'https://www.drupal.org/server-permissions'
':handbook_url' => 'https://www.drupal.org/server-permissions',
]),
];
}
......@@ -2162,7 +2162,7 @@ function install_check_requirements($install_state) {
'%file' => $file,
'%default_file' => $default_file,
':install_txt' => base_path() . 'core/INSTALL.txt',
':handbook_url' => 'https://www.drupal.org/server-permissions'
':handbook_url' => 'https://www.drupal.org/server-permissions',
]),
];
}
......
......@@ -124,7 +124,7 @@ public static function cleanCssIdentifier($identifier, array $filter = [
// Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit.
$identifier = preg_replace([
'/^[0-9]/',
'/^(-[0-9])|^(--)/'
'/^(-[0-9])|^(--)/',
], ['_', '__'], $identifier);
return $identifier;
}
......
......@@ -38,7 +38,7 @@ public function blockForm($form, FormStateInterface $form_state) {
*/
protected function brokenMessage() {
$build['message'] = [
'#markup' => $this->t('This block is broken or missing. You may be missing content or you might need to enable the original module.')
'#markup' => $this->t('This block is broken or missing. You may be missing content or you might need to enable the original module.'),
];
return $build;
......
......@@ -59,7 +59,7 @@ public static function create($extension, array $config_objects) {
$message = new FormattableMarkup('Configuration objects (@config_names) provided by @extension already exist in active configuration',
[
'@config_names' => implode(', ', static::flattenConfigObjects($config_objects)),
'@extension' => $extension
'@extension' => $extension,
]
);
$e = new static($message);
......
......@@ -92,7 +92,7 @@ public static function create($extension, array $config_objects) {
$message = new FormattableMarkup('Configuration objects provided by %extension have unmet dependencies: %config_names',
[
'%config_names' => static::formatConfigObjectList($config_objects),
'%extension' => $extension
'%extension' => $extension,
]
);
$e = new static($message);
......
......@@ -57,7 +57,7 @@ protected function _block_header($xbeg, $xlen, $ybeg, $ylen) {
[
'data' => $ybeg + $this->line_stats['offset']['y'],
'colspan' => 2,
]
],
];
}
......@@ -94,7 +94,7 @@ protected function addedLine($line) {
[
'data' => ['#markup' => $line],
'class' => 'diff-context diff-addedline',
]
],
];
}
......@@ -116,7 +116,7 @@ protected function deletedLine($line) {
[
'data' => ['#markup' => $line],
'class' => 'diff-context diff-deletedline',
]
],
];
}
......@@ -135,7 +135,7 @@ protected function contextLine($line) {
[
'data' => ['#markup' => $line],
'class' => 'diff-context',
]
],
];
}
......
......@@ -39,7 +39,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['deleted_translations'] = [
'#theme' => 'item_list',
'#title' => $this->t('The following @entity-type translations will be deleted:', [
'@entity-type' => $entity->getEntityType()->getLowercaseLabel()
'@entity-type' => $entity->getEntityType()->getLowercaseLabel(),
]),
'#items' => $languages,
];
......
......@@ -133,7 +133,7 @@ public function form(array $form, FormStateInterface $form_state) {
'#type' => 'container',
'#weight' => 99,
'#attributes' => [
'class' => ['entity-content-form-footer']
'class' => ['entity-content-form-footer'],
],
'#optional' => TRUE,
];
......
......@@ -144,7 +144,7 @@ public function getRenderer($field_name) {
'form_mode' => $this->originalMode,
// No need to prepare, defaults have been merged in setComponent().
'prepare' => FALSE,
'configuration' => $configuration
'configuration' => $configuration,
]);
}
else {
......@@ -330,7 +330,7 @@ public function getPluginCollections() {
}
return [
'widgets' => new EntityDisplayPluginCollection($this->pluginManager, $configurations)
'widgets' => new EntityDisplayPluginCollection($this->pluginManager, $configurations),
];
}
......
......@@ -201,7 +201,7 @@ public function getRenderer($field_name) {
'view_mode' => $this->originalMode,
// No need to prepare, defaults have been merged in setComponent().
'prepare' => FALSE,
'configuration' => $configuration
'configuration' => $configuration,
]);
}
else {
......@@ -301,7 +301,7 @@ public function getPluginCollections() {
}
return [
'formatters' => new EntityDisplayPluginCollection($this->pluginManager, $configurations)
'formatters' => new EntityDisplayPluginCollection($this->pluginManager, $configurations),
];
}
......
......@@ -164,7 +164,7 @@ protected function init() {
// Extra fields are visible by default unless they explicitly say so.
if (!isset($definition['visible']) || $definition['visible'] == TRUE) {
$this->setComponent($name, [
'weight' => $definition['weight']
'weight' => $definition['weight'],
]);
}
else {
......
......@@ -97,7 +97,7 @@ public function getDerivativeDefinitions($base_plugin_definition) {
if ($bundle !== $entity_type_id) {
$this->derivatives[$entity_type_id . ':' . $bundle] = [
'label' => $bundle_info['label'],
'constraints' => $this->derivatives[$entity_type_id]['constraints']
'constraints' => $this->derivatives[$entity_type_id]['constraints'],
] + $base_plugin_definition;
}
}
......
......@@ -258,7 +258,7 @@ protected function getEditFormRoute(EntityTypeInterface $entity_type) {
$route
->setDefaults([
'_entity_form' => "{$entity_type_id}.{$operation}",
'_title_callback' => '\Drupal\Core\Entity\Controller\EntityController::editTitle'
'_title_callback' => '\Drupal\Core\Entity\Controller\EntityController::editTitle',
])
->setRequirement('_entity_access', "{$entity_type_id}.update")
->setOption('parameters', [
......
......@@ -1168,7 +1168,7 @@ protected function initializeRevisionDataTable(ContentEntityTypeInterface $entit
$entity_type_id . '__revision' => [
'table' => $this->storage->getRevisionTable(),
'columns' => [$revision_key => $revision_key],
]
],
],
];
......@@ -2043,7 +2043,7 @@ protected function getDedicatedTableSchema(FieldStorageDefinitionInterface $stor
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'A boolean indicating whether this data item has been deleted'
'description' => 'A boolean indicating whether this data item has been deleted',
],
'entity_id' => $id_schema,
'revision_id' => $revision_id_schema,
......
......@@ -214,19 +214,19 @@ protected function validateDependencies(ConfigImporter $config_importer) {
if (!isset($core_extension['module'][$owner]) && isset($module_data[$owner])) {
$message = $this->t('Configuration %name depends on the %owner module that will not be installed after import.', [
'%name' => $name,
'%owner' => $module_data[$owner]->info['name']
'%owner' => $module_data[$owner]->info['name'],
]);
}
elseif (!isset($core_extension['theme'][$owner]) && isset($theme_data[$owner])) {
$message = $this->t('Configuration %name depends on the %owner theme that will not be installed after import.', [
'%name' => $name,
'%owner' => $theme_data[$owner]->info['name']
'%owner' => $theme_data[$owner]->info['name'],
]);
}
elseif (!isset($core_extension['module'][$owner]) && !isset($core_extension['theme'][$owner])) {
$message = $this->t('Configuration %name depends on the %owner extension that will not be installed after import.', [
'%name' => $name,
'%owner' => $owner
'%owner' => $owner,
]);
}
......
......@@ -933,7 +933,7 @@ function hook_requirements($phase) {
$requirements['drupal'] = [
'title' => t('Drupal'),
'value' => \Drupal::VERSION,
'severity' => REQUIREMENT_INFO
'severity' => REQUIREMENT_INFO,
];
}
......
......@@ -118,7 +118,7 @@ protected function viewValue(FieldItemInterface $item) {
// name. That only depends on formatter settings and no language condition.
$languages = $this->getSetting('native_language') ? $this->languageManager->getNativeLanguages(LanguageInterface::STATE_ALL) : $this->languageManager->getLanguages(LanguageInterface::STATE_ALL);
return [
'#plain_text' => $item->language && isset($languages[$item->language->getId()]) ? $languages[$item->language->getId()]->getName() : ''
'#plain_text' => $item->language && isset($languages[$item->language->getId()]) ? $languages[$item->language->getId()]->getName() : '',
];
}
......
......@@ -52,7 +52,7 @@ public static function schema(FieldStorageDefinitionInterface $field_definition)
'type' => 'numeric',
'precision' => $field_definition->getSetting('precision'),
'scale' => $field_definition->getSetting('scale'),
]
],
],
];
}
......@@ -98,7 +98,7 @@ public function getConstraints() {
'value' => [
'Regex' => [
'pattern' => '/^[+-]?((\d+(\.\d*)?)|(\.\d+))$/i',
]
],
],
]);
......
......@@ -59,7 +59,7 @@ public function getConstraints() {
'Length' => [
'max' => Email::EMAIL_MAX_LENGTH,
'maxMessage' => t('%name: the email address can not be longer than @max characters.', ['%name' => $this->getFieldDefinition()->getLabel(), '@max' => Email::EMAIL_MAX_LENGTH]),
]
],
],
]);
......
......@@ -679,8 +679,8 @@ public static function getPreconfiguredOptions() {
'field_storage_config' => [
'settings' => [
'target_type' => $entity_type->id(),
]
]
],
],
];
}
......
......@@ -86,7 +86,7 @@ public function getConstraints() {
'Range' => [
'min' => $min,
'minMessage' => t('%name: the value may be no less than %min.', ['%name' => $label, '%min' => $min]),
]
],
],
]);
}
......@@ -98,7 +98,7 @@ public function getConstraints() {
'Range' => [
'max' => $max,
'maxMessage' => t('%name: the value may be no greater than %max.', ['%name' => $label, '%max' => $max]),
]
],
],
]);
}
......
......@@ -107,7 +107,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
if ($this->getSelectionHandlerSetting('auto_create') && ($bundle = $this->getAutocreateBundle())) {
$element['#autocreate'] = [
'bundle' => $bundle,
'uid' => ($entity instanceof EntityOwnerInterface) ? $entity->getOwnerId() : \Drupal::currentUser()->id()
'uid' => ($entity instanceof EntityOwnerInterface) ? $entity->getOwnerId() : \Drupal::currentUser()->id(),
];
}
......
......@@ -141,7 +141,7 @@ public function calculateDependencies() {
if (!empty($this->thirdPartySettings)) {
// Create dependencies on any modules providing third party settings.
return [
'module' => array_keys($this->thirdPartySettings)
'module' => array_keys($this->thirdPartySettings),
];
}
return [];
......
......@@ -778,9 +778,9 @@ public function prepareForm($form_id, &$form, FormStateInterface &$form_state) {
'#attached' => [
'placeholders' => [
$placeholder => [
'#lazy_builder' => ['form_builder:renderFormTokenPlaceholder', [$placeholder]]
]
]
'#lazy_builder' => ['form_builder:renderFormTokenPlaceholder', [$placeholder]],
],
],
],
'#cache' => [
'max-age' => 0,
......
......@@ -129,7 +129,7 @@ function callback_batch_finished($success, $results, $operations) {
$error_operation = reset($operations);
$message = t('An error occurred while processing %error_operation with arguments: @arguments', [
'%error_operation' => $error_operation[0],
'@arguments' => print_r($error_operation[1], TRUE)
'@arguments' => print_r($error_operation[1], TRUE),
]);
\Drupal::messenger()->addError($message);
}
......
......@@ -58,7 +58,7 @@ public function fromOptions(array $config = []) {
'http' => NULL,
'https' => NULL,
'no' => [],
]
],
];
$config = NestedArray::mergeDeep($default_config, Settings::get('http_client_config', []), $config);
......
......@@ -124,7 +124,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['settings'][$key]['#states'] = [
'visible' => [
':input[name=driver]' => ['value' => $key],
]
],
];
}
......
......@@ -63,7 +63,7 @@ public function getAll() {
'SELECT name, value FROM {' . $this->connection->escapeTable($this->table) . '} WHERE collection = :collection AND expire > :now',
[
':collection' => $this->collection,
':now' => REQUEST_TIME
':now' => REQUEST_TIME,
])->fetchAllKeyed();
return array_map([$this->serializer, 'decode'], $values);
}
......
......@@ -251,20 +251,20 @@ public function schemaDefinition() {
'type' => 'varchar_ascii',
'length' => 255,
'not null' => TRUE,
'default' => ''
'default' => '',
],
'value' => [
'description' => 'A value for the semaphore.',
'type' => 'varchar_ascii',
'length' => 255,
'not null' => TRUE,
'default' => ''
'default' => '',
],
'expire' => [
'description' => 'A Unix timestamp with microseconds indicating when the semaphore should expire.',
'type' => 'float',
'size' => 'big',
'not null' => TRUE
'not null' => TRUE,
],
],
'indexes' => [
......
......@@ -65,7 +65,7 @@ public static function preRenderCompactLink($element) {
$element['#url'] = BaseUrl::fromRoute('system.admin_compact_page', ['mode' => 'off']);