|
|
@@ -66,10 +66,10 @@ final class Utils
|
|
|
* Return the JSON representation of a value
|
|
|
*
|
|
|
* @param mixed $data
|
|
|
- * @param int $encodeFlags flags to pass to json encode, defaults to JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
|
|
|
+ * @param int $encodeFlags flags to pass to json encode, defaults to JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
|
|
|
* @param bool $ignoreErrors whether to ignore encoding errors or to throw on error, when ignored and the encoding fails, "null" is returned which is valid json for null
|
|
|
* @throws \RuntimeException if encoding fails and errors are not ignored
|
|
|
- * @return string when errors are ignored and the encoding fails, "null" is returned which is valid json for null
|
|
|
+ * @return string when errors are ignored and the encoding fails, "null" is returned which is valid json for null
|
|
|
*/
|
|
|
public static function jsonEncode($data, ?int $encodeFlags = null, bool $ignoreErrors = false): string
|
|
|
{
|
|
|
@@ -102,8 +102,8 @@ final class Utils
|
|
|
* initial error is not encoding related or the input can't be cleaned then
|
|
|
* raise a descriptive exception.
|
|
|
*
|
|
|
- * @param int $code return code of json_last_error function
|
|
|
- * @param mixed $data data that was meant to be encoded
|
|
|
+ * @param int $code return code of json_last_error function
|
|
|
+ * @param mixed $data data that was meant to be encoded
|
|
|
* @param int $encodeFlags flags to pass to json encode, defaults to JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION
|
|
|
* @throws \RuntimeException if failure can't be corrected
|
|
|
* @return string JSON encoded data after error correction
|