Skip to content

Commit e98a516

Browse files
committed
Poll expiry can be null
`expiry` is marked as nullable to support non-expiring polls in the future, but all polls have an expiry currently.
1 parent fb6cc8c commit e98a516

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Discord/Parts/Channel/Poll.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @property PollMedia $question The question of the poll. Only text is supported.
3333
* @property PollAnswerRepository $answers Each of the answers available in the poll.
34-
* @property Carbon $expiry The time when the poll ends.
34+
* @property Carbon|null $expiry The time when the poll ends.
3535
* @property bool $allow_multiselect Whether a user can select multiple answers.
3636
* @property int $layout_type The layout type of the poll.
3737
* @property PollResults|null $results The results of the poll.
@@ -101,12 +101,16 @@ protected function getQuestionAttribute(): PollMedia
101101
/**
102102
* Return the expiry attribute.
103103
*
104-
* @return Carbon
104+
* @return Carbon|null
105105
*
106106
* @throws \Exception
107107
*/
108-
protected function getExpiryAttribute(): Carbon
108+
protected function getExpiryAttribute(): ?Carbon
109109
{
110+
if (! isset($this->attributes['expiry'])) {
111+
return null;
112+
}
113+
110114
return Carbon::parse($this->attributes['expiry']);
111115
}
112116

0 commit comments

Comments
 (0)