diff --git a/HttpClientTrait.php b/HttpClientTrait.php index e150e56..51856da 100644 --- a/HttpClientTrait.php +++ b/HttpClientTrait.php @@ -343,11 +343,11 @@ private static function jsonEncode($value, int $flags = null, int $maxDepth = 51 try { $value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0), $maxDepth); } catch (\JsonException $e) { - throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', $e->getMessage())); + throw new InvalidArgumentException('Invalid value for "json" option: '.$e->getMessage()); } if (\PHP_VERSION_ID < 70300 && JSON_ERROR_NONE !== json_last_error() && (false === $value || !($flags & JSON_PARTIAL_OUTPUT_ON_ERROR))) { - throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', json_last_error_msg())); + throw new InvalidArgumentException('Invalid value for "json" option: '.json_last_error_msg()); } return $value; diff --git a/Response/ResponseTrait.php b/Response/ResponseTrait.php index f49ca68..de4d759 100644 --- a/Response/ResponseTrait.php +++ b/Response/ResponseTrait.php @@ -153,11 +153,11 @@ public function toArray(bool $throw = true): array try { $content = json_decode($content, true, 512, JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0)); } catch (\JsonException $e) { - throw new JsonException(sprintf('%s for "%s".', $e->getMessage(), $this->getInfo('url')), $e->getCode()); + throw new JsonException(sprintf($e->getMessage().' for "%s".', $this->getInfo('url')), $e->getCode()); } if (\PHP_VERSION_ID < 70300 && JSON_ERROR_NONE !== json_last_error()) { - throw new JsonException(sprintf('%s for "%s".', json_last_error_msg(), $this->getInfo('url')), json_last_error()); + throw new JsonException(sprintf(json_last_error_msg().' for "%s".', $this->getInfo('url')), json_last_error()); } if (!\is_array($content)) {