Replace json_decode($json, true) !== null && json_last_error() === JSON_ERROR_NONE with json_validate()
-if (json_decode($json, true) !== null && json_last_error() === JSON_ERROR_NONE) {
+if (json_validate($json)) {
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php83\Rector\BooleanAnd\JsonValidateRector;
return RectorConfig::configure()
->withRules([
JsonValidateRector::class,
]);