Skip to content

Commit 515f6cc

Browse files
committed
1 parent 6b8285f commit 515f6cc

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/Discord/Parts/Channel/Poll/Poll.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
*
2727
* @property PollMedia $question The question of the poll. Only text is supported.
2828
* @property PollAnswer[] $answers Each of the answers available in the poll, up to 10.
29-
* @property int $duration Number of hours the poll should be open for, up to 7 days.
30-
* @property bool $allow_multiselect Whether a user can select multiple answers.
29+
* @property int|null $duration Number of hours the poll should be open for, up to 32 days. Defaults to 24.
30+
* @property bool|null $allow_multiselect Whether a user can select multiple answers. Defaults to false.
3131
* @property int|null $layout_type? The layout type of the poll. Defaults to... DEFAULT!
3232
*/
3333
class Poll extends Part
@@ -128,16 +128,18 @@ public function addAnswer(PollAnswer|PollMedia|array|string $answer): self
128128
/**
129129
* Set the duration of the poll.
130130
*
131-
* @param int $duration Number of hours the poll should be open for, up to 32 days. Defaults to 24
131+
* @param int|null $duration Number of hours the poll should be open for, up to 32 days. Defaults to 24.
132132
*
133133
* @throws \OutOfRangeException
134134
*
135135
* @return $this
136136
*/
137-
public function setDuration(int $duration): self
137+
public function setDuration(?int $duration = null): self
138138
{
139-
if ($duration < 1 || $duration > 32 * 24) {
140-
throw new \OutOfRangeException('Duration must be between 1 and 32 days.');
139+
if (isset($duration)) {
140+
if ($duration < 1 || $duration > 32 * 24) {
141+
throw new \OutOfRangeException('Duration must be between 1 hour and 32 days.');
142+
}
141143
}
142144

143145
$this->attributes['duration'] = $duration;
@@ -148,11 +150,11 @@ public function setDuration(int $duration): self
148150
/**
149151
* Determine whether a user can select multiple answers.
150152
*
151-
* @param bool $multiselect Whether a user can select multiple answers.
153+
* @param bool|null $multiselect Whether a user can select multiple answers. Defaults to false.
152154
*
153155
* @return $this
154156
*/
155-
public function setAllowMultiselect(bool $multiselect): self
157+
public function setAllowMultiselect(?bool $multiselect = null): self
156158
{
157159
$this->attributes['allow_multiselect'] = $multiselect;
158160

0 commit comments

Comments
 (0)