prefix
stringlengths
512
512
suffix
stringlengths
256
256
middle
stringlengths
14
229
meta
dict
e Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Serializer\Attribute\Ignore; use Symfony\Component\Serializer\Attribute\MaxDepth; use Symfony\Component\Serializer\Attribute\SerializedName; use Symfony\Component\Serializer\Attribute\SerializedPath; use Symfony\Component\Serializer\Exception\Mappin...
dre Daubois <alex.daubois@gmail.com> */ class AttributeLoader implements LoaderInterface { use AccessorCollisionResolverTrait; private const KNOWN_ATTRIBUTES = [ DiscriminatorMap::class, Groups::class, Ignore::class,
iminatorMapping; use Symfony\Component\Serializer\Mapping\ClassMetadataInterface; /** * Loader for PHP attributes. * * @author Kévin Dunglas <dunglas@gmail.com> * @author Alexander M. Turek <me@derrabus.de> * @author Alexan
{ "filepath": "src/Symfony/Component/Serializer/Mapping/Loader/AttributeLoader.php", "language": "php", "file_size": 11390, "cut_index": 921, "middle_length": 229 }
?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Mapping\Loader; use Symfony\Component\Seria...
if (!is_file($file)) { throw new MappingException(\sprintf('The mapping file "%s" does not exist.', $file)); } if (!is_readable($file)) { throw new MappingException(\sprintf('The mapping file "%s" is not re
/** * @param string $file The mapping file to load * * @throws MappingException if the mapping file does not exist or is not readable */ public function __construct( protected string $file, ) {
{ "filepath": "src/Symfony/Component/Serializer/Mapping/Loader/FileLoader.php", "language": "php", "file_size": 1036, "cut_index": 513, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Mapping\Loader; use Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException; use Symfony\Component\PropertyAccess\PropertyPath; use Symfony\Component\Serializer\Exception\MappingException; use Symfony\Component\Serializer\Mapping\...
array> */ private ?array $classes = null; public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool { if (!$this->classes ??= $this->getClassesFromYaml()) { return false; } if (!is
ymfony\Component\Yaml\Yaml; /** * YAML File Loader. * * @author Kévin Dunglas <dunglas@gmail.com> */ class YamlFileLoader extends FileLoader { private ?Parser $yamlParser = null; /** * @var array<class-string,
{ "filepath": "src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php", "language": "php", "file_size": 7182, "cut_index": 716, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Mapping\Factory; use Psr\Cache\CacheItemPoolInterface; use Symfony\...
donly ClassMetadataFactoryInterface $decorated, private readonly CacheItemPoolInterface $cacheItemPool, ) { } public function getMetadataFor(string|object $value): ClassMetadataInterface { $class = $this->getClass($value);
mplements ClassMetadataFactoryInterface { use ClassResolverTrait; /** * @var array<string, ClassMetadataInterface> */ private array $loadedClasses = []; public function __construct( private rea
{ "filepath": "src/Symfony/Component/Serializer/Mapping/Factory/CacheClassMetadataFactory.php", "language": "php", "file_size": 1661, "cut_index": 537, "middle_length": 229 }
?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Mapping\Factory; use Symfony\Component\Seri...
if (!class_exists($value) && !interface_exists($value, false)) { throw new InvalidArgumentException(\sprintf('The class or interface "%s" does not exist.', $value)); } return ltrim($value, '\\'); }
lass name for a given class or instance. * * @throws InvalidArgumentException If the class does not exist */ private function getClass(object|string $value): string { if (\is_string($value)) {
{ "filepath": "src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php", "language": "php", "file_size": 1036, "cut_index": 513, "middle_length": 229 }
onent\Serializer\NameConverter\NameConverterInterface; use Symfony\Component\TypeInfo\Exception\LogicException as TypeInfoLogicException; use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\Type\BuiltinType; use Symfony\Component\TypeInfo\Type\CollectionType; use Symfony\Component\TypeInfo\Type\Intersec...
alizer dealing with objects. * * @author Kévin Dunglas <dunglas@gmail.com> */ abstract class AbstractObjectNormalizer extends AbstractNormalizer { /** * Set to true to respect the max depth metadata on fields. */ public const ENABLE_MA
rappingTypeInterface; use Symfony\Component\TypeInfo\TypeContext\TypeContextFactory; use Symfony\Component\TypeInfo\TypeIdentifier; use Symfony\Component\TypeInfo\TypeResolver\ReflectionTypeResolver; /** * Base class for a norm
{ "filepath": "src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php", "language": "php", "file_size": 46380, "cut_index": 2151, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Normalizer; use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Exception\NotNormalizableValue...
?string $format): array { return [ \BackedEnum::class => true, ]; } public function normalize(mixed $data, ?string $format = null, array $context = []): int|string { if (!$data instanceof \BackedEnum) {
ts NormalizerInterface, DenormalizerInterface { /** * If true, will denormalize any invalid value into null. */ public const ALLOW_INVALID_VALUES = 'allow_invalid_values'; public function getSupportedTypes(
{ "filepath": "src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php", "language": "php", "file_size": 3476, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Normalizer; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; use Symfony\Component\Validator\ConstraintViolationListInterface; /** * A normalizer that normalizes a ConstraintViolationListInterface instance. * * This Norm...
DS = 'payload_fields'; public function __construct( private readonly array $defaultContext = [], private readonly ?NameConverterInterface $nameConverter = null, ) { } public function getSupportedTypes(?string $format): arr
tViolationListNormalizer implements NormalizerInterface { public const INSTANCE = 'instance'; public const STATUS = 'status'; public const TITLE = 'title'; public const TYPE = 'type'; public const PAYLOAD_FIEL
{ "filepath": "src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php", "language": "php", "file_size": 5873, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Context\Encoder; use Symfony\Component\Serializer\Context\ContextBuilderInterface; use Symfony\Component\Serializer\Context\ContextBuilderTrait; use Symfony\Component\Serializer\Encoder\XmlEncoder; /** * A helper providing autocompletion for av...
mlEncoder::AS_COLLECTION, $asCollection); } /** * Configures node types to ignore while decoding. * * @see https://php.net/dom.constants * * @param list<int>|null $decoderIgnoredNodeTypes */ public function withDe
/** * Configures whether the decoded result should be considered as a collection * or as a single element. */ public function withAsCollection(?bool $asCollection): static { return $this->with(X
{ "filepath": "src/Symfony/Component/Serializer/Context/Encoder/XmlEncoderContextBuilder.php", "language": "php", "file_size": 5307, "cut_index": 716, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Attribute; use Symfony\Component\Serializer\Exception\InvalidArgume...
defaultType The fallback value if nothing specified by $typeProperty * * @throws InvalidArgumentException */ public function __construct( public readonly string $typeProperty, public readonly array $mapping, publ
perty The property holding the type discriminator * @param array<string, class-string> $mapping The mapping between types and classes (i.e. ['admin_user' => AdminUser::class]) * @param ?string $
{ "filepath": "src/Symfony/Component/Serializer/Attribute/DiscriminatorMap.php", "language": "php", "file_size": 1690, "cut_index": 537, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Attribute; /** * Declares that serialization a...
all of them). * * @author Nicolas Grekas <p@tchwork.com> */ #[\Attribute(\Attribute::TARGET_CLASS)] final class ExtendsSerializationFor { /** * @param class-string $class */ public function __construct( public string $class,
t necessarily
{ "filepath": "src/Symfony/Component/Serializer/Attribute/ExtendsSerializationFor.php", "language": "php", "file_size": 801, "cut_index": 517, "middle_length": 14 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Attribute; use Symfony\Component\PropertyAccess\...
valid PropertyAccess syntax where the value is stored in a normalized representation */ public function __construct(string $serializedPath) { try { $this->serializedPath = new PropertyPath($serializedPath); } catch
obi@boenner.family> */ #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)] class SerializedPath { public readonly PropertyPath $serializedPath; /** * @param string $serializedPath A path using a
{ "filepath": "src/Symfony/Component/Serializer/Attribute/SerializedPath.php", "language": "php", "file_size": 1184, "cut_index": 518, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Mapping; /** * @author Samuel Roze <samuel.roze@gmail.com> */ cla...
rn -1; } if (is_a($b, $a, true)) { return 1; } return 0; }); } public function getTypeProperty(): string { return $this->typeProperty; } public function
array $typesMapping = [], private readonly ?string $defaultType = null, ) { uasort($this->typesMapping, static function (string $a, string $b): int { if (is_a($a, $b, true)) { retu
{ "filepath": "src/Symfony/Component/Serializer/Mapping/ClassDiscriminatorMapping.php", "language": "php", "file_size": 1590, "cut_index": 537, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Mapping\Loader; use Symfony\Component\Serializer\Attribute\Ignore; /** * Provides methods to detect accessor name collisions during serializat...
l, 'h' => str_starts_with($methodName, 'has') ? 3 : null, 'c' => str_starts_with($methodName, 'can') ? 3 : null, 'i' => str_starts_with($methodName, 'is') ? 2 : null, default => null, }; // c
{ $methodName = $method->name; $i = match ($methodName[0]) { 's' => $andMutator && str_starts_with($methodName, 'set') ? 3 : null, 'g' => str_starts_with($methodName, 'get') ? 3 : nul
{ "filepath": "src/Symfony/Component/Serializer/Mapping/Loader/AccessorCollisionResolverTrait.php", "language": "php", "file_size": 3387, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Mapping\Loader; use Symfony\Component\Config\Util\XmlUtils; use Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException; use Symfony\Component\PropertyAccess\PropertyPath; use Symfony\Component\Serializer\Exception\MappingExceptio...
ing, \SimpleXMLElement>|null */ private ?array $classes = null; public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool { if (!$this->classes ??= $this->getClassesFromXml()) { return false;
ce; /** * Loads XML mapping files. * * @author Kévin Dunglas <dunglas@gmail.com> */ class XmlFileLoader extends FileLoader { /** * An array of {@class \SimpleXMLElement} instances. * * @var array<class-str
{ "filepath": "src/Symfony/Component/Serializer/Mapping/Loader/XmlFileLoader.php", "language": "php", "file_size": 6469, "cut_index": 716, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Mapping\Factory; use Symfony\Component\Serializer\Exception\Invalid...
ith a cache, this method will first look * for an existing metadata instance in the cache. If an existing instance * is found, it will be returned without further ado. * * Otherwise, a new metadata instance is created. If the factory wa
ce ClassMetadataFactoryInterface { /** * If the method was called with the same class name (or an object of that * class) before, the same metadata instance is returned. * * If the factory was configured w
{ "filepath": "src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactoryInterface.php", "language": "php", "file_size": 1512, "cut_index": 537, "middle_length": 229 }
face; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; use Symfony\Component\Serializer\SerializerAwareInterface; use Symfony\Component\Serializer\SerializerAwareTrait; /** * Normalizer implementation. * * @author ...
ct a * second time, we consider that a circular reference. * * You can raise this value for special cases, e.g. in combination with the * max depth setting of the object normalizer. */ public const CIRCULAR_REFERENCE_LIMIT = 'c
SerializerAwareTrait; /* constants to configure the context */ /** * How many loops of circular reference to allow while normalizing. * * The default value of 1 means that when we encounter the same obje
{ "filepath": "src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php", "language": "php", "file_size": 26864, "cut_index": 1331, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Context\Encoder; use Symfony\Component\Serializer\Context\ContextBu...
or Mathias Arlaud <mathias.arlaud@gmail.com> */ final class YamlEncoderContextBuilder implements ContextBuilderInterface { use ContextBuilderTrait; /** * Configures the threshold to switch to inline YAML. */ public function withInli
autocompletion for available YamlEncoder options. * * Note that the "indentation" setting is not offered in this builder because * it can only be set during the construction of the YamlEncoder, but not per * call. * * @auth
{ "filepath": "src/Symfony/Component/Serializer/Context/Encoder/YamlEncoderContextBuilder.php", "language": "php", "file_size": 1955, "cut_index": 537, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Attribute; use Symfony\Component\Serializer\Exception\InvalidArgume...
ed> $normalizationContext The context to use when serializing * @param array<string, mixed> $denormalizationContext The context to use when deserializing * @param string|string[] $groups The groups to use when serializing o
e::IS_REPEATABLE)] class Context { public readonly array $groups; /** * @param array<string, mixed> $context The common context to use when serializing or deserializing * @param array<string, mix
{ "filepath": "src/Symfony/Component/Serializer/Attribute/Context.php", "language": "php", "file_size": 1983, "cut_index": 537, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Mapping; use Symfony\Component\PropertyAccess\PropertyPath; /** * Stores metadata needed fo...
g $group): void; /** * Gets groups of this attribute. * * @return string[] */ public function getGroups(): array; /** * Sets the serialization max depth for this attribute. */ public function setMaxDepth(?int
*/ interface AttributeMetadataInterface { /** * Gets the attribute name. */ public function getName(): string; /** * Adds this attribute to the given group. */ public function addGroup(strin
{ "filepath": "src/Symfony/Component/Serializer/Mapping/AttributeMetadataInterface.php", "language": "php", "file_size": 2986, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Mapping; use Symfony\Component\PropertyAccess\PropertyPath; /** * @author Kévin Dunglas <dunglas@gmail.com> * * @final */ class AttributeMetadata implements AttributeMetadataInterface { private string $name; private array $groups = [...
private array $denormalizationContexts = []; public function __construct(string $name) { $this->name = $name; } public function getName(): string { return $this->name; } public function addGroup(string $gr
[] Normalization contexts per group name ("*" applies to all groups) */ private array $normalizationContexts = []; /** * @var array[] Denormalization contexts per group name ("*" applies to all groups) */
{ "filepath": "src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php", "language": "php", "file_size": 5128, "cut_index": 716, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Mapping\Loader; use Symfony\Component\Serializer\Exception\MappingE...
or Bernhard Schussek <bschussek@gmail.com> * @author Kévin Dunglas <dunglas@gmail.com> */ class LoaderChain implements LoaderInterface { /** * Accepts a list of LoaderInterface instances. * * @param LoaderInterface[] $loaders An array
oaderInterface to be passed to the * constructor. When {@link loadClassMetadata()} is called, the same method is called * in <em>all</em> of these loaders, regardless of whether any of them was * successful or not. * * @auth
{ "filepath": "src/Symfony/Component/Serializer/Mapping/Loader/LoaderChain.php", "language": "php", "file_size": 1896, "cut_index": 537, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Normalizer; use Symfony\Component\Serializer\Exception\BadMethodCallException; use Symfony\Component\Serializer\Exception\InvalidArgumentExcepti...
alizerInterface, DenormalizerAwareInterface { use DenormalizerAwareTrait; public function getSupportedTypes(?string $format): array { return ['object' => null, '*' => false]; } /** * @throws NotNormalizableValueException
omponent\TypeInfo\Type\UnionType; use Symfony\Component\TypeInfo\TypeIdentifier; /** * Denormalizes arrays of objects. * * @author Alexander M. Turek <me@derrabus.de> * * @final */ class ArrayDenormalizer implements Denorm
{ "filepath": "src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php", "language": "php", "file_size": 4521, "cut_index": 614, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Context\Encoder; use Symfony\Component\Serializer\Context\ContextBu...
it; /** * Configures the json_encode flags bitmask. * * @see https://php.net/json.constants * * @param positive-int|null $options */ public function withEncodeOptions(?int $options): static { return $this-
A helper providing autocompletion for available JsonEncoder options. * * @author Mathias Arlaud <mathias.arlaud@gmail.com> */ final class JsonEncoderContextBuilder implements ContextBuilderInterface { use ContextBuilderTra
{ "filepath": "src/Symfony/Component/Serializer/Context/Encoder/JsonEncoderContextBuilder.php", "language": "php", "file_size": 1947, "cut_index": 537, "middle_length": 229 }
he Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Attribute; use Symfony\Component\Serializer\Exception\InvalidArgumentExceptio...
be serialized */ public function __construct( public readonly string $serializedName, ) { if ('' === $serializedName) { throw new InvalidArgumentException(\sprintf('Parameter given to "%s" must be a non-empty strin
$serializedName The name of the property as it will
{ "filepath": "src/Symfony/Component/Serializer/Attribute/SerializedName.php", "language": "php", "file_size": 893, "cut_index": 547, "middle_length": 52 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Attribute; use Symfony\Component\Serializer\Exce...
ps) { $this->groups = (array) $groups; if (!$this->groups) { throw new InvalidArgumentException(\sprintf('Parameter given to "%s" cannot be empty.', static::class)); } foreach ($this->groups as $group) {
oups { /** * @var string[] */ public readonly array $groups; /** * @param string|string[] $groups The groups to define on the attribute target */ public function __construct(string|array $grou
{ "filepath": "src/Symfony/Component/Serializer/Attribute/Groups.php", "language": "php", "file_size": 1245, "cut_index": 518, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Mapping\Factory; use Symfony\Component\Serializer\Mapping\ClassMeta...
asses; public function __construct( private readonly LoaderInterface $loader, ) { } public function getMetadataFor(string|object $value): ClassMetadataInterface { $class = $this->getClass($value); if (isset($t
évin Dunglas <dunglas@gmail.com> */ class ClassMetadataFactory implements ClassMetadataFactoryInterface { use ClassResolverTrait; /** * @var array<string, ClassMetadataInterface> */ private array $loadedCl
{ "filepath": "src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php", "language": "php", "file_size": 1958, "cut_index": 537, "middle_length": 229 }
e' => 'Foo.php', 'file' => 'src/Foo.php', 'line' => 123]; $dataCollector->collectSerialize('traceIdOne', 'data', 'format', ['foo' => 'bar'], 1.0, $caller, 'default'); $dataCollector->collectDeserialize('traceIdTwo', 'data', 'type', 'format', ['foo' => 'bar'], 1.0, $caller, 'default'); $dataColl...
ler, 'name' => 'default', ]], $collectedData['serialize']); $this->assertSame([[ 'data' => 'data', 'dataType' => 'string', 'type' => 'type', 'format' => 'format', 'tim
g', 'type' => null, 'format' => 'format', 'time' => 1.0, 'context' => ['foo' => 'bar'], 'normalization' => [], 'encoding' => [], 'caller' => $cal
{ "filepath": "src/Symfony/Component/Serializer/Tests/DataCollector/SerializerDataCollectorTest.php", "language": "php", "file_size": 22436, "cut_index": 1331, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Context\Encoder; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Context\E...
lic function testWithers(array $values) { $context = $this->contextBuilder ->withAsCollection($values[XmlEncoder::AS_COLLECTION]) ->withDecoderIgnoredNodeTypes($values[XmlEncoder::DECODER_IGNORED_NODE_TYPES])
estCase { private XmlEncoderContextBuilder $contextBuilder; protected function setUp(): void { $this->contextBuilder = new XmlEncoderContextBuilder(); } #[DataProvider('withersDataProvider')] pub
{ "filepath": "src/Symfony/Component/Serializer/Tests/Context/Encoder/XmlEncoderContextBuilderTest.php", "language": "php", "file_size": 3837, "cut_index": 614, "middle_length": 229 }
file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Serializer\Normalizer...
supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof \stdClass; } public function getSupportedTypes(?string $format): array { return [ \stdClass::class
return 'string_object'; } public function
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/StdClassNormalizer.php", "language": "php", "file_size": 865, "cut_index": 529, "middle_length": 52 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; class VoidNeverReturnTypeDummy {...
ception('Never returns'); } public function setValue(): void { // This looks like a setter but has no parameters, should be ignored as accessor } public function setNeverValue(): never { // This looks like a setter
{ // This looks like a getter but returns void, should be ignored } public function getNeverProperty(): never { // This looks like a getter but returns never, should be ignored throw new \Ex
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/VoidNeverReturnTypeDummy.php", "language": "php", "file_size": 1131, "cut_index": 518, "middle_length": 229 }
file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures\Attributes; use Symfony\Component\Serializer...
{ parent::__construct($foo); $this->bar = $bar; } public function getQuux(): ?DummyFirstChildQuux { return $this->quux; } public function setQuux(DummyFirstChildQuux $quux): void { $this->quux
ublic function __construct($foo = null, $bar = null)
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/Attributes/AbstractDummyFirstChild.php", "language": "php", "file_size": 855, "cut_index": 529, "middle_length": 52 }
is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures\Attributes; use Symfony\Component\Serializer\Tests...
t::__construct($foo); $this->baz = $baz; } public function getQuux(): ?DummySecondChildQuux { return $this->quux; } public function setQuux(DummySecondChildQuux $quux): void { $this->quux = $quux; } }
struct($foo = null, $baz = null) { paren
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/Attributes/AbstractDummySecondChild.php", "language": "php", "file_size": 843, "cut_index": 535, "middle_length": 52 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures\Attributes; use Symfony\Component...
nContext: ['format' => 'd/m/Y'], denormalizationContext: ['format' => 'm-d-Y H:i'], groups: ['a', 'b'], )] public $bar; #[Context(normalizationContext: ['prop' => 'dummy_value'])] public $overriddenParentProperty; #[Co
'value', 'nested' => [ 'nested_key' => 'nested_value', ], 'array' => ['first', 'second']])] #[Context(context: ['bar' => 'value_for_group_a'], groups: ['a'])] public $foo; #[Context( normalizatio
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/Attributes/ContextDummy.php", "language": "php", "file_size": 1142, "cut_index": 518, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures\Attributes; use Symfony\Component\Seria...
['a'])] public $foo, #[Context( normalizationContext: ['format' => 'd/m/Y'], denormalizationContext: ['format' => 'm-d-Y H:i'], groups: ['a', 'b'], )] public $bar, #[Context(norm
ct( #[Context(['foo' => 'value', 'bar' => 'value', 'nested' => [ 'nested_key' => 'nested_value', ], 'array' => ['first', 'second']])] #[Context(context: ['bar' => 'value_for_group_a'], groups:
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/Attributes/ContextDummyPromotedProperties.php", "language": "php", "file_size": 1259, "cut_index": 524, "middle_length": 229 }
ony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures\Attributes; use Symfony\Component\Serializer\Attribute\Groups; #[Groups('a')] class GroupClassDummy { #[Groups('b')]...
unction getBar() { return $this->bar; } public function setBar($bar): void { $this->bar = $bar; } public function getBaz() { return $this->baz; } public function setBaz($baz): void {
{ $this->foo = $foo; } public f
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/Attributes/GroupClassDummy.php", "language": "php", "file_size": 943, "cut_index": 606, "middle_length": 52 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures\Attributes; use Symfony\Component\Serializer\Attribu...
#[Groups(['b'])] public function setBar($bar) { $this->bar = $bar; } #[Groups(['c'])] public function getBar() { return $this->bar; } public function setFoo($foo) { $this->foo = $foo; }
ts GroupDummyInterface { #[Groups(['a'])] private $foo; #[Groups(['b', 'c', 'name_converter'])] protected $bar; #[ChildOfGroupsAttributeDummy] protected $quux; private $fooBar; private $symfony;
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/Attributes/GroupDummy.php", "language": "php", "file_size": 1616, "cut_index": 537, "middle_length": 229 }
ackage. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures\Attributes; use Symfony\Component\Serializer\Attribute\Groups; /** * @au...
in() { return $this->kevin; } public function setCoopTilleuls($coopTilleuls) { $this->coopTilleuls = $coopTilleuls; } #[Groups(['a', 'b'])] public function getCoopTilleuls() { return $this->coopTill
s->kevin = $kevin; } public function getKev
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/Attributes/GroupDummyParent.php", "language": "php", "file_size": 882, "cut_index": 559, "middle_length": 52 }
buted with this source code. */ namespace Symfony\Component\Serializer\Tests\Mapping; use PHPUnit\Framework\TestCase; use Symfony\Component\PropertyAccess\PropertyPath; use Symfony\Component\Serializer\Mapping\AttributeMetadata; use Symfony\Component\Serializer\Mapping\AttributeMetadataInterface; /** * @author Kév...
buteMetadata->getName()); } public function testGroups() { $attributeMetadata = new AttributeMetadata('group'); $attributeMetadata->addGroup('a'); $attributeMetadata->addGroup('a'); $attributeMetadata->addGroup(
$this->assertInstanceOf(AttributeMetadataInterface::class, $attributeMetadata); } public function testGetName() { $attributeMetadata = new AttributeMetadata('name'); $this->assertEquals('name', $attri
{ "filepath": "src/Symfony/Component/Serializer/Tests/Mapping/AttributeMetadataTest.php", "language": "php", "file_size": 8364, "cut_index": 716, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Mapping; use PHPUnit\Framework\TestCase; use Symfony\Componen...
c function testGetClass() { $mapping = new ClassDiscriminatorMapping('type', [ 'first' => AbstractDummyFirstChild::class, ]); $this->assertEquals(AbstractDummyFirstChild::class, $mapping->getClassForType('first'));
bstractDummySecondChild; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummyThirdChild; /** * @author Samuel Roze <samuel.roze@gmail.com> */ class ClassDiscriminatorMappingTest extends TestCase { publi
{ "filepath": "src/Symfony/Component/Serializer/Tests/Mapping/ClassDiscriminatorMappingTest.php", "language": "php", "file_size": 1721, "cut_index": 537, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Mapping; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Mapping\Attri...
ic function testAttributeMetadata() { $classMetadata = new ClassMetadata('c'); $a1 = new AttributeMetadata('a1'); $a2 = new AttributeMetadata('a2'); $classMetadata->addAttributeMetadata($a1); $classMetadata->ad
ss ClassMetadataTest extends TestCase { public function testInterface() { $classMetadata = new ClassMetadata('name'); $this->assertInstanceOf(ClassMetadataInterface::class, $classMetadata); } publ
{ "filepath": "src/Symfony/Component/Serializer/Tests/Mapping/ClassMetadataTest.php", "language": "php", "file_size": 2250, "cut_index": 563, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Mapping; use Symfony\Component\Serializer\Mapping\AttributeMetadata; use Symfony\Compon...
w AttributeMetadata('foo'); $foo->addGroup('a'); $expected->addAttributeMetadata($foo); $bar = new AttributeMetadata('bar'); $bar->addGroup('b'); $bar->addGroup('c'); $bar->addGroup('name_converter');
y { public static function createClassMetadata(string $namespace, bool $withParent = false, bool $withInterface = false): ClassMetadata { $expected = new ClassMetadata($namespace.'\GroupDummy'); $foo = ne
{ "filepath": "src/Symfony/Component/Serializer/Tests/Mapping/TestClassMetadataFactory.php", "language": "php", "file_size": 2644, "cut_index": 563, "middle_length": 229 }
alizer\Exception\MappingException; use Symfony\Component\Serializer\Mapping\AttributeMetadata; use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping; use Symfony\Component\Serializer\Mapping\ClassMetadata; use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader; use Symfony\Component\Serializer\Map...
orishGetters; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\BadAttributeDummy; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\BadMethodContextDummy; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\ContextDummyParent; use
ymfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummySecondChild; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummyThirdChild; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\Access
{ "filepath": "src/Symfony/Component/Serializer/Tests/Mapping/Loader/AttributeLoaderTest.php", "language": "php", "file_size": 13335, "cut_index": 921, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Tests\Mapping\Loader; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Mapping\AttributeMetadata; use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping; use Symfony\Component\Serializer\Mapping\ClassMetadata; use Symf...
\GroupDummy; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\IgnoreDummy; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\MaxDepthDummy; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\SerializedNameDummy; use Symfony\Compo
; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummyFirstChild; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummySecondChild; use Symfony\Component\Serializer\Tests\Fixtures\Attributes
{ "filepath": "src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php", "language": "php", "file_size": 5190, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Tests\Mapping\Loader; use PHPUnit\Framework\TestCase; use Symfony\Component\PropertyAccess\PropertyPath; use Symfony\Component\Serializer\Exception\MappingException; use Symfony\Component\Serializer\Mapping\AttributeMetadata; use Symfony\Componen...
er\Tests\Fixtures\Attributes\AbstractDummySecondChild; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\GroupDummy; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\IgnoreDummy; use Symfony\Component\Serializer\Tests\Fixtures\Attributes
erializer\Mapping\Loader\YamlFileLoader; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummy; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummyFirstChild; use Symfony\Component\Serializ
{ "filepath": "src/Symfony/Component/Serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php", "language": "php", "file_size": 6126, "cut_index": 716, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Mapping\Loader\Features; use PHPUnit\Framework\Assert; use Symfony\Component\Serializer...
e; public function testLoadContexts() { $this->assertLoadedContexts(); } public function assertLoadedContexts(string $dummyClass = ContextDummy::class, string $parentClass = ContextDummyParent::class): void { $loader =
er\Tests\Fixtures\Attributes\ContextDummyParent; /** * @author Maxime Steinhausser <maxime.steinhausser@gmail.com> */ trait ContextMappingTestTrait { abstract protected function getLoaderForContextMapping(): LoaderInterfac
{ "filepath": "src/Symfony/Component/Serializer/Tests/Mapping/Loader/Features/ContextMappingTestTrait.php", "language": "php", "file_size": 2888, "cut_index": 563, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Mapping\Factory; use PHPUnit\Framework\TestCase; use Symfony\Component\Cache\Adapter\Ar...
Loader; use Symfony\Component\Serializer\Tests\Fixtures\Dummy; /** * @author Kévin Dunglas <dunglas@gmail.com> */ class CacheMetadataFactoryTest extends TestCase { public function testGetMetadataFor() { $metadata = new ClassMetadata(Dumm
lassMetadataFactory; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; use Symfony\Component\Serializer\Mapping\Loader\Attribute
{ "filepath": "src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php", "language": "php", "file_size": 2865, "cut_index": 563, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Mapping\Factory; use PHPUnit\Framework\TestCase; use Symfony\...
ymfony\Component\Serializer\Tests\Fixtures\Attributes\GroupDummyParent; use Symfony\Component\Serializer\Tests\Mapping\TestClassMetadataFactory; /** * @author Kévin Dunglas <dunglas@gmail.com> */ class ClassMetadataFactoryTest extends TestCase { pub
buteLoader; use Symfony\Component\Serializer\Mapping\Loader\LoaderChain; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\GroupDummy; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\GroupDummyInterface; use S
{ "filepath": "src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php", "language": "php", "file_size": 2005, "cut_index": 537, "middle_length": 229 }
\Extractor\PhpDocExtractor; use Symfony\Component\Serializer\Encoder\JsonEncoder; use Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException; use Symfony\Component\Serializer\Exception\NotNormalizableValueException; use Symfony\Component\Serializer\Mapping\AttributeMetadata; use Symfony\Component\S...
e Symfony\Component\Serializer\Tests\Fixtures\AbstractNormalizerDummy; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\IgnoreDummy; use Symfony\Component\Serializer\Tests\Fixtures\Dummy; use Symfony\Component\Serializer\Tests\Fixtures\DummyWithW
ony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; use Symfony\Component\Serializer\Normalizer\PropertyNormalizer; use Symfony\Component\Serializer\Serializer; us
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php", "language": "php", "file_size": 12414, "cut_index": 921, "middle_length": 229 }
eNumberFour; use Symfony\Component\Serializer\Tests\Fixtures\DummySecondChildQuux; use Symfony\Component\Serializer\Tests\Fixtures\DummyString; use Symfony\Component\Serializer\Tests\Fixtures\DummyWithNotNormalizable; use Symfony\Component\Serializer\Tests\Fixtures\DummyWithObjectOrBool; use Symfony\Component\Serialize...
= $normalizer->denormalize(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'], Dummy::class); $this->assertSame('foo', $normalizedData->foo); $this->assertNull($normalizedData->bar); $this->assertSame('baz', $normalizedData->baz);
Attribute; use Symfony\Component\TypeInfo\Type; class AbstractObjectNormalizerTest extends TestCase { public function testDenormalize() { $normalizer = new AbstractObjectNormalizerDummy(); $normalizedData
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php", "language": "php", "file_size": 76502, "cut_index": 3790, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Normalizer; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer; use Symfony\Component\Serialize...
enormalizer->expects($this->exactly(2)) ->method('denormalize') ->willReturnCallback(function ($data) use (&$series) { [$expectedArgs, $return] = array_shift($series); $this->assertSame($expectedArgs,
']], new ArrayDummy('one', 'two')], [[['foo' => 'three', 'bar' => 'four']], new ArrayDummy('three', 'four')], ]; $nestedDenormalizer = $this->createMock(DenormalizerInterface::class); $nestedD
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php", "language": "php", "file_size": 4250, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Tests\Normalizer; use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Exception\NotNormalizableValueException; use Symfon...
protected function setUp(): void { $this->normalizer = new BackedEnumNormalizer(); } public function testSupportsNormalization() { $this->assertTrue($this->normalizer->supportsNormalization(StringBackedEnumDummy::GET))
Dummy; use Symfony\Component\Serializer\Tests\Fixtures\UnitEnumDummy; /** * @author Alexandre Daubois <alex.daubois@gmail.com> */ class BackedEnumNormalizerTest extends TestCase { private BackedEnumNormalizer $normalizer;
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/BackedEnumNormalizerTest.php", "language": "php", "file_size": 8379, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Tests\Normalizer; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Mapping\ClassMetadata; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; use Symfony\Component\...
Validator\Constraints\NotNull; use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\ConstraintViolationList; /** * @author Grégoire Pineau <lyrixx@lyrixx.info> * @author Kévin Dunglas <dunglas@gmail.com> */ class Constra
verter; use Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer; use Symfony\Component\Serializer\Tests\Dummy\DummyClassOne; use Symfony\Component\Serializer\Tests\Dummy\DummyClassTwo; use Symfony\Component\
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/ConstraintViolationListNormalizerTest.php", "language": "php", "file_size": 7647, "cut_index": 716, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Normalizer; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Normalizer...
unction setUp(): void { $this->normalizer = new CustomNormalizer(); $this->normalizer->setSerializer(new Serializer()); } public function testInterface() { $this->assertInstanceOf(NormalizerInterface::class, $this->
er; use Symfony\Component\Serializer\SerializerAwareInterface; use Symfony\Component\Serializer\Tests\Fixtures\ScalarDummy; class CustomNormalizerTest extends TestCase { private CustomNormalizer $normalizer; protected f
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php", "language": "php", "file_size": 3008, "cut_index": 563, "middle_length": 229 }
malization(new \SplFileObject('data:,Hello%2C%20World!'))); } #[RequiresPhpExtension('fileinfo')] public function testNormalizeHttpFoundationFile() { $file = new File(__DIR__.'/../Fixtures/test.gif'); $this->assertSame(self::TEST_GIF_DATA, $this->normalizer->normalize($file)); } ...
= $this->normalizer->normalize($file); $this->assertSame(self::TEST_TXT_DATA, $data); $this->assertSame(self::TEST_TXT_CONTENT, file_get_contents($data)); } public function testSupportsDenormalization() { $this->asser
TEST_GIF_DATA, $this->normalizer->normalize($file)); } #[RequiresPhpExtension('fileinfo')] public function testNormalizeText() { $file = new \SplFileObject(__DIR__.'/../Fixtures/test.txt'); $data
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php", "language": "php", "file_size": 35612, "cut_index": 2151, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Tests\Normalizer; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Exception\NotNormalizableValueException; use Sy...
%MM%DDT%HH%IM%SS', 'P00Y00M00DT00H00M00S', 'PT0S'], ['P%yY%mM%dDT%hH%iM%sS', 'P0Y0M0DT0H0M0S', 'PT0S'], ['P%yY%mM%dDT%hH%iM%sS', 'P10Y2M3DT16H5M6S', 'P10Y2M3DT16H5M6S'], ['P%yY%mM%dDT%hH%iM', 'P10Y2M3DT16H5M', 'P10Y2M3DT
valNormalizer $normalizer; protected function setUp(): void { $this->normalizer = new DateIntervalNormalizer(); } public static function dataProviderISO(): array { return [ ['P%YY
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php", "language": "php", "file_size": 6621, "cut_index": 716, "middle_length": 229 }
protected function setUp(): void { $this->normalizer = new DateTimeNormalizer(); } public function testSupportsNormalization() { $this->assertTrue($this->normalizer->supportsNormalization(new \DateTime())); $this->assertTrue($this->normalizer->supportsNormalization(new \DateTi...
w \DateTimeZone('UTC')))); } public function testNormalizeUsingFormatPassedInContext() { $this->assertEquals('2016', $this->normalizer->normalize(new \DateTimeImmutable('2016/01/01'), null, [DateTimeNormalizer::FORMAT_KEY => 'Y']));
T00:00:00+00:00', $this->normalizer->normalize(new \DateTime('2016/01/01', new \DateTimeZone('UTC')))); $this->assertEquals('2016-01-01T00:00:00+00:00', $this->normalizer->normalize(new \DateTimeImmutable('2016/01/01', ne
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php", "language": "php", "file_size": 22816, "cut_index": 1331, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Normalizer; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Exception\...
izer(); } public function testSupportsNormalization() { $this->assertTrue($this->normalizer->supportsNormalization(new \DateTimeZone('UTC'))); $this->assertFalse($this->normalizer->supportsNormalization(new \DateTimeImmutable()
esjardins <jewome62@gmail.com> */ class DateTimeZoneNormalizerTest extends TestCase { private DateTimeZoneNormalizer $normalizer; protected function setUp(): void { $this->normalizer = new DateTimeZoneNormal
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php", "language": "php", "file_size": 2720, "cut_index": 563, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Context\Encoder; use PHPUnit\Framework\Attributes\DataProvide...
EncoderContextBuilder(); } /** * @param array<string, mixed> $values */ #[DataProvider('withersDataProvider')] public function testWithers(array $values) { $context = $this->contextBuilder ->withIndentLeve
aud <mathias.arlaud@gmail.com> */ class YamlEncoderContextBuilderTest extends TestCase { private YamlEncoderContextBuilder $contextBuilder; protected function setUp(): void { $this->contextBuilder = new Yaml
{ "filepath": "src/Symfony/Component/Serializer/Tests/Context/Encoder/YamlEncoderContextBuilderTest.php", "language": "php", "file_size": 1978, "cut_index": 537, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Normalizer; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormErrorIterator; use Symfon...
bmitted')->willReturn(true); $this->form->method('all')->willReturn([]); $this->form->method('getErrors') ->willReturn(new FormErrorIterator($this->form, [ new FormError('a', 'b', ['c', 'd'], 5, 'f'),
private FormInterface $form; protected function setUp(): void { $this->normalizer = new FormErrorNormalizer(); $this->form = $this->createStub(FormInterface::class); $this->form->method('isSu
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/FormErrorNormalizerTest.php", "language": "php", "file_size": 4770, "cut_index": 614, "middle_length": 229 }
nent\Serializer\Mapping\Factory\ClassMetadataFactory; use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader; use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter; use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter; use Symfony\Component\Serializer\Normalizer\...
Fixtures\Attributes\ClassWithIgnoreAnnotation; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\ClassWithIgnoreAttribute; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\GroupDummy; use Symfony\Component\Serializer\Tests\Fixtures\Circu
r\GetSetMethodNormalizer; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Serializer\Tests\
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php", "language": "php", "file_size": 32114, "cut_index": 1331, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Attribute; use PHPUnit\Framework\TestCase; use Symfony\Compon...
]); $this->assertEquals('type', $attribute->typeProperty); $this->assertEquals([ 'foo' => 'FooClass', 'bar' => 'BarClass', ], $attribute->mapping); } public function testExceptionWithEmptyTypeProper
st extends TestCase { public function testGetTypePropertyAndMapping() { $attribute = new DiscriminatorMap(typeProperty: 'type', mapping: [ 'foo' => 'FooClass', 'bar' => 'BarClass',
{ "filepath": "src/Symfony/Component/Serializer/Tests/Attribute/DiscriminatorMapTest.php", "language": "php", "file_size": 1784, "cut_index": 537, "middle_length": 229 }
?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Attribute; use PHPUnit\Framework\Test...
ter given to "Symfony\Component\Serializer\Attribute\SerializedName" must be a non-empty string.'); new SerializedName(''); } public function testSerializedNameParameters() { $foo = new SerializedName('foo'); $this->as
com> */ class SerializedNameTest extends TestCase { public function testNotAStringSerializedNameParameter() { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Parame
{ "filepath": "src/Symfony/Component/Serializer/Tests/Attribute/SerializedNameTest.php", "language": "php", "file_size": 1047, "cut_index": 513, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Attribute; use PHPUnit\Framework\TestCase;...
this->expectExceptionMessage('Parameter given to "Symfony\Component\Serializer\Attribute\SerializedPath" must be a valid property path.'); new SerializedPath(''); } public function testSerializedPath() { $path = '[one][two]';
hor Tobias Bönner <tobi@boenner.family> */ class SerializedPathTest extends TestCase { public function testEmptyStringSerializedPathParameter() { $this->expectException(InvalidArgumentException::class); $
{ "filepath": "src/Symfony/Component/Serializer/Tests/Attribute/SerializedPathTest.php", "language": "php", "file_size": 1191, "cut_index": 518, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Serializer\Norma...
ool $attributesAsString = false): array|bool { return parent::getAllowedAttributes($classOrObject, $context, $attributesAsString); } public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|
Dummy extends AbstractNormalizer { public function getSupportedTypes(?string $format): array { return ['*' => false]; } public function getAllowedAttributes(string|object $classOrObject, array $context, b
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php", "language": "php", "file_size": 1473, "cut_index": 524, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Serialize...
* @var DummyMessageNumberOne */ private $nested; public function setNested(DummyMessageNumberOne $nested) { $this->nested = $nested; } public function getNested(): DummyMessageNumberOne { return $this->n
hree; /**
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/DummyMessageNumberTwo.php", "language": "php", "file_size": 802, "cut_index": 517, "middle_length": 14 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Serializer...
'message' => $encodedContent, ]; } public function getSupportedTypes(?string $format): array { return [ EnvelopeObject::class => true, ]; } public function supportsNormalization($data, ?s
ormalize(mixed $data, ?string $format = null, array $context = []): array { $xmlContent = $this->serializer->serialize($data->message, 'xml'); $encodedContent = base64_encode($xmlContent); return [
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/EnvelopeNormalizer.php", "language": "php", "file_size": 1221, "cut_index": 518, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Serializer\Norma...
} return $result; } public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { if (str_ends_with($type, '[]')) { $className = substr($type, 0, -2);
ray $context = []): array { $result = []; foreach ($data as $foo) { $fooDummy = new FooImplementationDummy(); $fooDummy->name = $foo['name']; $result[] = $fooDummy;
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/FooInterfaceDummyDenormalizer.php", "language": "php", "file_size": 1448, "cut_index": 524, "middle_length": 229 }
ackage. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Serializer\Exception\NotNormalizableValueException;...
ce { public function __construct() { } public function denormalize(DenormalizerInterface $denormalizer, $data, ?string $format = null, array $context = []): void { throw new NotNormalizableValueException('Custom exception messa
otNormalizableDummy implements DenormalizableInterfa
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/NotNormalizableDummy.php", "language": "php", "file_size": 881, "cut_index": 559, "middle_length": 52 }
s part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Serializer\Attribute\Groups;...
nction setBuz($buz) { $this->buz = $buz; } public function getBuz() { return $this->buz; } #[Groups(['b']), SerializedName('buz')] public function getBuzForExport() { return $this->buz.' Rocks';
public fu
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/OtherSerializedNameDummy.php", "language": "php", "file_size": 811, "cut_index": 536, "middle_length": 14 }
?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Seria...
null, array $context = []): bool { return \is_scalar($data); } public function getSupportedTypes(?string $format): array { return [ 'native-boolean' => true, 'native-integer' => true, 'n
{ $data = $object; if (!\is_string($data)) { $data = (string) $object; } return strtoupper($data); } public function supportsNormalization(mixed $data, ?string $format =
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/ScalarNormalizer.php", "language": "php", "file_size": 1040, "cut_index": 513, "middle_length": 229 }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; /** * @author Kévin Dungl...
{ return $this->sibling1; } public function getSibling2() { return $this->sibling2; } } /** * @author Kévin Dunglas <dunglas@gmail.com> */ class Sibling { public function getCoopTilleuls() { return '
$this->sibling0 = $sibling; $this->sibling1 = $sibling; $this->sibling2 = $sibling; } public function getSibling0() { return $this->sibling0; } public function getSibling1()
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/SiblingHolder.php", "language": "php", "file_size": 1027, "cut_index": 512, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Context\Normalizer; use PHPUnit\Framework\Attributes\DataProv...
$this->contextBuilder = new ProblemNormalizerContextBuilder(); } /** * @param array<string, mixed> $values */ #[DataProvider('withersDataProvider')] public function testWithers(array $values) { $context = $this->cont
* @author Mathias Arlaud <mathias.arlaud@gmail.com> */ class ProblemNormalizerContextBuilderTest extends TestCase { private ProblemNormalizerContextBuilder $contextBuilder; protected function setUp(): void {
{ "filepath": "src/Symfony/Component/Serializer/Tests/Context/Normalizer/ProblemNormalizerContextBuilderTest.php", "language": "php", "file_size": 1816, "cut_index": 537, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Context\Normalizer; use PHPUnit\Framework\Attributes\DataProv...
; protected function setUp(): void { $this->contextBuilder = new UidNormalizerContextBuilder(); } /** * @param array<string, mixed> $values */ #[DataProvider('withersDataProvider')] public function testWithers(ar
Symfony\Component\Serializer\Normalizer\UidNormalizer; /** * @author Mathias Arlaud <mathias.arlaud@gmail.com> */ class UidNormalizerContextBuilderTest extends TestCase { private UidNormalizerContextBuilder $contextBuilder
{ "filepath": "src/Symfony/Component/Serializer/Tests/Context/Normalizer/UidNormalizerContextBuilderTest.php", "language": "php", "file_size": 1869, "cut_index": 537, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Context\Normalizer; use PHPUnit\Framework\Attributes\DataProv...
alizerContextBuilder $contextBuilder; protected function setUp(): void { $this->contextBuilder = new UnwrappingDenormalizerContextBuilder(); } /** * @param array<string, mixed> $values */ #[DataProvider('withersDataP
ion; use Symfony\Component\Serializer\Normalizer\UnwrappingDenormalizer; /** * @author Mathias Arlaud <mathias.arlaud@gmail.com> */ class UnwrappingDenormalizerContextBuilderTest extends TestCase { private UnwrappingDenorm
{ "filepath": "src/Symfony/Component/Serializer/Tests/Context/Normalizer/UnwrappingDenormalizerContextBuilderTest.php", "language": "php", "file_size": 1838, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Tests\Attribute; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Attribute\Context; use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\VarDump...
$this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('At least one of the "context", "normalizationContext", or "denormalizationContext" options must be provided as a non-empty array to "Symfony\Component\Serial
se VarDumperTestTrait; protected function setUp(): void { $this->setUpVarDumper([], CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_TRAILING_COMMA); } public function testThrowsOnEmptyContext() {
{ "filepath": "src/Symfony/Component/Serializer/Tests/Attribute/ContextTest.php", "language": "php", "file_size": 5142, "cut_index": 716, "middle_length": 229 }
hp /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Attribute; use PHPUnit\Framework\Attrib...
eption::class); $this->expectExceptionMessage('Parameter given to "Symfony\Component\Serializer\Attribute\MaxDepth" must be a positive integer.'); new MaxDepth($value); } public function testMaxDepthParameters() { $maxD
unglas <dunglas@gmail.com> */ class MaxDepthTest extends TestCase { #[TestWith([-4])] #[TestWith([0])] public function testNotAnIntMaxDepthParameter(int $value) { $this->expectException(InvalidArgumentExc
{ "filepath": "src/Symfony/Component/Serializer/Tests/Attribute/MaxDepthTest.php", "language": "php", "file_size": 1086, "cut_index": 515, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Serializer\Norma...
$normalizer, ?string $format = null, array $context = []): array|string|int|float|bool { return [ 'foo' => $this->foo, 'bar' => $this->bar, 'baz' => $this->baz, 'qux' => $this->qux, ];
lizer\Normalizer\NormalizerInterface; class Dummy implements NormalizableInterface, DenormalizableInterface { public $foo; public $bar; public $baz; public $qux; public function normalize(NormalizerInterface
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/Dummy.php", "language": "php", "file_size": 1323, "cut_index": 524, "middle_length": 229 }
n Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; /** * @author Karoly Gossler ...
]; } public function getSupportedTypes(?string $format): array { return [ EnvelopedMessage::class => true, ]; } public function supportsNormalization($data, ?string $format = null, array $context = []
return [ 'text' => $data->text,
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/EnvelopedMessageNormalizer.php", "language": "php", "file_size": 962, "cut_index": 582, "middle_length": 52 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Uid\Uuid; final...
74FullWithConstructor; public Php74FullWithTypedConstructor $php74FullWithTypedConstructor; public DummyMessageInterface $dummyMessage; /** @var TestFoo[] $nestedArray */ public TestFoo $nestedObject; /** @var Php74Full[] */ public
ble; public \DateTimeZone $dateTimeZone; public \SplFileInfo $splFileInfo; public Uuid $uuid; public array $array; /** @var Php74Full[] */ public array $collection; public Php74FullWithConstructor $php
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/Php74Full.php", "language": "php", "file_size": 1350, "cut_index": 524, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Serializer\Normalizer\Abstrac...
} protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []): mixed { return $object->$attribute; } protected function setAttributeValue(object $object, string $attribute,
): array { return [StaticConstructorDummy::class]; } protected function extractAttributes(object $object, ?string $format = null, array $context = []): array { return get_object_vars($object);
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/StaticConstructorNormalizer.php", "language": "php", "file_size": 1561, "cut_index": 537, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Context\Normalizer; use PHPUnit\Framework\...
der = new PropertyNormalizerContextBuilder(); } public function testWithNormalizeVisibility() { $context = $this->contextBuilder ->withNormalizeVisibility(PropertyNormalizer::NORMALIZE_PUBLIC | PropertyNormalizer::NORMALIZE
t <lamiraultantoine@gmail.com> */ class PropertyNormalizerContextBuilderTest extends TestCase { private PropertyNormalizerContextBuilder $contextBuilder; protected function setUp(): void { $this->contextBuil
{ "filepath": "src/Symfony/Component/Serializer/Tests/Context/Normalizer/PropertyNormalizerContextBuilderTest.php", "language": "php", "file_size": 1235, "cut_index": 518, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Context\Encoder; use PHPUnit\Framework\Attributes\DataProvide...
void { $this->contextBuilder = new JsonEncoderContextBuilder(); } /** * @param array<string, mixed> $values */ #[DataProvider('withersDataProvider')] public function testWithers(array $values) { $context
izer\Encoder\JsonEncode; /** * @author Mathias Arlaud <mathias.arlaud@gmail.com> */ class JsonEncoderContextBuilderTest extends TestCase { private JsonEncoderContextBuilder $contextBuilder; protected function setUp():
{ "filepath": "src/Symfony/Component/Serializer/Tests/Context/Encoder/JsonEncoderContextBuilderTest.php", "language": "php", "file_size": 2012, "cut_index": 537, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Attribute; use PHPUnit\Framework\TestCase;...
$this->expectException(InvalidArgumentException::class); new Groups(['a', 1, new \stdClass()]); } public function testGroupsParameters() { $validData = ['a', 'b']; $groups = new Groups($validData); $this->ass
extends TestCase { public function testEmptyGroupsParameter() { $this->expectException(InvalidArgumentException::class); new Groups([]); } public function testInvalidGroupsParameter() {
{ "filepath": "src/Symfony/Component/Serializer/Tests/Attribute/GroupsTest.php", "language": "php", "file_size": 1191, "cut_index": 518, "middle_length": 229 }
php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; class DummyWithWithVariadicP...
} public function getFoo(): string { return $this->foo; } public function getBar(): int { return $this->bar; } /** @return Dummy[] */ public function getBaz(): array { return $this->baz; }
$this->bar = $bar; $this->baz = $baz;
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/DummyWithWithVariadicParameterConstructor.php", "language": "php", "file_size": 824, "cut_index": 514, "middle_length": 52 }
hp /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Seriali...
, ?string $format = null, array $context = []): array|string|int|float|bool { return [ 'foo' => 'normalizedFoo', 'bar' => 'normalizedBar', ]; } public function denormalize(DenormalizerInterface $denormal
ent\Serializer\Normalizer\NormalizerInterface; class NormalizableTraversableDummy extends TraversableDummy implements NormalizableInterface, DenormalizableInterface { public function normalize(NormalizerInterface $normalizer
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/NormalizableTraversableDummy.php", "language": "php", "file_size": 1106, "cut_index": 515, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Context\Normalizer; use PHPUnit\Framework\Attributes\DataProv...
$this->contextBuilder = new FormErrorNormalizerContextBuilder(); } /** * @param array<string, mixed> $values */ #[DataProvider('withersDataProvider')] public function testWithers(array $values) { $context = $
** * @author Mathias Arlaud <mathias.arlaud@gmail.com> */ class FormErrorNormalizerContextBuilderTest extends TestCase { private FormErrorNormalizerContextBuilder $contextBuilder; protected function setUp(): void {
{ "filepath": "src/Symfony/Component/Serializer/Tests/Context/Normalizer/FormErrorNormalizerContextBuilderTest.php", "language": "php", "file_size": 1838, "cut_index": 537, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Fixtures; use Symfony\Component\Serializer...
ng $format = null, array $context = []): array|string|int|float|bool { return 'xml' === $format ? $this->xmlFoo : $this->foo; } public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, ?string
\Serializer\Normalizer\NormalizerInterface; class ScalarDummy implements NormalizableInterface, DenormalizableInterface { public $foo; public $xmlFoo; public function normalize(NormalizerInterface $normalizer, ?stri
{ "filepath": "src/Symfony/Component/Serializer/Tests/Fixtures/ScalarDummy.php", "language": "php", "file_size": 1188, "cut_index": 518, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Context\Encoder; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Context\E...
tBuilder(); } /** * @param array<string, mixed> $values */ #[DataProvider('withersDataProvider')] public function testWithers(array $values) { $context = $this->contextBuilder ->withDelimiter($values[CsvEn
as.arlaud@gmail.com> */ class CsvEncoderContextBuilderTest extends TestCase { private CsvEncoderContextBuilder $contextBuilder; protected function setUp(): void { $this->contextBuilder = new CsvEncoderContex
{ "filepath": "src/Symfony/Component/Serializer/Tests/Context/Encoder/CsvEncoderContextBuilderTest.php", "language": "php", "file_size": 4194, "cut_index": 614, "middle_length": 229 }
tor; use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor; use Symfony\Component\PropertyInfo\PropertyInfoExtractor; use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; /** * Test AbstractNormalizer::CALLBACKS. */ trait Cal...
backsObject(); $obj->bar = $valueBar; $this->assertSame($result, $normalizer->normalize($obj, 'any', ['callbacks' => $callbacks])); } #[DataProvider('provideNormalizeCallbacks')] public function testNormalizeCallbacksWithTyped
lizerInterface; #[DataProvider('provideNormalizeCallbacks')] public function testNormalizeCallbacks($callbacks, $valueBar, $result) { $normalizer = $this->getNormalizerForCallbacks(); $obj = new Call
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/Features/CallbacksTestTrait.php", "language": "php", "file_size": 10661, "cut_index": 921, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Normalizer\Features; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Compone...
rencingModel(); public static function provideUnableToNormalizeCircularReference(): array { return [ [[], [], 1], [['circular_reference_limit' => 2], [], 2], [['circular_reference_limit' => 2], ['circula
lizer::CIRCULAR_REFERENCE_HANDLER. */ trait CircularReferenceTestTrait { abstract protected function getNormalizerForCircularReference(array $defaultContext): NormalizerInterface; abstract protected function getSelfRefe
{ "filepath": "src/Symfony/Component/Serializer/Tests/Normalizer/Features/CircularReferenceTestTrait.php", "language": "php", "file_size": 2452, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Tests\Command; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Serializer\Command\DebugCommand; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; use Symfony\Component...
$tester = new CommandTester($command); $tester->execute(['class' => DummyClassOne::class], ['decorated' => false]); $this->assertSame(<<<TXT Symfony\Component\Serializer\Tests\Dummy\DummyClassOne ---------
thor Loïc Frémont <lc.fremont@gmail.com> */ class DebugCommandTest extends TestCase { public function testOutputWithClassArgument() { $command = new DebugCommand(new ClassMetadataFactory(new AttributeLoader()));
{ "filepath": "src/Symfony/Component/Serializer/Tests/Command/DebugCommandTest.php", "language": "php", "file_size": 6403, "cut_index": 716, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Debug; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\DataCollector\SerializerDataCollector; use Symfony\Component\Seria...
->method('encode') ->with('data', 'format', $this->isArray()) ->willReturn('encoded'); $decoder = $this->createMock(DecoderInterface::class); $decoder ->expects($this->once()) ->
coderInterface; class TraceableEncoderTest extends TestCase { public function testForwardsToEncoder() { $encoder = $this->createMock(EncoderInterface::class); $encoder ->expects($this->once())
{ "filepath": "src/Symfony/Component/Serializer/Tests/Debug/TraceableEncoderTest.php", "language": "php", "file_size": 4462, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Tests\Debug; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\DataCollector\SerializerDataCollector; use Symfony\Component\Serializer\Debug\TraceableNormalizer; use Symfony\Component\Serializer\Debug\TraceableSerializer; use Symfo...
>once()) ->method('normalize') ->with('data', 'format', $this->isArray()) ->willReturn('normalized'); $denormalizer = $this->createMock(DenormalizerInterface::class); $denormalizer->method('getSupportedT
testForwardsToNormalizer() { $normalizer = $this->createMock(NormalizerInterface::class); $normalizer->method('getSupportedTypes')->willReturn(['*' => false]); $normalizer ->expects($this-
{ "filepath": "src/Symfony/Component/Serializer/Tests/Debug/TraceableNormalizerTest.php", "language": "php", "file_size": 5477, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Tests\Debug; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\DataCollector\SerializerDataCollector; use Symfony\Component\Serializer\Debug\TraceableSerializer; use Symfony\Component\Serializer\Encoder\DecoderInterface; use Symfon...
->expects($this->once()) ->method('serialize') ->with('data', 'format', $this->isArray()) ->willReturn('serialized'); $serializer ->expects($this->once()) ->method('deserialize')
\Component\Serializer\SerializerInterface; class TraceableSerializerTest extends TestCase { public function testForwardsToSerializer() { $serializer = $this->createMock(Serializer::class); $serializer
{ "filepath": "src/Symfony/Component/Serializer/Tests/Debug/TraceableSerializerTest.php", "language": "php", "file_size": 8526, "cut_index": 716, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\NameConverter; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Tes...
c function testInterface() { $attributeMetadata = new CamelCaseToSnakeCaseNameConverter(); $this->assertInstanceOf(NameConverterInterface::class, $attributeMetadata); } #[DataProvider('attributeProvider')] public function t
r\NameConverter\NameConverterInterface; /** * @author Kévin Dunglas <dunglas@gmail.com> * @author Aurélien Pillevesse <aurelienpillevesse@hotmail.fr> */ class CamelCaseToSnakeCaseNameConverterTest extends TestCase { publi
{ "filepath": "src/Symfony/Component/Serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php", "language": "php", "file_size": 2728, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Tests\NameConverter; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Attribute\SerializedName; use Symfony\Component\Serializer\Attribute\SerializedPath; use Symfony\Component\Serial...
izer\Tests\Fixtures\OtherSerializedNameDummy; /** * @author Fabien Bourigault <bourigaultfabien@gmail.com> */ final class MetadataAwareNameConverterTest extends TestCase { public function testInterface() { $nameConverter = new MetadataAw
ializer\NameConverter\MetadataAwareNameConverter; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; use Symfony\Component\Serializer\Tests\Fixtures\Attributes\SerializedNameDummy; use Symfony\Component\Serial
{ "filepath": "src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php", "language": "php", "file_size": 7115, "cut_index": 716, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\NameConverter; use PHPUnit\Framework\Attributes\DataProviderExternal; use PHPUnit\Frame...
public function testInterface() { $attributeMetadata = new SnakeCaseToCamelCaseNameConverter(); $this->assertInstanceOf(NameConverterInterface::class, $attributeMetadata); } #[DataProviderExternal(CamelCaseToSnakeCaseNameCon
ameConverter\SnakeCaseToCamelCaseNameConverter; /** * @author Kévin Dunglas <dunglas@gmail.com> * @author Aurélien Pillevesse <aurelienpillevesse@hotmail.fr> */ class SnakeCaseToCamelCaseNameConverterTest extends TestCase {
{ "filepath": "src/Symfony/Component/Serializer/Tests/NameConverter/SnakeCaseToCamelCaseNameConverterTest.php", "language": "php", "file_size": 2432, "cut_index": 563, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Encoder; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Encoder\ChainDecoder; use Symfony\Component\Serializer\Encoder\C...
er1 ->method('decode') ->willReturn('result1'); $decoder2 = $this->createDecoder2(); $decoder2 ->method('decode') ->willReturn('result2'); $chainDecoder = new ChainDecoder([$decoder1,
private const FORMAT_1 = 'format1'; private const FORMAT_2 = 'format2'; private const FORMAT_3 = 'format3'; public function testSupportsDecoding() { $decoder1 = $this->createDecoder1(); $decod
{ "filepath": "src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php", "language": "php", "file_size": 3930, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Serializer\Tests\Encoder; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Debug\TraceableEncoder; use Symfony\Component\Serializer\Encoder\ChainEncoder; use Symfony\Component\Serializer\Encoder\ContextAwareEncoderInterface; use Symfony\Comp...
ncoder1(); $encoder1 ->method('encode') ->willReturn('result1'); $encoder2 = $this->createEncoder2(); $encoder2 ->method('encode') ->willReturn('result2'); $chainEncoder = new
rTest extends TestCase { private const FORMAT_1 = 'format1'; private const FORMAT_2 = 'format2'; private const FORMAT_3 = 'format3'; public function testSupportsEncoding() { $encoder1 = $this->createE
{ "filepath": "src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php", "language": "php", "file_size": 5655, "cut_index": 716, "middle_length": 229 }