From 6385a8fd92449300ceba143303a2c62e8316da52 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Mon, 7 Feb 2022 11:46:11 +0000
Subject: [PATCH] Issue #3261252 by andypost: Remove deprecated system.module
 functions

---
 .../src/Controller/SystemController.php       |  6 +---
 .../system/src/Form/ModulesUninstallForm.php  |  6 +---
 core/modules/system/system.module             | 13 --------
 .../src/Kernel/SystemDeprecationTest.php      | 33 -------------------
 4 files changed, 2 insertions(+), 56 deletions(-)
 delete mode 100644 core/modules/system/tests/src/Kernel/SystemDeprecationTest.php

diff --git a/core/modules/system/src/Controller/SystemController.php b/core/modules/system/src/Controller/SystemController.php
index 83b2bcce5794..db3f3d0bb81c 100644
--- a/core/modules/system/src/Controller/SystemController.php
+++ b/core/modules/system/src/Controller/SystemController.php
@@ -81,16 +81,12 @@ class SystemController extends ControllerBase {
    * @param \Drupal\Core\Extension\ModuleExtensionList $module_extension_list
    *   The module extension list.
    */
-  public function __construct(SystemManager $systemManager, ThemeAccessCheck $theme_access, FormBuilderInterface $form_builder, ThemeHandlerInterface $theme_handler, MenuLinkTreeInterface $menu_link_tree, ModuleExtensionList $module_extension_list = NULL) {
+  public function __construct(SystemManager $systemManager, ThemeAccessCheck $theme_access, FormBuilderInterface $form_builder, ThemeHandlerInterface $theme_handler, MenuLinkTreeInterface $menu_link_tree, ModuleExtensionList $module_extension_list) {
     $this->systemManager = $systemManager;
     $this->themeAccess = $theme_access;
     $this->formBuilder = $form_builder;
     $this->themeHandler = $theme_handler;
     $this->menuLinkTree = $menu_link_tree;
-    if ($module_extension_list === NULL) {
-      @trigger_error('The extension.list.module service must be passed to ' . __NAMESPACE__ . '\SystemController::__construct. It was added in Drupal 8.9.0 and will be required before Drupal 10.0.0.', E_USER_DEPRECATED);
-      $module_extension_list = \Drupal::service('extension.list.module');
-    }
     $this->moduleExtensionList = $module_extension_list;
   }
 
diff --git a/core/modules/system/src/Form/ModulesUninstallForm.php b/core/modules/system/src/Form/ModulesUninstallForm.php
index 0719511e8e21..f82da6ef403c 100644
--- a/core/modules/system/src/Form/ModulesUninstallForm.php
+++ b/core/modules/system/src/Form/ModulesUninstallForm.php
@@ -80,15 +80,11 @@ public static function create(ContainerInterface $container) {
    * @param \Drupal\Core\Update\UpdateHookRegistry|null $versioning_update_registry
    *   Versioning update registry service.
    */
-  public function __construct(ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, KeyValueStoreExpirableInterface $key_value_expirable, ModuleExtensionList $extension_list_module, UpdateHookRegistry $versioning_update_registry = NULL) {
+  public function __construct(ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, KeyValueStoreExpirableInterface $key_value_expirable, ModuleExtensionList $extension_list_module, UpdateHookRegistry $versioning_update_registry) {
     $this->moduleExtensionList = $extension_list_module;
     $this->moduleHandler = $module_handler;
     $this->moduleInstaller = $module_installer;
     $this->keyValueExpirable = $key_value_expirable;
-    if ($versioning_update_registry === NULL) {
-      @trigger_error('The update.update_hook_registry service must be passed to ' . __NAMESPACE__ . '\ModulesUninstallForm::__construct(). It was added in drupal:9.3.0 and will be required before drupal:10.0.0.', E_USER_DEPRECATED);
-      $versioning_update_registry = \Drupal::service('update.update_hook_registry');
-    }
     $this->updateRegistry = $versioning_update_registry;
   }
 
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 522159f005a9..8e67827c4dc4 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -890,19 +890,6 @@ function system_region_list($theme, $show = REGIONS_ALL) {
   return $list;
 }
 
-/**
- * Array sorting callback; sorts modules by their name.
- *
- * @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
- *   \Drupal\Core\Extension\ExtensionList::sortByName() instead.
- *
- * @see https://www.drupal.org/node/3225999
- */
-function system_sort_modules_by_info_name($a, $b) {
-  @trigger_error('system_sort_modules_by_info_name() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Extension\ExtensionList::sortByName() instead. See https://www.drupal.org/node/3225999', E_USER_DEPRECATED);
-  return strcasecmp($a->info['name'], $b->info['name']);
-}
-
 /**
  * Sorts themes by their names, with the default theme listed first.
  *
diff --git a/core/modules/system/tests/src/Kernel/SystemDeprecationTest.php b/core/modules/system/tests/src/Kernel/SystemDeprecationTest.php
deleted file mode 100644
index 1c0ade988fd1..000000000000
--- a/core/modules/system/tests/src/Kernel/SystemDeprecationTest.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-namespace Drupal\Tests\system\Kernel;
-
-use Drupal\KernelTests\KernelTestBase;
-
-/**
- * @group system
- * @group legacy
- */
-class SystemDeprecationTest extends KernelTestBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  protected static $modules = ['system', 'user'];
-
-  /**
-   * @see system_sort_modules_by_info_name()
-   */
-  public function testSystemSortModulesByInfoName() {
-    $module_info = \Drupal::service('extension.list.module')->getAllInstalledInfo();
-    $to_sort = [
-      'user' => (object) ['info' => $module_info['user']],
-      'system' => (object) ['info' => $module_info['system']],
-    ];
-
-    $this->expectDeprecation('system_sort_modules_by_info_name() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Extension\ExtensionList::sortByName() instead. See https://www.drupal.org/node/3225999');
-    uasort($to_sort, 'system_sort_modules_by_info_name');
-    $this->assertSame(['system', 'user'], array_keys($to_sort));
-  }
-
-}
-- 
GitLab