1<?php 2 3declare(strict_types=1); 4 5namespace JMS\Serializer\Annotation; 6 7use JMS\Serializer\Exception\RuntimeException; 8 9/** 10 * @Annotation 11 * @Target({"PROPERTY","METHOD", "ANNOTATION"}) 12 */ 13final class SerializedName 14{ 15 /** 16 * @var string 17 */ 18 public $name; 19 20 public function __construct(array $values) 21 { 22 if (!isset($values['value']) || !\is_string($values['value'])) { 23 throw new RuntimeException(sprintf('"value" must be a string.')); 24 } 25 26 $this->name = $values['value']; 27 } 28} 29