diff --git a/src/Client.php b/src/Client.php index ac96104..1f77e18 100644 --- a/src/Client.php +++ b/src/Client.php @@ -108,9 +108,9 @@ public static function setHttp(HttpInterface $http): void /** * Set the user agent reported with API calls. * - * @param string|null $userAgent + * @param string $userAgent */ - public static function setUserAgent(?string $userAgent): void + public static function setUserAgent(string $userAgent): void { static::$userAgent = $userAgent; } @@ -132,7 +132,7 @@ private static function addAuthenticationOptions(array $options): array private static function addUserAgentOptions(array $options): array { - if (static::$userAgent === null) { + if (static::$userAgent === null || strlen(static::$userAgent) === 0) { return $options; } diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 5b4bf7a..c00501b 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -20,7 +20,7 @@ public function setup(): void public function tearDown(): void { - Client::setUserAgent(null); + Client::setUserAgent(''); } public function testAuthenticateWithCredentials()