Debian Codegraph @

lib/3rdParty/composer/symfony/serializer/Context/SerializerContextBuilder.php

raw symbols SCIP
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Serializer\Context;
13
14 use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
15 use Symfony\Component\Serializer\Serializer;
16
17 /**
18 * A helper providing autocompletion for available Serializer options.
19 *
20 * @author Mathias Arlaud <[email protected]>
21 */
22 final class SerializerContextBuilder implements ContextBuilderInterface
23 {
24 use ContextBuilderTrait;
25
26 /**
27 * Configures whether an empty array should be transformed to an
28 * object (in JSON: {}) or to a list (in JSON: []).
29 */
30 public function withEmptyArrayAsObject(?bool $emptyArrayAsObject): static
31 {
32 return $this->with(Serializer::EMPTY_ARRAY_AS_OBJECT, $emptyArrayAsObject);
33 }
34
35 public function withCollectDenormalizationErrors(?bool $collectDenormalizationErrors): static
36 {
37 return $this->with(DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS, $collectDenormalizationErrors);
38 }
39 }