1 | <?php |
||
18 | class ExternalArticle implements Arrayable |
||
19 | { |
||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private $title; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $body; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | private $url; |
||
34 | |||
35 | /** |
||
36 | * @var \DateTime |
||
37 | */ |
||
38 | private $createdAt; |
||
39 | |||
40 | /** |
||
41 | * @var array|string[] |
||
42 | */ |
||
43 | private $images = []; |
||
44 | |||
45 | /** |
||
46 | * ExternalArticle constructor. |
||
47 | * @param string $title |
||
48 | * @param string $body |
||
49 | * @param string $url |
||
50 | */ |
||
51 | public function __construct(string $title, string $body, string $url) |
||
59 | |||
60 | /** |
||
61 | * @param string $image |
||
62 | * @return $this |
||
63 | */ |
||
64 | public function addImageUrl(string $image) |
||
70 | |||
71 | /** |
||
72 | * @return array |
||
73 | */ |
||
74 | public function getImages(): array |
||
78 | |||
79 | /** |
||
80 | * @return string |
||
81 | */ |
||
82 | public function getTitle(): string |
||
86 | |||
87 | /** |
||
88 | * @return string |
||
89 | */ |
||
90 | public function getBody(): string |
||
94 | |||
95 | /** |
||
96 | * @return string |
||
97 | */ |
||
98 | public function getUrl(): string |
||
102 | |||
103 | /** |
||
104 | * @return \DateTime |
||
105 | */ |
||
106 | public function getCreatedAt(): \DateTime |
||
110 | |||
111 | /** |
||
112 | * @param \DateTime $createdAt |
||
113 | * @return $this|ExternalArticle |
||
114 | */ |
||
115 | public function setCreatedAt(\DateTime $createdAt) |
||
121 | |||
122 | /** |
||
123 | * @return array |
||
124 | */ |
||
125 | public function toArray(): array |
||
135 | |||
136 | /** |
||
137 | * @param Article $article |
||
138 | * @return Article |
||
139 | */ |
||
140 | public function fill(Article $article): Article |
||
155 | } |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.