rector
rector copied to clipboard
[php 8.3] Add json_validate rule
$json = '{"key": "value"}';
-if (json_decode($json, true) !== null && json_last_error() === JSON_ERROR_NONE) {
+if (json_validate($json)) {
echo "Valid JSON";
}
json_validate seems has flags parameter, the change seems documented at https://php.watch/versions/8.3/json_validate for the transformation needs.
Downgrade first rule ready at:
- https://github.com/rectorphp/rector-downgrade-php/pull/313
implemented at PR
- https://github.com/rectorphp/rector-src/pull/7213