[HttpClientAssertionsTrait] rework function assertHttpClient…

by @cnicq-kiosc

Some issues have been detected in this pull request

Issues that can be fixed by applying a patch

Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:

curl https://fabbot.io/patch/symfony/symfony/58591/d850c1d8feade46401180d7d2eabd2d8666bf007/cs.diff | patch -p0
diff -ru src/Symfony/Bundle/FrameworkBundle/Test/HttpClientAssertionsTrait.php src/Symfony/Bundle/FrameworkBundle/Test/HttpClientAssertionsTrait.php
--- src/Symfony/Bundle/FrameworkBundle/Test/HttpClientAssertionsTrait.php	2024-10-18 08:36:46.943925986 +0000
+++ src/Symfony/Bundle/FrameworkBundle/Test/HttpClientAssertionsTrait.php	2024-10-18 08:36:47.958962491 +0000
@@ -31,10 +31,10 @@
 
         /** @var HttpClientDataCollector $httpClientDataCollector */
         $httpClientDataCollector = $profile->getCollector('http_client');
-        
+
         // Check if the specified HttpClient exists
         if (!\array_key_exists($httpClientId, $httpClientDataCollector->getClients())) {
-            static::fail(sprintf('HttpClient "%s" is not registered.', $httpClientId));
+            static::fail(\sprintf('HttpClient "%s" is not registered.', $httpClientId));
         }
 
         $expectedRequestHasBeenFound = false;
@@ -48,7 +48,7 @@
             }
 
             // Check body if expected
-            if ($expectedBody !== null) {
+            if (null !== $expectedBody) {
                 $actualBody = null;
 
                 // Handle different body formats (string, json)
@@ -88,7 +88,7 @@
         }
 
         // Assert that the expected request was found
-        self::assertTrue($expectedRequestHasBeenFound, 'The expected request has not been called: "' . $expectedMethod . '" - "' . $expectedUrl . '"');
+        self::assertTrue($expectedRequestHasBeenFound, 'The expected request has not been called: "'.$expectedMethod.'" - "'.$expectedUrl.'"');
     }
 
     public function assertNotHttpClientRequest(string $unexpectedUrl, string $expectedMethod = 'GET', string $httpClientId = 'http_client'): void

0
Common Typos

0
License Headers

0
Pull Request Contributor Headers

0
File Permissions

0
Merge Commits

0
Exception Messages Formatting

0
Usage of void in test files

0
Use ::class whenever possible

0
Deprecation Messages