Skip to content

Commit a7e12d1

Browse files
committed
Merge branch '5.1' into 5.x
* 5.1: Add context for json encoding/decoding. Fix example in lock Fix small typo
2 parents dc08a5a + d47b5e1 commit a7e12d1

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
@@ -865,7 +865,13 @@ The ``JsonEncoder``
865865
~~~~~~~~~~~~~~~~~~~
866866

867867
The ``JsonEncoder`` encodes to and decodes from JSON strings, based on the PHP
868-
:phpfunction:`json_encode` and :phpfunction:`json_decode` functions.
868+
:phpfunction:`json_encode` and :phpfunction:`json_decode` functions. It can be
869+
useful to modify how these functions operate in certain instances by providing
870+
options such as ``JSON_PRESERVE_ZERO_FRACTION``. You can use the serialization
871+
context to pass in these options using the key ``json_encode_options`` or
872+
``json_decode_options`` respectively::
873+
874+
$this->serializer->serialize($data, 'json', ['json_encode_options' => \JSON_PRESERVE_ZERO_FRACTION]);
869875

870876
The ``CsvEncoder``
871877
~~~~~~~~~~~~~~~~~~~

lock.rst

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

209209
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
210-
use Symfony\Component\Lock\LockInterface;
210+
use Symfony\Component\Lock\LockFactory;
211211

212212
class PdfController extends AbstractController
213213
{

0 commit comments

Comments
 (0)