Skip to content

Commit 20f3729

Browse files
Krisellbshaffer
authored andcommitted
Use json_last_error without unnecessary existence check (#263)
1 parent bc324de commit 20f3729

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/JWT.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public static function jsonDecode($input)
283283
$obj = json_decode($json_without_bigints);
284284
}
285285

286-
if (function_exists('json_last_error') && $errno = json_last_error()) {
286+
if ($errno = json_last_error()) {
287287
static::handleJsonError($errno);
288288
} elseif ($obj === null && $input !== 'null') {
289289
throw new DomainException('Null result with non-null input');
@@ -303,7 +303,7 @@ public static function jsonDecode($input)
303303
public static function jsonEncode($input)
304304
{
305305
$json = json_encode($input);
306-
if (function_exists('json_last_error') && $errno = json_last_error()) {
306+
if ($errno = json_last_error()) {
307307
static::handleJsonError($errno);
308308
} elseif ($json === 'null' && $input !== null) {
309309
throw new DomainException('Null result with non-null input');

0 commit comments

Comments
 (0)