From 72d65cc85cd3a71526f703ca480a2aae14fb65dc Mon Sep 17 00:00:00 2001
From: xjm <xjm@65776.no-reply.drupal.org>
Date: Sat, 4 Mar 2017 08:02:01 -0600
Subject: [PATCH] Issue #2857822 by alexpott, klausi: Fix coding standards
 issues introduced mostly by array syntax conversion

---
 core/modules/book/tests/src/Unit/BookManagerTest.php   |  2 +-
 .../book/tests/src/Unit/Menu/BookLocalTasksTest.php    |  2 +-
 core/modules/ckeditor/src/Plugin/Editor/CKEditor.php   | 10 +++++-----
 core/modules/ckeditor/src/Tests/CKEditorAdminTest.php  | 10 +++++-----
 .../ckeditor/tests/modules/src/Kernel/CKEditorTest.php | 10 +++++-----
 core/modules/config/src/Tests/ConfigEntityListTest.php |  4 ++--
 .../field/tests/src/Kernel/FieldDataCountTest.php      |  2 +-
 .../Migrate/d6/MigrateFieldFormatterSettingsTest.php   |  2 +-
 core/modules/field_ui/src/Tests/ManageDisplayTest.php  |  4 ++--
 .../field_ui/tests/src/Kernel/EntityDisplayTest.php    |  2 +-
 core/modules/history/history.module                    |  2 +-
 .../src/Plugin/Field/FieldFormatter/LinkFormatter.php  |  2 +-
 .../tests/src/Unit/Menu/ShortcutLocalTasksTest.php     |  2 +-
 core/modules/system/system.install                     |  6 +++---
 .../modules/toolbar/src/Tests/ToolbarAdminMenuTest.php |  4 ++--
 core/modules/update/update.manager.inc                 |  2 +-
 core/modules/user/src/Entity/User.php                  |  2 +-
 .../user/tests/src/Unit/Menu/UserLocalTasksTest.php    |  4 ++--
 .../views/src/Plugin/views/field/FieldPluginBase.php   |  2 +-
 core/modules/views/tests/src/Kernel/ViewsHooksTest.php |  2 +-
 .../KernelTests/Core/Config/ConfigSchemaTest.php       |  4 ++--
 .../Drupal/Tests/Component/Gettext/PoHeaderTest.php    |  2 +-
 22 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/core/modules/book/tests/src/Unit/BookManagerTest.php b/core/modules/book/tests/src/Unit/BookManagerTest.php
