diff --git a/composer.json b/composer.json index cf3a639..f421443 100644 --- a/composer.json +++ b/composer.json @@ -26,14 +26,15 @@ "require": { "php": "^7.4.0||^8.0", "guzzlehttp/guzzle": "^7.2", - "ext-json": "*" + "ext-json": "*", + "ext-mbstring": "*" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7", "php-vcr/php-vcr": "^1.5.2", "phpstan/phpstan": "^1.10", + "phpstan/phpstan-deprecation-rules": "^1.1", "phpunit/phpunit": "^9.0", - "symfony/var-dumper": "^4.2", "vlucas/phpdotenv": "^2.5" }, "autoload": { diff --git a/phpstan.neon b/phpstan.neon index 228341e..d8e1234 100755 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,6 @@ includes: - phpstan-baseline.neon + - vendor/phpstan/phpstan-deprecation-rules/rules.neon parameters: paths: diff --git a/src/Middleware/AuthMiddleware.php b/src/Middleware/AuthMiddleware.php index b337afe..ca8200b 100644 --- a/src/Middleware/AuthMiddleware.php +++ b/src/Middleware/AuthMiddleware.php @@ -109,7 +109,7 @@ private function makeSignatureString(string $signatureContentString) hash_hmac( static::SIGNATURE_ALGORITHM, $signatureContentString, - utf8_encode($this->apiSecret), + mb_convert_encoding($this->apiSecret, 'UTF-8', mb_detect_encoding($this->apiSecret)), true ) ); diff --git a/src/XCover.php b/src/XCover.php index 55e6222..032513b 100644 --- a/src/XCover.php +++ b/src/XCover.php @@ -5,8 +5,8 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\GuzzleException; +use GuzzleHttp\Utils; use GuzzleHttp\HandlerStack; -use Psr\Http\Message\ResponseInterface; use XCoverClient\Exceptions\ResponseException; use XCoverClient\Exceptions\XCoverException; use XCoverClient\Middleware\AuthMiddleware; @@ -50,7 +50,7 @@ public function __construct(Config $config, ClientInterface $client = null) public function call($method, $url, $expectedStatusCode = null, $payload = [], $queryParams = []) { $options = [ - 'body' => $payload ? \GuzzleHttp\json_encode($payload) : "{}", + 'body' => $payload ? Utils::jsonEncode($payload) : "{}", 'query' => $queryParams, ];