Run Rector on your code to see what it can do for you:
<?php -if (json_decode($json, true) !== null && json_last_error() === JSON_ERROR_NONE){ +if (json_validate($json, true)){ echo 1; } -if (json_decode(associative: true, json: $json) !== null && json_last_error() === JSON_ERROR_NONE){ +if (json_validate(associative: true, json: $json)){ echo 1; }
Applied Rules:
Not a change you expect?
rector.php