Skip to content

Commit ba27b37

Browse files
committed
Remove unnecessary PHP 5.x compatibility code
1 parent f355a99 commit ba27b37

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/Json5Decoder.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,13 @@ public static function decode(string $json, ?bool $associative = false, int $dep
6969
{
7070
// Try parsing with json_decode first, since that's much faster
7171
// We only attempt this on PHP 7+ because 5.x doesn't parse some edge cases correctly
72-
if (PHP_VERSION_ID >= 70000) {
73-
try {
74-
$result = \json_decode($json, $associative, $depth, $flags);
75-
if (\json_last_error() === \JSON_ERROR_NONE) {
76-
return $result;
77-
}
78-
} catch (\Throwable $e) {
79-
// ignore exception, continue parsing as JSON5
72+
try {
73+
$result = \json_decode($json, $associative, $depth, $flags);
74+
if (\json_last_error() === \JSON_ERROR_NONE) {
75+
return $result;
8076
}
77+
} catch (\Throwable $e) {
78+
// ignore exception, continue parsing as JSON5
8179
}
8280

8381
// Fall back to JSON5 if that fails

0 commit comments

Comments
 (0)