1 | <?php |
||
26 | class Attachment |
||
27 | { |
||
28 | /** @var string */ |
||
29 | private $color; |
||
30 | |||
31 | /** @var string */ |
||
32 | private $pretext; |
||
33 | |||
34 | /** @var string */ |
||
35 | private $authorName; |
||
36 | |||
37 | /** @var string */ |
||
38 | private $authorLink; |
||
39 | |||
40 | /** @var string */ |
||
41 | private $authorIconUrl; |
||
42 | |||
43 | /** @var string */ |
||
44 | private $title; |
||
45 | |||
46 | /** @var string */ |
||
47 | private $titleLink; |
||
48 | |||
49 | /** @var string */ |
||
50 | private $text; |
||
51 | |||
52 | /** @var string */ |
||
53 | private $imageUrl; |
||
54 | |||
55 | /** @var string */ |
||
56 | private $thumbUrl; |
||
57 | |||
58 | /** @var string */ |
||
59 | private $footer; |
||
60 | |||
61 | /** @var string */ |
||
62 | private $footerIconUrl; |
||
63 | |||
64 | /** @var string */ |
||
65 | private $fallback; |
||
66 | |||
67 | /** @var string */ |
||
68 | private $timestamp; |
||
69 | |||
70 | /** @var AttachmentField[] */ |
||
71 | private $fields; |
||
72 | |||
73 | /** @var AttachmentAction[] */ |
||
74 | private $actions; |
||
75 | |||
76 | /** |
||
77 | * MessageAttachment constructor. |
||
78 | * |
||
79 | * @param string $color |
||
80 | * @param string $pretext |
||
81 | * @param string $authorName |
||
82 | * @param string $authorLink |
||
83 | * @param string $authorIconUrl |
||
84 | * @param string $title |
||
85 | * @param string $titleLink |
||
86 | * @param string $text |
||
87 | * @param string $imageUrl |
||
88 | * @param string $thumbUrl |
||
89 | * @param string $footer |
||
90 | * @param string $footerIconUrl |
||
91 | * @param string $fallback |
||
92 | * @param string $timestamp |
||
93 | * @param AttachmentField[] $fields |
||
94 | * @param AttachmentAction[] $actions |
||
95 | */ |
||
96 | public function __construct( |
||
131 | |||
132 | /** |
||
133 | * Returns attachment's left border color. |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | public function getColor(): string |
||
141 | |||
142 | /** |
||
143 | * Set attachment’s left border color. |
||
144 | * |
||
145 | * @param string $color |
||
146 | * |
||
147 | * @return Attachment |
||
148 | */ |
||
149 | public function setColor(string $color): Attachment |
||
155 | |||
156 | /** |
||
157 | * Returns text, that shown before attachment. |
||
158 | * |
||
159 | * @return string |
||
160 | */ |
||
161 | public function getPretext(): string |
||
165 | |||
166 | /** |
||
167 | * Set the text, that shown before attachment. |
||
168 | * |
||
169 | * @param string $pretext |
||
170 | * |
||
171 | * @return Attachment |
||
172 | */ |
||
173 | public function setPretext(string $pretext): Attachment |
||
179 | |||
180 | /** |
||
181 | * Returns name of the attachment's author. |
||
182 | * |
||
183 | * @return string |
||
184 | */ |
||
185 | public function getAuthorName(): string |
||
189 | |||
190 | /** |
||
191 | * Set the attachment's author name. |
||
192 | * |
||
193 | * @param string $authorName |
||
194 | * |
||
195 | * @return Attachment |
||
196 | */ |
||
197 | public function setAuthorName(string $authorName): Attachment |
||
203 | |||
204 | /** |
||
205 | * Returns attachment's author link. |
||
206 | * |
||
207 | * @return string |
||
208 | */ |
||
209 | public function getAuthorLink(): string |
||
213 | |||
214 | /** |
||
215 | * Set the attachment's author link. |
||
216 | * |
||
217 | * @param string $authorLink |
||
218 | * |
||
219 | * @return Attachment |
||
220 | */ |
||
221 | public function setAuthorLink(string $authorLink): Attachment |
||
227 | |||
228 | /** |
||
229 | * Returns attachment's author icon url. |
||
230 | * |
||
231 | * @return string |
||
232 | */ |
||
233 | public function getAuthorIconUrl(): string |
||
237 | |||
238 | /** |
||
239 | * Set the attachment's author icon url. |
||
240 | * |
||
241 | * @param string $authorIconUrl |
||
242 | * |
||
243 | * @return Attachment |
||
244 | */ |
||
245 | public function setAuthorIconUrl(string $authorIconUrl): Attachment |
||
251 | |||
252 | /** |
||
253 | * Returns attachment title. |
||
254 | * |
||
255 | * @return string |
||
256 | */ |
||
257 | public function getTitle(): string |
||
261 | |||
262 | /** |
||
263 | * Set attachment title. |
||
264 | * |
||
265 | * @param string $title |
||
266 | * |
||
267 | * @return Attachment |
||
268 | */ |
||
269 | public function setTitle(string $title): Attachment |
||
275 | |||
276 | /** |
||
277 | * Returns attachment title link. |
||
278 | * |
||
279 | * @return string |
||
280 | */ |
||
281 | public function getTitleLink(): string |
||
285 | |||
286 | /** |
||
287 | * Set attachment title link. |
||
288 | * |
||
289 | * @param string $titleLink |
||
290 | * |
||
291 | * @return Attachment |
||
292 | */ |
||
293 | public function setTitleLink(string $titleLink): Attachment |
||
299 | |||
300 | /** |
||
301 | * Returns attachment main text. |
||
302 | * |
||
303 | * @return string |
||
304 | */ |
||
305 | public function getText(): string |
||
309 | |||
310 | /** |
||
311 | * Set attachment main text. |
||
312 | * |
||
313 | * @param string $text |
||
314 | * |
||
315 | * @return Attachment |
||
316 | */ |
||
317 | public function setText(string $text): Attachment |
||
323 | |||
324 | /** |
||
325 | * Returns collection of attachment fields. |
||
326 | * |
||
327 | * @return AttachmentField[] |
||
328 | */ |
||
329 | public function getFields(): array |
||
333 | |||
334 | /** |
||
335 | * Set collection of attachment fields. |
||
336 | * |
||
337 | * @param AttachmentField[] $fields |
||
338 | * |
||
339 | * @return Attachment |
||
340 | */ |
||
341 | public function setFields(array $fields): Attachment |
||
347 | |||
348 | /** |
||
349 | * Append attachment fields to collection. |
||
350 | * |
||
351 | * @param AttachmentField $field |
||
352 | * |
||
353 | * @return Attachment |
||
354 | */ |
||
355 | public function appendField(AttachmentField $field): Attachment |
||
365 | |||
366 | /** |
||
367 | * Returns attachment image url. |
||
368 | * |
||
369 | * @return string |
||
370 | */ |
||
371 | public function getImageUrl(): string |
||
375 | |||
376 | /** |
||
377 | * Set attachment image url. |
||
378 | * |
||
379 | * @param string $imageUrl |
||
380 | * |
||
381 | * @return Attachment |
||
382 | */ |
||
383 | public function setImageUrl(string $imageUrl): Attachment |
||
389 | |||
390 | /** |
||
391 | * Returns attachment image thumb url. |
||
392 | * |
||
393 | * @return string |
||
394 | */ |
||
395 | public function getThumbUrl(): string |
||
399 | |||
400 | /** |
||
401 | * Set attachment image url. |
||
402 | * |
||
403 | * @param string $thumbUrl |
||
404 | * |
||
405 | * @return Attachment |
||
406 | */ |
||
407 | public function setThumbUrl(string $thumbUrl): Attachment |
||
413 | |||
414 | /** |
||
415 | * Returns attachment footer text. |
||
416 | * |
||
417 | * @return string |
||
418 | */ |
||
419 | public function getFooter(): string |
||
423 | |||
424 | /** |
||
425 | * Set attachment footer text. |
||
426 | * |
||
427 | * @param string $footer |
||
428 | * |
||
429 | * @return Attachment |
||
430 | */ |
||
431 | public function setFooter(string $footer): Attachment |
||
437 | |||
438 | /** |
||
439 | * Returns attachment footer icon url. |
||
440 | * |
||
441 | * @return string |
||
442 | */ |
||
443 | public function getFooterIconUrl(): string |
||
447 | |||
448 | /** |
||
449 | * Set attachment footer icon url. |
||
450 | * |
||
451 | * @param string $footerIconUrl |
||
452 | * |
||
453 | * @return Attachment |
||
454 | */ |
||
455 | public function setFooterIconUrl(string $footerIconUrl): Attachment |
||
461 | |||
462 | /** |
||
463 | * Returns attachment fallback text. |
||
464 | * |
||
465 | * @return string |
||
466 | */ |
||
467 | public function getFallback(): string |
||
471 | |||
472 | /** |
||
473 | * Set attachment fallback text. |
||
474 | * |
||
475 | * @param string $fallback |
||
476 | * |
||
477 | * @return Attachment |
||
478 | */ |
||
479 | public function setFallback(string $fallback): Attachment |
||
485 | |||
486 | /** |
||
487 | * Returns attachment timestamp, placed in footer. |
||
488 | * |
||
489 | * @return string |
||
490 | */ |
||
491 | public function getTimestamp(): string |
||
495 | |||
496 | /** |
||
497 | * Set attachment timestamp, placed in footer. |
||
498 | * |
||
499 | * @param string $timestamp |
||
500 | * |
||
501 | * @return Attachment |
||
502 | */ |
||
503 | public function setTimestamp(string $timestamp = ''): Attachment |
||
509 | |||
510 | /** |
||
511 | * Returns array of attachment actions. |
||
512 | * |
||
513 | * @return AttachmentAction[] |
||
514 | */ |
||
515 | public function getActions(): array |
||
519 | |||
520 | /** |
||
521 | * Set array of attachment actions. |
||
522 | * |
||
523 | * @param AttachmentAction[] $actions |
||
524 | * |
||
525 | * @return Attachment |
||
526 | */ |
||
527 | public function setActions(array $actions): Attachment |
||
533 | |||
534 | /** |
||
535 | * Append action to attachment. |
||
536 | * |
||
537 | * @param AttachmentAction $action |
||
538 | * |
||
539 | * @return Attachment |
||
540 | */ |
||
541 | public function appendAction(AttachmentAction $action): Attachment |
||
551 | } |
||
552 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.