From 61fb2169e9081173a9951af18c54a41b4c8f247d Mon Sep 17 00:00:00 2001 From: ignace nyamagana butera Date: Sun, 24 Nov 2024 16:12:20 +0100 Subject: [PATCH] Fix Json addition --- CHANGELOG.md | 7 +++---- docs/9.0/converter/json.md | 7 +++---- src/JsonConverter.php | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5149ca96..ecf75a54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ All Notable changes to `Csv` will be documented in this file ### Added -- None +- `JsonConverter::withPrettyPrint` now accepts an optional `$identSize` parameter as its unique parameter. ### Deprecated @@ -14,9 +14,8 @@ All Notable changes to `Csv` will be documented in this file ### Fixed -- `JsonConverter::withPrettyPrint` now accepts the `$identSize` as its unique parameter. -- Adding support for `callable` in the `Query\Constraint` namespace. -- `HttpHeaders::forFileDownload` to be inline with RFC2183 and Header name and value best practices. +- Adding forgotten support for `callable` in the `Query\Constraint` namespace. +- Fix `HttpHeaders::forFileDownload` to be inline with RFC2183 and HTTP field name and value best practices. ### Remove diff --git a/docs/9.0/converter/json.md b/docs/9.0/converter/json.md index b2104973..d074b013 100644 --- a/docs/9.0/converter/json.md +++ b/docs/9.0/converter/json.md @@ -69,7 +69,7 @@ $converter->useHexQuot(); // returns false the flag is not used $converter->flags; //returns the actual flags value (as used by json_encode) ``` -

Starting with version 9.18.1 use +

Starting with version 9.19.0 use JsonConverter::withPrettyPrint to directly set the indent size with the argument $identSize to its call

@@ -96,7 +96,7 @@ $converter->depth; //returns the actual depth value (as used by json_encode) ### Json encode indentation -

This method is deprecated as of version 9.18.1 use +

This method is deprecated as of version 9.19.0 use JsonConverter::withPrettyPrint instead and add the $identSize argument to its call

@@ -170,10 +170,9 @@ $document->setHeaderOffset(0); CharsetConverter::addTo($document, 'iso-8859-15', 'utf-8'); $converter = JsonConverter::create() - ->withPrettyPrint() + ->withPrettyPrint(2) ->withUnescapedSlashes() ->depth(2) - ->indentSize(2) ->formatter(function (array $row) { $row['nombre'] = (int) $row['nombre']; $row['annee'] = (int) $row['annee']; diff --git a/src/JsonConverter.php b/src/JsonConverter.php index 2ba87846..6223f31c 100644 --- a/src/JsonConverter.php +++ b/src/JsonConverter.php @@ -488,14 +488,14 @@ public function convert(iterable $records): Iterator * DEPRECATION WARNING! This method will be removed in the next major point release. * * @see JsonConverter::withPrettyPrint() - * @deprecated Since version 9.18.1 + * @deprecated Since version 9.19.0 * @codeCoverageIgnore * * Set the indentation size. * * @param int<1, max> $indentSize */ - #[Deprecated(message:'use League\Csv\JsonConverter::withPrettyPrint() instead', since:'league/csv:9.18.1')] + #[Deprecated(message:'use League\Csv\JsonConverter::withPrettyPrint() instead', since:'league/csv:9.19.0')] public function indentSize(int $indentSize): self { return match ($indentSize) {