Initial Drupal 11 with DDEV setup
This commit is contained in:
74
vendor/symfony/serializer/Attribute/Context.php
vendored
Normal file
74
vendor/symfony/serializer/Attribute/Context.php
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
<?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\Attribute;
|
||||
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
|
||||
class Context
|
||||
{
|
||||
private array $groups;
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $context The common context to use when serializing or deserializing
|
||||
* @param array<string, mixed> $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 or deserializing
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly array $context = [],
|
||||
private readonly array $normalizationContext = [],
|
||||
private readonly array $denormalizationContext = [],
|
||||
string|array $groups = [],
|
||||
) {
|
||||
if (!$context && !$normalizationContext && !$denormalizationContext) {
|
||||
throw new InvalidArgumentException(\sprintf('At least one of the "context", "normalizationContext", or "denormalizationContext" options must be provided as a non-empty array to "%s".', static::class));
|
||||
}
|
||||
|
||||
$this->groups = (array) $groups;
|
||||
|
||||
foreach ($this->groups as $group) {
|
||||
if (!\is_string($group)) {
|
||||
throw new InvalidArgumentException(\sprintf('Parameter "groups" given to "%s" must be a string or an array of strings, "%s" given.', static::class, get_debug_type($group)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getContext(): array
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
public function getNormalizationContext(): array
|
||||
{
|
||||
return $this->normalizationContext;
|
||||
}
|
||||
|
||||
public function getDenormalizationContext(): array
|
||||
{
|
||||
return $this->denormalizationContext;
|
||||
}
|
||||
|
||||
public function getGroups(): array
|
||||
{
|
||||
return $this->groups;
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists(\Symfony\Component\Serializer\Annotation\Context::class, false)) {
|
||||
class_alias(Context::class, \Symfony\Component\Serializer\Annotation\Context::class);
|
||||
}
|
||||
65
vendor/symfony/serializer/Attribute/DiscriminatorMap.php
vendored
Normal file
65
vendor/symfony/serializer/Attribute/DiscriminatorMap.php
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
<?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\Attribute;
|
||||
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS)]
|
||||
class DiscriminatorMap
|
||||
{
|
||||
/**
|
||||
* @param string $typeProperty 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 $defaultType The fallback value if nothing specified by $typeProperty
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly string $typeProperty,
|
||||
private readonly array $mapping,
|
||||
private readonly ?string $defaultType = null,
|
||||
) {
|
||||
if (!$typeProperty) {
|
||||
throw new InvalidArgumentException(\sprintf('Parameter "typeProperty" given to "%s" cannot be empty.', static::class));
|
||||
}
|
||||
|
||||
if (!$mapping) {
|
||||
throw new InvalidArgumentException(\sprintf('Parameter "mapping" given to "%s" cannot be empty.', static::class));
|
||||
}
|
||||
|
||||
if (null !== $this->defaultType && !\array_key_exists($this->defaultType, $this->mapping)) {
|
||||
throw new InvalidArgumentException(\sprintf('Default type "%s" given to "%s" must be present in "mapping" types.', $this->defaultType, static::class));
|
||||
}
|
||||
}
|
||||
|
||||
public function getTypeProperty(): string
|
||||
{
|
||||
return $this->typeProperty;
|
||||
}
|
||||
|
||||
public function getMapping(): array
|
||||
{
|
||||
return $this->mapping;
|
||||
}
|
||||
|
||||
public function getDefaultType(): ?string
|
||||
{
|
||||
return $this->defaultType;
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists(\Symfony\Component\Serializer\Annotation\DiscriminatorMap::class, false)) {
|
||||
class_alias(DiscriminatorMap::class, \Symfony\Component\Serializer\Annotation\DiscriminatorMap::class);
|
||||
}
|
||||
56
vendor/symfony/serializer/Attribute/Groups.php
vendored
Normal file
56
vendor/symfony/serializer/Attribute/Groups.php
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
<?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\Attribute;
|
||||
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @author Kévin Dunglas <dunglas@gmail.com>
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_CLASS)]
|
||||
class Groups
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private readonly array $groups;
|
||||
|
||||
/**
|
||||
* @param string|string[] $groups The groups to define on the attribute target
|
||||
*/
|
||||
public function __construct(string|array $groups)
|
||||
{
|
||||
$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) {
|
||||
if (!\is_string($group) || '' === $group) {
|
||||
throw new InvalidArgumentException(\sprintf('Parameter given to "%s" must be a string or an array of non-empty strings.', static::class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getGroups(): array
|
||||
{
|
||||
return $this->groups;
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists(\Symfony\Component\Serializer\Annotation\Groups::class, false)) {
|
||||
class_alias(Groups::class, \Symfony\Component\Serializer\Annotation\Groups::class);
|
||||
}
|
||||
24
vendor/symfony/serializer/Attribute/Ignore.php
vendored
Normal file
24
vendor/symfony/serializer/Attribute/Ignore.php
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
<?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\Attribute;
|
||||
|
||||
/**
|
||||
* @author Kévin Dunglas <dunglas@gmail.com>
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
|
||||
class Ignore
|
||||
{
|
||||
}
|
||||
|
||||
if (!class_exists(\Symfony\Component\Serializer\Annotation\Ignore::class, false)) {
|
||||
class_alias(Ignore::class, \Symfony\Component\Serializer\Annotation\Ignore::class);
|
||||
}
|
||||
40
vendor/symfony/serializer/Attribute/MaxDepth.php
vendored
Normal file
40
vendor/symfony/serializer/Attribute/MaxDepth.php
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
<?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\Attribute;
|
||||
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @author Kévin Dunglas <dunglas@gmail.com>
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
|
||||
class MaxDepth
|
||||
{
|
||||
/**
|
||||
* @param int $maxDepth The maximum serialization depth
|
||||
*/
|
||||
public function __construct(private readonly int $maxDepth)
|
||||
{
|
||||
if ($maxDepth <= 0) {
|
||||
throw new InvalidArgumentException(\sprintf('Parameter given to "%s" must be a positive integer.', static::class));
|
||||
}
|
||||
}
|
||||
|
||||
public function getMaxDepth(): int
|
||||
{
|
||||
return $this->maxDepth;
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists(\Symfony\Component\Serializer\Annotation\MaxDepth::class, false)) {
|
||||
class_alias(MaxDepth::class, \Symfony\Component\Serializer\Annotation\MaxDepth::class);
|
||||
}
|
||||
40
vendor/symfony/serializer/Attribute/SerializedName.php
vendored
Normal file
40
vendor/symfony/serializer/Attribute/SerializedName.php
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
<?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\Attribute;
|
||||
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @author Fabien Bourigault <bourigaultfabien@gmail.com>
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
|
||||
class SerializedName
|
||||
{
|
||||
/**
|
||||
* @param string $serializedName The name of the property as it will be serialized
|
||||
*/
|
||||
public function __construct(private readonly string $serializedName)
|
||||
{
|
||||
if ('' === $serializedName) {
|
||||
throw new InvalidArgumentException(\sprintf('Parameter given to "%s" must be a non-empty string.', self::class));
|
||||
}
|
||||
}
|
||||
|
||||
public function getSerializedName(): string
|
||||
{
|
||||
return $this->serializedName;
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists(\Symfony\Component\Serializer\Annotation\SerializedName::class, false)) {
|
||||
class_alias(SerializedName::class, \Symfony\Component\Serializer\Annotation\SerializedName::class);
|
||||
}
|
||||
46
vendor/symfony/serializer/Attribute/SerializedPath.php
vendored
Normal file
46
vendor/symfony/serializer/Attribute/SerializedPath.php
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
<?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\Attribute;
|
||||
|
||||
use Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException;
|
||||
use Symfony\Component\PropertyAccess\PropertyPath;
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @author Tobias Bönner <tobi@boenner.family>
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
|
||||
class SerializedPath
|
||||
{
|
||||
private PropertyPath $serializedPath;
|
||||
|
||||
/**
|
||||
* @param string $serializedPath A path using a valid PropertyAccess syntax where the value is stored in a normalized representation
|
||||
*/
|
||||
public function __construct(string $serializedPath)
|
||||
{
|
||||
try {
|
||||
$this->serializedPath = new PropertyPath($serializedPath);
|
||||
} catch (InvalidPropertyPathException $pathException) {
|
||||
throw new InvalidArgumentException(\sprintf('Parameter given to "%s" must be a valid property path.', self::class));
|
||||
}
|
||||
}
|
||||
|
||||
public function getSerializedPath(): PropertyPath
|
||||
{
|
||||
return $this->serializedPath;
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists(\Symfony\Component\Serializer\Annotation\SerializedPath::class, false)) {
|
||||
class_alias(SerializedPath::class, \Symfony\Component\Serializer\Annotation\SerializedPath::class);
|
||||
}
|
||||
Reference in New Issue
Block a user