| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
namespace Symfony\Component\Serializer\Attribute; |
| 13 |
|
| 14 |
use Symfony\Component\Serializer\Exception\InvalidArgumentException; |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)] |
| 20 |
class SerializedName |
| 21 |
{ |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
public function __construct( |
| 26 |
public readonly string $serializedName, |
| 27 |
) { |
| 28 |
if ('' === $serializedName) { |
| 29 |
throw new InvalidArgumentException(\sprintf('Parameter given to "%s" must be a non-empty string.', self::class)); |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
#[\Deprecated('Use the "serializedName" property instead', 'symfony/serializer:7.4')] |
| 34 |
public function getSerializedName(): string |
| 35 |
{ |
| 36 |
return $this->serializedName; |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
if (!class_exists(\Symfony\Component\Serializer\Annotation\SerializedName::class, false)) { |
| 41 |
class_alias(SerializedName::class, \Symfony\Component\Serializer\Annotation\SerializedName::class); |
| 42 |
} |