Skip to content

Commit d47b5e1

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Add context for json encoding/decoding. Fix example in lock Fix small typo
2 parents c6ec372 + 501f388 commit d47b5e1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

components/serializer.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,13 @@ The ``JsonEncoder``
784784
~~~~~~~~~~~~~~~~~~~
785785

786786
The ``JsonEncoder`` encodes to and decodes from JSON strings, based on the PHP
787-
:phpfunction:`json_encode` and :phpfunction:`json_decode` functions.
787+
:phpfunction:`json_encode` and :phpfunction:`json_decode` functions. It can be
788+
useful to modify how these functions operate in certain instances by providing
789+
options such as ``JSON_PRESERVE_ZERO_FRACTION``. You can use the serialization
790+
context to pass in these options using the key ``json_encode_options`` or
791+
``json_decode_options`` respectively::
792+
793+
$this->serializer->serialize($data, 'json', ['json_encode_options' => \JSON_PRESERVE_ZERO_FRACTION]);
788794

789795
The ``CsvEncoder``
790796
~~~~~~~~~~~~~~~~~~~

lock.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ processes asking for the same ``$version``::
202202
namespace App\Controller;
203203

204204
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
205-
use Symfony\Component\Lock\LockInterface;
205+
use Symfony\Component\Lock\LockFactory;
206206

207207
class PdfController extends AbstractController
208208
{

0 commit comments

Comments
 (0)