From 690d040fec9dd9ef3244e441e9a3f5abbc63c091 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Wed, 16 Nov 2022 11:38:47 +0000
Subject: [PATCH] Issue #3319794 by effulgentsia, Anchal_gupta, longwave, xjm:
 Update to Symfony 6.2 RC or update drupal/recommended-project creation and
 testMinimumStabilityStrictness() to allow minimum-stability to be less stable
 than core's stability

---
 composer/Composer.php                                 |  7 +++++++
 composer/Generator/ComponentGenerator.php             |  7 +++++++
 .../Template/ComposerProjectTemplatesTest.php         | 11 ++++++++++-
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/composer/Composer.php b/composer/Composer.php
index bdf53cfad137..1c868ccac0de 100644
--- a/composer/Composer.php
+++ b/composer/Composer.php
@@ -85,6 +85,13 @@ public static function setDrupalVersion(string $root, string $version): void {
   protected static function setTemplateProjectStability(string $root, string $version): void {
     $stability = VersionParser::parseStability($version);
 
+    // Drupal 10.0.0-RC1 is being released before Symfony 6.2.0-RC1, so
+    // temporarily set the stability to beta instead of RC.
+    // @todo Remove this after Symfony 6.2.0-RC1 is released.
+    if (str_starts_with($version, '10.0.0-') && ($stability === 'RC')) {
+      $stability = 'beta';
+    }
+
     $templateProjectPaths = static::composerSubprojectPaths($root, 'Template');
     foreach ($templateProjectPaths as $path) {
       $dir = dirname($path);
diff --git a/composer/Generator/ComponentGenerator.php b/composer/Generator/ComponentGenerator.php
index c82468cbe7b0..dc521d954c70 100644
--- a/composer/Generator/ComponentGenerator.php
+++ b/composer/Generator/ComponentGenerator.php
@@ -150,6 +150,13 @@ protected function getPackage(IOInterface $io, string $original_json): array {
 
     $stability = VersionParser::parseStability(\Drupal::VERSION);
 
+    // Drupal 10.0.0-RC1 is being released before Symfony 6.2.0-RC1, so
+    // temporarily set the stability to beta instead of RC.
+    // @todo Remove this after Symfony 6.2.0-RC1 is released.
+    if (str_starts_with(\Drupal::VERSION, '10.0.0-') && ($stability === 'RC')) {
+      $stability = 'beta';
+    }
+
     // List of packages which we didn't find in either core requirement.
     $not_in_core = [];
 
diff --git a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
index 4faf4c72c967..f24a2b53e3ea 100644
--- a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
+++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
@@ -86,10 +86,19 @@ public function provideTemplateCreateProject() {
    * Make sure that static::MINIMUM_STABILITY is sufficiently strict.
    */
   public function testMinimumStabilityStrictness() {
+    $minimum_minimum_stability = $this->getCoreStability();
+
+    // Drupal 10.0.0-RC1 is being released before Symfony 6.2.0-RC1, so
+    // temporarily set minimum_minimum_stability to beta instead of RC.
+    // @todo Remove this after Symfony 6.2.0-RC1 is released.
+    if (str_starts_with(\Drupal::VERSION, '10.0.0-') && ($minimum_minimum_stability === 'RC')) {
+      $minimum_minimum_stability = 'beta';
+    }
+
     // Ensure that static::MINIMUM_STABILITY is not less stable than the
     // current core stability. For example, if we've already released a beta on
     // the branch, ensure that we no longer allow alpha dependencies.
-    $this->assertGreaterThanOrEqual(array_search($this->getCoreStability(), static::STABILITY_ORDER), array_search(static::MINIMUM_STABILITY, static::STABILITY_ORDER));
+    $this->assertGreaterThanOrEqual(array_search($minimum_minimum_stability, static::STABILITY_ORDER), array_search(static::MINIMUM_STABILITY, static::STABILITY_ORDER));
 
     // Ensure that static::MINIMUM_STABILITY is the same as the least stable
     // dependency.
-- 
GitLab