From 1af51d41f3ef8ebc2ff8333a3667a4327ad7bd73 Mon Sep 17 00:00:00 2001
From: quietone <quietone@2572884.no-reply.drupal.org>
Date: Mon, 25 Nov 2024 21:55:12 +1300
Subject: [PATCH] Issue #3486526 by theodorejb, andypost, nicxvan: Inconsistent
 switch case syntax

---
 core/modules/field/src/FieldConfigStorage.php                 | 4 ++--
 .../migrate/process/d6/FieldInstanceOptionTranslation.php     | 2 +-
 .../migrate/process/d7/FieldInstanceOptionTranslation.php     | 2 +-
 core/modules/jsonapi/tests/src/Functional/CommentTest.php     | 4 ++--
 core/modules/jsonapi/tests/src/Functional/MediaTest.php       | 2 +-
 .../migrate/process/ContentTranslationEnabledSetting.php      | 2 +-
 .../media/tests/src/Functional/Rest/MediaResourceTestBase.php | 2 +-
 .../user/src/EventSubscriber/AccessDeniedSubscriber.php       | 4 ++--
 core/modules/views/src/Plugin/views/sort/SortPluginBase.php   | 4 ++--
 core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php    | 2 +-
 10 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/core/modules/field/src/FieldConfigStorage.php b/core/modules/field/src/FieldConfigStorage.php
index 3f18a0fed7a6..50bfb95eec0a 100644
--- a/core/modules/field/src/FieldConfigStorage.php
+++ b/core/modules/field/src/FieldConfigStorage.php
@@ -150,11 +150,11 @@ public function loadByProperties(array $conditions = []) {
             $checked_value = $field_storage->uuid();
             break;
 
-          case 'uuid';
+          case 'uuid':
             $checked_value = $field->uuid();
             break;
 
-          case 'deleted';
+          case 'deleted':
             $checked_value = $field->isDeleted();
             break;
 
diff --git a/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceOptionTranslation.php b/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceOptionTranslation.php
index 9ddca5490265..e4d101cd39a3 100644
--- a/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceOptionTranslation.php
+++ b/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceOptionTranslation.php
@@ -30,7 +30,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
       $list = array_map('trim', $list);
       $list = FilterArray::removeEmptyStrings($list);
       switch ($field_type) {
-        case 'boolean';
+        case 'boolean':
           $option = preg_replace('/^option_/', '', $row->getSourceProperty('property'));
           for ($i = 0; $i < 2; $i++) {
             $value = $list[$i];
diff --git a/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceOptionTranslation.php b/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceOptionTranslation.php
index 00230c8ebea1..175e4557f64d 100644
--- a/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceOptionTranslation.php
+++ b/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceOptionTranslation.php
@@ -29,7 +29,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
     if (isset($data['settings']['allowed_values'])) {
       $allowed_values = $data['settings']['allowed_values'];
       switch ($type) {
-        case 'boolean';
+        case 'boolean':
           if (isset($allowed_values[$property])) {
             $translation = $row->getSourceProperty('translation');
             break;
diff --git a/core/modules/jsonapi/tests/src/Functional/CommentTest.php b/core/modules/jsonapi/tests/src/Functional/CommentTest.php
index 9f3a691fd665..82c97d9f1f32 100644
--- a/core/modules/jsonapi/tests/src/Functional/CommentTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/CommentTest.php
@@ -293,10 +293,10 @@ protected function getExpectedCacheContexts(?array $sparse_fieldset = NULL) {
    */
   protected function getExpectedUnauthorizedAccessMessage($method) {
     switch ($method) {
-      case 'GET';
+      case 'GET':
         return "The 'access comments' permission is required and the comment must be published.";
 
-      case 'POST';
+      case 'POST':
         return "The 'post comments' permission is required.";
 
       case 'PATCH':
diff --git a/core/modules/jsonapi/tests/src/Functional/MediaTest.php b/core/modules/jsonapi/tests/src/Functional/MediaTest.php
index d1ce6a61a902..7b98a0ad36f8 100644
--- a/core/modules/jsonapi/tests/src/Functional/MediaTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/MediaTest.php
@@ -323,7 +323,7 @@ protected function getPostDocument(): array {
    */
   protected function getExpectedUnauthorizedAccessMessage($method) {
     switch ($method) {
-      case 'GET';
+      case 'GET':
         return "The 'view media' permission is required when the media item is published.";
 
       case 'POST':
diff --git a/core/modules/language/src/Plugin/migrate/process/ContentTranslationEnabledSetting.php b/core/modules/language/src/Plugin/migrate/process/ContentTranslationEnabledSetting.php
index 94faae1a061f..b506e93ef57e 100644
--- a/core/modules/language/src/Plugin/migrate/process/ContentTranslationEnabledSetting.php
+++ b/core/modules/language/src/Plugin/migrate/process/ContentTranslationEnabledSetting.php
@@ -32,7 +32,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
     switch ($language_content_type) {
       // In the case of being 0, it will be skipped. We are not actually setting
       // a null value.
-      case 0;
+      case 0:
         $setting = NULL;
         break;
 
diff --git a/core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php b/core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php
index 7b797b8e9678..cff84bc3fe11 100644
--- a/core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php
+++ b/core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php
@@ -292,7 +292,7 @@ protected function getNormalizedPatchEntity() {
    */
   protected function getExpectedUnauthorizedAccessMessage($method) {
     switch ($method) {
-      case 'GET';
+      case 'GET':
         return "The 'view media' permission is required when the media item is published.";
 
       case 'POST':
diff --git a/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php
index d1daeb11a541..d69e21862df6 100644
--- a/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php
+++ b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php
@@ -64,12 +64,12 @@ public function on403(ExceptionEvent $event): void {
     $redirect_url = NULL;
     if ($this->account->isAuthenticated()) {
       switch ($route_name) {
-        case 'user.login';
+        case 'user.login':
           // Redirect an authenticated user to the profile page.
           $redirect_url = Url::fromRoute('entity.user.canonical', ['user' => $this->account->id()], ['absolute' => TRUE]);
           break;
 
-        case 'user.register';
+        case 'user.register':
           // Redirect an authenticated user to the profile form.
           $redirect_url = Url::fromRoute('entity.user.edit_form', ['user' => $this->account->id()], ['absolute' => TRUE]);
           break;
diff --git a/core/modules/views/src/Plugin/views/sort/SortPluginBase.php b/core/modules/views/src/Plugin/views/sort/SortPluginBase.php
index eb6688a36d1e..18dc390c07cf 100644
--- a/core/modules/views/src/Plugin/views/sort/SortPluginBase.php
+++ b/core/modules/views/src/Plugin/views/sort/SortPluginBase.php
@@ -68,8 +68,8 @@ public function adminSummary() {
       default:
         return $this->t('asc');
 
-      case 'DESC';
-      case 'desc';
+      case 'DESC':
+      case 'desc':
         return $this->t('desc');
     }
   }
diff --git a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
index c628f661f397..fcdf72d1b8c3 100644
--- a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
+++ b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
@@ -86,7 +86,7 @@ protected function assertExtensionConfig(string $name, string $type): void {
         $file_name = DRUPAL_ROOT . '/core/modules/system/tests/modules/' . $name . '/' . $name . '.info.yml';
         break;
 
-      default;
+      default:
         $file_name = DRUPAL_ROOT . '/core/' . $type . 's/' . $name . '/' . $name . '.info.yml';
     }
 
-- 
GitLab