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