From 847ab04c929fde0cc82dbedf36bf270969d92098 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Sun, 19 Jun 2022 17:25:04 +0100
Subject: [PATCH] Issue #3276187 by mondrake, catch: Since symfony/routing 6.1:
 Construction of
 "Symfony\Component\Routing\Exception\MissingMandatoryParametersException"
 with an exception message is deprecated, provide the route name and an array
 of missing parameters instead

---
 core/.deprecation-ignore.txt                          | 1 -
 core/lib/Drupal/Core/Routing/UrlGenerator.php         | 2 +-
 core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/core/.deprecation-ignore.txt b/core/.deprecation-ignore.txt
index c4cdd883e8ea..e0e1c111a0b2 100644
--- a/core/.deprecation-ignore.txt
+++ b/core/.deprecation-ignore.txt
@@ -32,5 +32,4 @@
 %"PHPUnit\\TextUI\\DefaultResultPrinter".*is considered internal%
 
 # Symfony 6.1 deprecations.
-%Since symfony\/routing 6\.1: Construction of .*MissingMandatoryParametersException.* with an exception message is deprecated, provide the route name and an array of missing parameters instead%
 %Since symfony\/routing 6\.1: The .*UrlMatcher::handleRouteRequirements\(\).* method will have a new .*routeParameters.* argument in version 7\.0, not defining it is deprecated%
diff --git a/core/lib/Drupal/Core/Routing/UrlGenerator.php b/core/lib/Drupal/Core/Routing/UrlGenerator.php
index 185784db374d..7efa6b75b80c 100644
--- a/core/lib/Drupal/Core/Routing/UrlGenerator.php
+++ b/core/lib/Drupal/Core/Routing/UrlGenerator.php
@@ -178,7 +178,7 @@ protected function doGenerate(array $variables, array $defaults, array $tokens,
 
     // all params must be given
     if ($diff = array_diff_key($variables, $mergedParams)) {
-      throw new MissingMandatoryParametersException(sprintf('Some mandatory parameters are missing ("%s") to generate a URL for route "%s".', implode('", "', array_keys($diff)), $name));
+      throw new MissingMandatoryParametersException($name, array_keys($diff));
     }
 
     $url = '';
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
index 865779dc090c..2bd2e03755c5 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
@@ -407,7 +407,7 @@ public function testUriRelationships() {
     $url_generator->expects($this->any())
       ->method('generateFromRoute')
       ->with($route_name_1)
-      ->willThrowException(new MissingMandatoryParametersException());
+      ->willThrowException(new MissingMandatoryParametersException($route_name_1, ['missing_parameter']));
     $this->assertEquals([], $entity->uriRelationships());
   }
 
-- 
GitLab