Skip to content

Commit 88d1745

Browse files
committed
Tweak the code to avoid fabbot false positives
1 parent c571fa9 commit 88d1745

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

HttpClientTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ private static function jsonEncode($value, int $flags = null, int $maxDepth = 51
343343
try {
344344
$value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0), $maxDepth);
345345
} catch (\JsonException $e) {
346-
throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', $e->getMessage()));
346+
throw new InvalidArgumentException('Invalid value for "json" option: '.$e->getMessage());
347347
}
348348

349349
if (\PHP_VERSION_ID < 70300 && JSON_ERROR_NONE !== json_last_error() && (false === $value || !($flags & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
350-
throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', json_last_error_msg()));
350+
throw new InvalidArgumentException('Invalid value for "json" option: '.json_last_error_msg());
351351
}
352352

353353
return $value;

Response/ResponseTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ public function toArray(bool $throw = true): array
153153
try {
154154
$content = json_decode($content, true, 512, JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0));
155155
} catch (\JsonException $e) {
156-
throw new JsonException(sprintf('%s for "%s".', $e->getMessage(), $this->getInfo('url')), $e->getCode());
156+
throw new JsonException(sprintf($e->getMessage().' for "%s".', $this->getInfo('url')), $e->getCode());
157157
}
158158

159159
if (\PHP_VERSION_ID < 70300 && JSON_ERROR_NONE !== json_last_error()) {
160-
throw new JsonException(sprintf('%s for "%s".', json_last_error_msg(), $this->getInfo('url')), json_last_error());
160+
throw new JsonException(sprintf(json_last_error_msg().' for "%s".', $this->getInfo('url')), json_last_error());
161161
}
162162

163163
if (!\is_array($content)) {

0 commit comments

Comments
 (0)