index d7835539b553..98dbd5a72e62 100644
--- a/core/modules/book/tests/src/Unit/BookManagerTest.php
+++ b/core/modules/book/tests/src/Unit/BookManagerTest.php
@@ -102,7 +102,7 @@ public function providerTestGetBookParents() {
       // Provides a book with an existing parent.
       [
         ['pid' => 11, 'nid' => 12],
-        ['nid' => 11, 'depth' => 1, 'p1' => 11,],
+        ['nid' => 11, 'depth' => 1, 'p1' => 11],
         ['depth' => 2, 'p1' => 11, 'p2' => 12] + $empty,
       ],
       // Provides a book with two existing parents.
diff --git a/core/modules/book/tests/src/Unit/Menu/BookLocalTasksTest.php b/core/modules/book/tests/src/Unit/Menu/BookLocalTasksTest.php
index 5b7662c50a97..7abbc5c0ea8a 100644
--- a/core/modules/book/tests/src/Unit/Menu/BookLocalTasksTest.php
+++ b/core/modules/book/tests/src/Unit/Menu/BookLocalTasksTest.php
@@ -48,7 +48,7 @@ public function getBookAdminRoutes() {
    */
   public function testBookNodeLocalTasks($route) {
     $this->assertLocalTasks($route, [
-      0 => ['entity.node.book_outline_form', 'entity.node.canonical', 'entity.node.edit_form', 'entity.node.delete_form', 'entity.node.version_history',],
+      0 => ['entity.node.book_outline_form', 'entity.node.canonical', 'entity.node.edit_form', 'entity.node.delete_form', 'entity.node.version_history'],
     ]);
   }
 
diff --git a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php
index d3a7f6b73704..255691ff03b9 100644
--- a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php
+++ b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php
@@ -109,23 +109,23 @@ public function getDefaultSettings() {
           [
             [
               'name' => $this->t('Formatting'),
-              'items' => ['Bold', 'Italic',],
+              'items' => ['Bold', 'Italic'],
             ],
             [
               'name' => $this->t('Links'),
-              'items' => ['DrupalLink', 'DrupalUnlink',],
+              'items' => ['DrupalLink', 'DrupalUnlink'],
             ],
             [
               'name' => $this->t('Lists'),
-              'items' => ['BulletedList', 'NumberedList',],
+              'items' => ['BulletedList', 'NumberedList'],
             ],
             [
               'name' => $this->t('Media'),
-              'items' => ['Blockquote', 'DrupalImage',],
+              'items' => ['Blockquote', 'DrupalImage'],
             ],
             [
               'name' => $this->t('Tools'),
-              'items' => ['Source',],
+              'items' => ['Source'],
             ],
           ],
         ],
diff --git a/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php
index ed08c26d0c04..3541f0ff486b 100644
--- a/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php
+++ b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php
@@ -84,23 +84,23 @@ function testExistingFormat() {
           [
             [
               'name' => 'Formatting',
-              'items' => ['Bold', 'Italic',],
+              'items' => ['Bold', 'Italic'],
             ],
             [
               'name' => 'Links',
-              'items' => ['DrupalLink', 'DrupalUnlink',],
+              'items' => ['DrupalLink', 'DrupalUnlink'],
             ],
             [
               'name' => 'Lists',
-              'items' => ['BulletedList', 'NumberedList',],
+              'items' => ['BulletedList', 'NumberedList'],
             ],
             [
               'name' => 'Media',
-              'items' => ['Blockquote', 'DrupalImage',],
+              'items' => ['Blockquote', 'DrupalImage'],
             ],
             [
               'name' => 'Tools',
-              'items' => ['Source',],
+              'items' => ['Source'],
             ],
           ],
         ],
diff --git a/core/modules/ckeditor/tests/modules/src/Kernel/CKEditorTest.php b/core/modules/ckeditor/tests/modules/src/Kernel/CKEditorTest.php
index 9e159c3d519f..4bfda7e46b5a 100644
--- a/core/modules/ckeditor/tests/modules/src/Kernel/CKEditorTest.php
+++ b/core/modules/ckeditor/tests/modules/src/Kernel/CKEditorTest.php
@@ -463,23 +463,23 @@ protected function getDefaultToolbarConfig() {
     return [
       [
         'name' => 'Formatting',
-        'items' => ['Bold', 'Italic',],
+        'items' => ['Bold', 'Italic'],
       ],
       [
         'name' => 'Links',
-        'items' => ['DrupalLink', 'DrupalUnlink',],
+        'items' => ['DrupalLink', 'DrupalUnlink'],
       ],
       [
         'name' => 'Lists',
-        'items' => ['BulletedList', 'NumberedList',],
+        'items' => ['BulletedList', 'NumberedList'],
       ],
       [
         'name' => 'Media',
-        'items' => ['Blockquote', 'DrupalImage',],
+        'items' => ['Blockquote', 'DrupalImage'],
       ],
       [
         'name' => 'Tools',
-        'items' => ['Source',],
+        'items' => ['Source', ],
       ],
       '/',
     ];
diff --git a/core/modules/config/src/Tests/ConfigEntityListTest.php b/core/modules/config/src/Tests/ConfigEntityListTest.php
index fbc7ad6a73c4..161944b9812a 100644
--- a/core/modules/config/src/Tests/ConfigEntityListTest.php
+++ b/core/modules/config/src/Tests/ConfigEntityListTest.php
@@ -51,7 +51,7 @@ function testList() {
 
     // Test getOperations() method.
     $expected_operations = [
-      'edit' =>  [
+      'edit' => [
         'title' => t('Edit'),
         'weight' => 10,
         'url' => $entity->urlInfo(),
@@ -61,7 +61,7 @@ function testList() {
         'weight' => 40,
         'url' => $entity->urlInfo('disable'),
       ],
-      'delete' =>  [
+      'delete' => [
         'title' => t('Delete'),
         'weight' => 100,
         'url' => $entity->urlInfo('delete-form'),
diff --git a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php
index 2bbe24d68caf..69b84a9c1d1b 100644
--- a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php
@@ -112,7 +112,7 @@ public function testEntityCountAndHasData() {
 
     $entity_init = $this->container->get('entity_type.manager')
       ->getStorage($entity_type)
-      ->create(['type' => $entity_type,]);
+      ->create(['type' => $entity_type]);
     $cardinality = $this->fieldTestData->field_storage_2->getCardinality();
 
     $this->assertIdentical($this->fieldTestData->field_storage_2->hasData(), FALSE, 'There are no entities with field data.');
diff --git a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldFormatterSettingsTest.php b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldFormatterSettingsTest.php
index edf6dc0b2121..9775c5b4f249 100644
--- a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldFormatterSettingsTest.php
+++ b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldFormatterSettingsTest.php
@@ -138,7 +138,7 @@ public function testEntityDisplaySettings() {
     $this->assertIdentical($expected, $component);
 
     // Test date field.
-    $defaults = ['format_type' => 'fallback', 'timezone_override' => '',];
+    $defaults = ['format_type' => 'fallback', 'timezone_override' => ''];
     $expected['weight'] = 10;
     $expected['type'] = 'datetime_default';
     $expected['settings'] = ['format_type' => 'fallback'] + $defaults;
diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php
index 9c8798fe282a..3f6c480cc794 100644
--- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php
+++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php
@@ -87,7 +87,7 @@ function testFormatterUI() {
     $options = array_map(function($item) {
       return (string) $item->attributes()->value[0];
     }, $result);
-    $expected_options =  [
+    $expected_options = [
       'field_no_settings',
       'field_empty_test',
       'field_empty_setting',
@@ -249,7 +249,7 @@ public function testWidgetUI() {
     $options = array_map(function($item) {
       return (string) $item->attributes()->value[0];
     }, $result);
-    $expected_options =  [
+    $expected_options = [
       'test_field_widget',
       'test_field_widget_multiple',
     ];
diff --git a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
index 9e46d82da9e2..4a0e533be3a2 100644
--- a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
+++ b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
@@ -129,7 +129,7 @@ public function testEntityDisplayCRUDSort() {
     $display->save();
     $components = array_keys($display->getComponents());
     // The name field is not configurable so will be added automatically.
-    $expected =  [ 0 => 'component_1', 1 => 'component_2', 2 => 'component_3', 'name'];
+    $expected = [ 0 => 'component_1', 1 => 'component_2', 2 => 'component_3', 'name'];
     $this->assertIdentical($components, $expected);
   }
 
diff --git a/core/modules/history/history.module b/core/modules/history/history.module
index 58f40de3e772..f36121ef5115 100644
--- a/core/modules/history/history.module
+++ b/core/modules/history/history.module
@@ -28,7 +28,7 @@ function history_help($route_name, RouteMatchInterface $route_match) {
   switch ($route_name) {
     case 'help.page.history':
       $output  = '<h3>' . t('About') . '</h3>';
-      $output .= '<p>' . t('The History module keeps track of which content a user has read. It marks content as <em>new</em> or <em>updated</em> depending on the last time the user viewed it. History records that are older than one month are removed during cron, which means that content older than one month is always considered <em>read</em>. The History module does not have a user interface but it provides a filter to <a href=":views-help">Views</a> to show new or updated content. For more information, see the <a href=":url">online documentation for the History module</a>.', [':views-help' => (\Drupal::moduleHandler()->moduleExists('views')) ? \Drupal::url('help.page',  ['name' => 'views']) : '#', ':url' => 'https://www.drupal.org/documentation/modules/history']) . '</p>';
+      $output .= '<p>' . t('The History module keeps track of which content a user has read. It marks content as <em>new</em> or <em>updated</em> depending on the last time the user viewed it. History records that are older than one month are removed during cron, which means that content older than one month is always considered <em>read</em>. The History module does not have a user interface but it provides a filter to <a href=":views-help">Views</a> to show new or updated content. For more information, see the <a href=":url">online documentation for the History module</a>.', [':views-help' => (\Drupal::moduleHandler()->moduleExists('views')) ? \Drupal::url('help.page', ['name' => 'views']) : '#', ':url' => 'https://www.drupal.org/documentation/modules/history']) . '</p>';
       return $output;
   }
 }
diff --git a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php
index 30fcd8e260d5..b0928b0db000 100644
--- a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php
+++ b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php
@@ -216,7 +216,7 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
         $element[$delta]['#url'] = $url;
 
         if (!empty($item->_attributes)) {
-          $element[$delta]['#options'] +=  ['attributes' => []];
+          $element[$delta]['#options'] += ['attributes' => []];
           $element[$delta]['#options']['attributes'] += $item->_attributes;
           // Unset field item attributes since they have been included in the
           // formatter output and should not be rendered in the field template.
diff --git a/core/modules/shortcut/tests/src/Unit/Menu/ShortcutLocalTasksTest.php b/core/modules/shortcut/tests/src/Unit/Menu/ShortcutLocalTasksTest.php
index ee9a6559e4e0..09b6468afe01 100644
--- a/core/modules/shortcut/tests/src/Unit/Menu/ShortcutLocalTasksTest.php
+++ b/core/modules/shortcut/tests/src/Unit/Menu/ShortcutLocalTasksTest.php
@@ -26,7 +26,7 @@ protected function setUp() {
    */
   public function testShortcutPageLocalTasks($route) {
     $tasks = [
-      0 => ['shortcut.set_switch', 'entity.user.canonical', 'entity.user.edit_form',],
+      0 => ['shortcut.set_switch', 'entity.user.canonical', 'entity.user.edit_form'],
     ];
     $this->assertLocalTasks($route, $tasks);
   }
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index fadf17fdc60e..f9c72f73d437 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -127,7 +127,7 @@ function system_requirements($phase) {
     }
 
     if ($rewrite_warning) {
-      $requirements['apache_version'] =  [
+      $requirements['apache_version'] = [
         'title' => t('Apache version'),
         'value' => $apache_version_string,
         'severity' => REQUIREMENT_WARNING,
@@ -136,7 +136,7 @@ function system_requirements($phase) {
     }
 
     if ($rewrite_error) {
-      $requirements['Apache version'] =  [
+      $requirements['Apache version'] = [
         'title' => t('Apache version'),
         'value' => $apache_version_string,
         'severity' => REQUIREMENT_ERROR,
@@ -145,7 +145,7 @@ function system_requirements($phase) {
     }
 
     if (!$rewrite_error && !$rewrite_warning) {
-      $requirements['rewrite_module'] =  [
+      $requirements['rewrite_module'] = [
         'title' => t('Clean URLs'),
         'value' => t('Disabled'),
         'severity' => REQUIREMENT_WARNING,
diff --git a/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php b/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
index e78f463d8925..b5435dc3c735 100644
--- a/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
+++ b/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
@@ -179,7 +179,7 @@ function testUserRoleUpdateSubtreesHashCacheClear() {
 
     $this->hash = $this->getSubtreesHash();
 
-    $rid = $this->drupalCreateRole(['administer content types',]);
+    $rid = $this->drupalCreateRole(['administer content types']);
 
     // Assign the role to the user.
     $this->drupalPostForm('user/' . $this->adminUser->id() . '/edit', ["roles[$rid]" => $rid], t('Save'));
@@ -214,7 +214,7 @@ function testNonCurrentUserAccountUpdates() {
 
     // adminUser2 will add a role to adminUser.
     $this->drupalLogin($this->adminUser2);
-    $rid = $this->drupalCreateRole(['administer content types',]);
+    $rid = $this->drupalCreateRole(['administer content types']);
 
     // Get the subtree hash for adminUser2 to check later that it has not
     // changed. Request a new page to refresh the drupalSettings object.
diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc
index 541ab6f34a85..e7960072c595 100644
--- a/core/modules/update/update.manager.inc
+++ b/core/modules/update/update.manager.inc
@@ -150,7 +150,7 @@ function _update_manager_check_backends(&$form, $operation) {
 function update_manager_archive_extract($file, $directory) {
   $archiver = archiver_get_archiver($file);
   if (!$archiver) {
-    throw new Exception(t('Cannot extract %file, not a valid archive.',  ['%file' => $file]));
+    throw new Exception(t('Cannot extract %file, not a valid archive.', ['%file' => $file]));
   }
 
   // Remove the directory if it exists, otherwise it might contain a mixture of
diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php
index 38f0f39845ee..66a49543dfb7 100644
--- a/core/modules/user/src/Entity/User.php
+++ b/core/modules/user/src/Entity/User.php
@@ -455,7 +455,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
       // @todo: A default value of NULL is ignored, so we have to specify
       // an empty field item structure instead. Fix this in
       // https://www.drupal.org/node/2318605.
-      ->setDefaultValue([0 =>  ['value' => NULL]])
+      ->setDefaultValue([0 => ['value' => NULL]])
       // @todo: Define this via an options provider once
       // https://www.drupal.org/node/2329937 is completed.
       ->addPropertyConstraints('value', [
diff --git a/core/modules/user/tests/src/Unit/Menu/UserLocalTasksTest.php b/core/modules/user/tests/src/Unit/Menu/UserLocalTasksTest.php
index 106e09142c17..b9986c9b4c3f 100644
--- a/core/modules/user/tests/src/Unit/Menu/UserLocalTasksTest.php
+++ b/core/modules/user/tests/src/Unit/Menu/UserLocalTasksTest.php
@@ -44,7 +44,7 @@ public function getUserAdminRoutes() {
    */
   public function testUserLoginLocalTasks($route) {
     $tasks = [
-      0 => ['user.register', 'user.pass', 'user.login',],
+      0 => ['user.register', 'user.pass', 'user.login'],
     ];
     $this->assertLocalTasks($route, $tasks);
   }
@@ -67,7 +67,7 @@ public function getUserLoginRoutes() {
    */
   public function testUserPageLocalTasks($route, $subtask = []) {
     $tasks = [
-      0 => ['entity.user.canonical', 'entity.user.edit_form',],
+      0 => ['entity.user.canonical', 'entity.user.edit_form'],
     ];
     if ($subtask) $tasks[] = $subtask;
     $this->assertLocalTasks($route, $tasks);
diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
index 8291fed53fd5..d9485407716c 100644
--- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
@@ -781,7 +781,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
             ':input[name="options[alter][make_link]"]' => ['checked' => TRUE],
           ],
         ],
-       '#options' => [
+        '#options' => [
           'none' => $this->t('No transform'),
           'upper' => $this->t('Upper case'),
           'lower' => $this->t('Lower case'),
diff --git a/core/modules/views/tests/src/Kernel/ViewsHooksTest.php b/core/modules/views/tests/src/Kernel/ViewsHooksTest.php
index 612934e73222..aceda8f6e687 100644
--- a/core/modules/views/tests/src/Kernel/ViewsHooksTest.php
+++ b/core/modules/views/tests/src/Kernel/ViewsHooksTest.php
@@ -26,7 +26,7 @@ class ViewsHooksTest extends ViewsKernelTestBase {
    *
    * @var array
    */
-  protected static $hooks =  [
+  protected static $hooks = [
     'views_data' => 'all',
     'views_data_alter' => 'alter',
     'views_query_substitutions' => 'view',
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
index 5554fb2870af..84aa27132672 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
@@ -342,7 +342,7 @@ public function testConfigSaveWithSchema() {
       ],
       'float' => '3.14',
       'null_float' => '',
-      'sequence' =>  [1, 0, 1],
+      'sequence' => [1, 0, 1],
       'sequence_bc' => [1, 0, 1],
       // Not in schema and therefore should be left untouched.
       'not_present_in_schema' => TRUE,
@@ -365,7 +365,7 @@ public function testConfigSaveWithSchema() {
       ],
       'float' => 3.14,
       'null_float' => NULL,
-      'sequence' =>  [TRUE, FALSE, TRUE],
+      'sequence' => [TRUE, FALSE, TRUE],
       'sequence_bc' => [TRUE, FALSE, TRUE],
       'not_present_in_schema' => TRUE,
       'config_schema_test_integer' => 1,
diff --git a/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php b/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php
index e106fec37906..113f6cdea826 100644
--- a/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php
+++ b/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php
@@ -279,7 +279,7 @@ public function providerTestPluralsFormula() {
           193 => 1,
           194 => 1,
           'default' => 2,
-        ],],
+        ], ],
       [
         'nplurals=4; plural=(((n==1)||(n==11))?(0):(((n==2)||(n==12))?(1):(((n>2)&&(n<20))?(2):3)));',
         [
-- 
GitLab