Skip to content

Commit 0381718

Browse files
committed
Remove now unecessary fallback to json_decode
Since PHP 8.3, we don't need that fallback anymore. Now that the library is set to a minimum PHP 8.5, we can safely remove it.
1 parent bee97ae commit 0381718

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/Validators/Json.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,9 @@
2323
use Respect\Validation\Message\Template;
2424
use Respect\Validation\Validators\Core\Simple;
2525

26-
use function function_exists;
2726
use function is_string;
28-
use function json_decode;
29-
use function json_last_error;
3027
use function json_validate;
3128

32-
use const JSON_ERROR_NONE;
33-
3429
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
3530
#[Template(
3631
'{{subject}} must be a valid JSON string',
@@ -44,12 +39,6 @@ public function isValid(mixed $input): bool
4439
return false;
4540
}
4641

47-
if (function_exists('json_validate')) {
48-
return json_validate($input);
49-
}
50-
51-
json_decode($input);
52-
53-
return json_last_error() === JSON_ERROR_NONE;
42+
return json_validate($input);
5443
}
5544
}

0 commit comments

Comments
 (0)