From 5aa70a9fc424aaa3b95a10911d970ca3424c7ee2 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Fri, 8 Sep 2023 11:30:24 +0100
Subject: [PATCH] Issue #3385095 by Spokje: Replace call to deprecated function
 GuzzleHttp\default_user_agent()

---
 core/lib/Drupal/Core/Http/ClientFactory.php | 3 ++-
 core/phpstan-baseline.neon                  | 8 --------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/core/lib/Drupal/Core/Http/ClientFactory.php b/core/lib/Drupal/Core/Http/ClientFactory.php
index e429bbb9cda4..950ebb9724a5 100644
--- a/core/lib/Drupal/Core/Http/ClientFactory.php
+++ b/core/lib/Drupal/Core/Http/ClientFactory.php
@@ -6,6 +6,7 @@
 use Drupal\Core\Site\Settings;
 use GuzzleHttp\Client;
 use GuzzleHttp\HandlerStack;
+use GuzzleHttp\Utils;
 
 /**
  * Helper class to construct a HTTP client with Drupal specific config.
@@ -49,7 +50,7 @@ public function fromOptions(array $config = []) {
       'verify' => TRUE,
       'timeout' => 30,
       'headers' => [
-        'User-Agent' => 'Drupal/' . \Drupal::VERSION . ' (+https://www.drupal.org/) ' . \GuzzleHttp\default_user_agent(),
+        'User-Agent' => 'Drupal/' . \Drupal::VERSION . ' (+https://www.drupal.org/) ' . Utils::defaultUserAgent(),
       ],
       'handler' => $this->stack,
       // Security consideration: prevent Guzzle from using environment variables
diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon
index 7857f7891789..52d14bd6a5e1 100644
--- a/core/phpstan-baseline.neon
+++ b/core/phpstan-baseline.neon
@@ -745,14 +745,6 @@ parameters:
 			count: 1
 			path: lib/Drupal/Core/Form/FormValidator.php
 
-		-
-			message: """
-				#^Call to deprecated function GuzzleHttp\\\\default_user_agent\\(\\)\\:
-				default_user_agent will be removed in guzzlehttp/guzzle\\:8\\.0\\. Use Utils\\:\\:defaultUserAgent instead\\.$#
-			"""
-			count: 1
-			path: lib/Drupal/Core/Http/ClientFactory.php
-
 		-
 			message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#"
 			count: 4
-- 
GitLab