From 46a2192bab22e92bf6a1e9133858c392fd21ec1a Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Wed, 24 Apr 2024 17:26:24 +0100
Subject: [PATCH] Revert "Issue #3443049 by nicxvan, Arun.k: Remove
 deprecations in SiteConfigureForm"

This reverts commit a879c616818400028c67d6d98c27c0a035a141ad.
---
 .../Core/Installer/Form/SiteConfigureForm.php | 22 +++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
index 7951965f6a6f..c7fd96603f75 100644
--- a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
@@ -3,9 +3,11 @@
 namespace Drupal\Core\Installer\Form;
 
 use Drupal\Core\Datetime\TimeZoneFormHelper;
+use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
 use Drupal\Core\Extension\ModuleInstallerInterface;
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Locale\CountryManagerInterface;
 use Drupal\Core\Site\Settings;
 use Drupal\user\UserInterface;
 use Drupal\user\UserStorageInterface;
@@ -19,6 +21,17 @@
  */
 class SiteConfigureForm extends ConfigFormBase {
 
+  use DeprecatedServicePropertyTrait;
+
+  /**
+   * Defines deprecated injected properties.
+   *
+   * @var array
+   */
+  protected array $deprecatedProperties = [
+    'countryManager' => 'country_manager',
+  ];
+
   /**
    * The site path.
    *
@@ -58,7 +71,7 @@ class SiteConfigureForm extends ConfigFormBase {
    *   The user storage.
    * @param \Drupal\Core\Extension\ModuleInstallerInterface $module_installer
    *   The module installer.
-   * @param \Drupal\user\UserNameValidator $userNameValidator
+   * @param \Drupal\Core\Locale\CountryManagerInterface|\Drupal\user\UserNameValidator $userNameValidator
    *   The user validator.
    */
   public function __construct(
@@ -66,12 +79,17 @@ public function __construct(
     $site_path,
     UserStorageInterface $user_storage,
     ModuleInstallerInterface $module_installer,
-    protected UserNameValidator $userNameValidator,
+    protected CountryManagerInterface|UserNameValidator $userNameValidator,
   ) {
     $this->root = $root;
     $this->sitePath = $site_path;
     $this->userStorage = $user_storage;
     $this->moduleInstaller = $module_installer;
+    if ($userNameValidator instanceof CountryManagerInterface) {
+      @trigger_error('Calling ' . __METHOD__ . '() with the $userNameValidator argument as CountryManagerInterface is deprecated in drupal:10.3.0 and must be UserNameValidator in drupal:11.0.0. See https://www.drupal.org/node/3431205', E_USER_DEPRECATED);
+      $userNameValidator = \Drupal::service('user.name_validator');
+    }
+    $this->userNameValidator = $userNameValidator;
   }
 
   /**
-- 
GitLab