Skip to content

Commit 163be3e

Browse files
authored
Merge pull request #1182 from discord-php/cleanup-rc6
Cleanup rc6
2 parents d9e46cc + 8c01aaf commit 163be3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+82
-78
lines changed

src/Discord/Discord.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,8 +1160,6 @@ public function updatePresence(Activity $activity = null, bool $idle = false, st
11601160

11611161
if (! in_array($activity['type'], [Activity::TYPE_GAME, Activity::TYPE_STREAMING, Activity::TYPE_LISTENING, Activity::TYPE_WATCHING, Activity::TYPE_CUSTOM, Activity::TYPE_COMPETING])) {
11621162
throw new \UnexpectedValueException("The given activity type ({$activity['type']}) is invalid.");
1163-
1164-
return;
11651163
}
11661164
}
11671165

@@ -1203,13 +1201,15 @@ public function getVoiceClient(string $guild_id): ?VoiceClient
12031201
* @param bool $mute Whether you should be mute when you join the channel.
12041202
* @param bool $deaf Whether you should be deaf when you join the channel.
12051203
* @param LoggerInterface|null $logger Voice client logger. If null, uses same logger as Discord client.
1206-
* @param bool $check Whether to check for system requirements.
12071204
*
12081205
* @throws \RuntimeException
12091206
*
1207+
* @since 10.0.0 Removed argument $check that has no effect (it is always checked)
1208+
* @since 4.0.0
1209+
*
12101210
* @return PromiseInterface
12111211
*/
1212-
public function joinVoiceChannel(Channel $channel, $mute = false, $deaf = true, ?LoggerInterface $logger = null, bool $check = true): ExtendedPromiseInterface
1212+
public function joinVoiceChannel(Channel $channel, $mute = false, $deaf = true, ?LoggerInterface $logger = null): ExtendedPromiseInterface
12131213
{
12141214
$deferred = new Deferred();
12151215

@@ -1241,7 +1241,7 @@ public function joinVoiceChannel(Channel $channel, $mute = false, $deaf = true,
12411241
$this->removeListener(Event::VOICE_STATE_UPDATE, $voiceStateUpdate);
12421242
};
12431243

1244-
$voiceServerUpdate = function ($vs, $discord) use ($channel, &$data, &$voiceServerUpdate, $deferred, $logger, $check) {
1244+
$voiceServerUpdate = function ($vs, $discord) use ($channel, &$data, &$voiceServerUpdate, $deferred, $logger) {
12451245
if ($vs->guild_id != $channel->guild_id) {
12461246
return; // This voice server update isn't for our guild.
12471247
}
@@ -1274,7 +1274,7 @@ public function joinVoiceChannel(Channel $channel, $mute = false, $deaf = true,
12741274
unset($this->voiceClients[$channel->guild_id]);
12751275
});
12761276

1277-
$vc->start($check);
1277+
$vc->start();
12781278

12791279
$this->voiceLoggers[$channel->guild_id] = $logger;
12801280
$this->removeListener(Event::VOICE_SERVER_UPDATE, $voiceServerUpdate);

src/Discord/Parts/Channel/Channel.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,14 +1416,15 @@ public function getCreatableAttributes(): array
14161416
// Marked "Channel Type: All" in documentation
14171417
$attr += $this->makeOptionalAttributes([
14181418
'type' => $this->type,
1419-
'permission_overwrites' => $this->permission_overwrites,
1419+
'permission_overwrites' => $this->getPermissionOverwritesAttribute(),
14201420
'position' => $this->position,
14211421
]);
14221422

14231423
if (null === $this->type) {
14241424
// Type was not specified but we must not assume its default to GUILD_TEXT as that is determined by API
14251425
$this->discord->getLogger()->warning('Not specifying channel type, creating with all filled attributes');
14261426
$attr += $this->getRawAttributes(); // Send the remaining raw attributes
1427+
14271428
return $attr;
14281429
}
14291430

@@ -1509,7 +1510,7 @@ public function getUpdatableAttributes(): array
15091510
$attr = [
15101511
'name' => $this->name,
15111512
'position' => $this->position,
1512-
'permission_overwrites' => $this->permission_overwrites,
1513+
'permission_overwrites' => $this->getPermissionOverwritesAttribute(),
15131514
];
15141515

15151516
switch ($this->type) {

src/Discord/Parts/Channel/Message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ public function delayedReply($message, int $delay, &$timer = null): ExtendedProm
908908
* @param int $delay Time to delay the delete by, in milliseconds.
909909
* @param TimerInterface &$timer Delay timer passed by reference.
910910
*
911-
* @return ExtendedPromseInterface
911+
* @return ExtendedPromiseInterface
912912
*/
913913
public function delayedDelete(int $delay, &$timer = null): ExtendedPromiseInterface
914914
{

src/Discord/Parts/Channel/Reaction.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ public function fetch(): ExtendedPromiseInterface
9090
*
9191
* @param string $value name:id or the character of standard emoji
9292
*
93-
* @return void
9493
*
9594
* @since 10.0.0
9695
*/

src/Discord/Parts/Guild/AuditLog/AuditLog.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
*
3131
* @since 5.1.0
3232
*
33-
* @property Collection|Command[] $application_commands List of application commands referenced in the audit log.
34-
* @property Collection|Entry[] $audit_log_entries List of audit log entries.
35-
* @property Collection|Rule[] $auto_moderation_rules List of auto moderation rules referenced in the audit log.
36-
* @property Collection|GuildScheduledEvent[] $guild_scheduled_events List of guild scheduled events referenced in the audit log.
37-
* @property Collection|Integration[] $integrations List of partial integration objects.
38-
* @property Collection|Threads[] $threads List of threads referenced in the audit log.
39-
* @property Collection|User[] $users List of users referenced in the audit log.
40-
* @property Collection|Webhook[] $webhooks List of webhooks referenced in the audit log.
33+
* @property Collection|Command[] $application_commands List of application commands referenced in the audit log.
34+
* @property Collection|Entry[] $audit_log_entries List of audit log entries.
35+
* @property Collection|Rule[] $auto_moderation_rules List of auto moderation rules referenced in the audit log.
36+
* @property Collection|ScheduledEvent[] $guild_scheduled_events List of guild scheduled events referenced in the audit log.
37+
* @property Collection|Integration[] $integrations List of partial integration objects.
38+
* @property Collection|Thread[] $threads List of threads referenced in the audit log.
39+
* @property Collection|User[] $users List of users referenced in the audit log.
40+
* @property Collection|Webhook[] $webhooks List of webhooks referenced in the audit log.
4141
*
4242
* @property string $guild_id
4343
* @property-read Guild|null $guild

src/Discord/Parts/Guild/AutoModeration/Rule.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
namespace Discord\Parts\Guild\AutoModeration;
1313

1414
use Discord\Helpers\Collection;
15+
use Discord\Parts\Channel\Channel;
1516
use Discord\Parts\Guild\Guild;
17+
use Discord\Parts\Guild\Role;
1618
use Discord\Parts\Part;
1719
use Discord\Parts\User\User;
1820

@@ -39,8 +41,8 @@
3941
* @property object $trigger_metadata The rule trigger metadata (may contain `keyword_filter`, `regex_patterns`, `presets`, `allow_list`, `mention_total_limit` and `mention_raid_protection_enabled`).
4042
* @property Collection|Action[] $actions The actions which will execute when the rule is triggered.
4143
* @property bool $enabled Whether the rule is enabled.
42-
* @property Collection|Roles[] $exempt_roles The role ids that should not be affected by the rule (Maximum of 20).
43-
* @property Collection|Channels[] $exempt_channels The channel ids that should not be affected by the rule (Maximum of 50).
44+
* @property Collection|?Role[] $exempt_roles The role ids that should not be affected by the rule (Maximum of 20).
45+
* @property Collection|?Channel[] $exempt_channels The channel ids that should not be affected by the rule (Maximum of 50).
4446
*/
4547
class Rule extends Part
4648
{
@@ -111,7 +113,7 @@ protected function getActionsAttribute(): Collection
111113
/**
112114
* Returns the exempt roles attribute.
113115
*
114-
* @return Collection<?Role> A collection of roles exempt from the rule.
116+
* @return Collection|?Role[] A collection of roles exempt from the rule.
115117
*/
116118
protected function getExemptRolesAttribute(): Collection
117119
{
@@ -135,7 +137,7 @@ protected function getExemptRolesAttribute(): Collection
135137
/**
136138
* Returns the exempt channels attribute.
137139
*
138-
* @return Collection<?Channel> A collection of channels exempt from the rule.
140+
* @return Collection|?Channel[] A collection of channels exempt from the rule.
139141
*/
140142
protected function getExemptChannelsAttribute(): Collection
141143
{

src/Discord/Parts/Interactions/Interaction.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Discord\Parts\Interactions\Request\InteractionData;
2727
use Discord\Parts\Part;
2828
use Discord\Parts\Permissions\ChannelPermission;
29+
use Discord\Parts\Thread\Thread;
2930
use Discord\Parts\User\Member;
3031
use Discord\Parts\User\User;
3132
use Discord\WebSockets\Event;

src/Discord/Parts/Part.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function fill(array $attributes): void
188188
*/
189189
private function checkForGetMutator(string $key)
190190
{
191-
$str = 'get' . self::studly($key) . 'Attribute';
191+
$str = 'get'.self::studly($key).'Attribute';
192192

193193
if (method_exists($this, $str)) {
194194
return $str;
@@ -208,7 +208,7 @@ private function checkForGetMutator(string $key)
208208
*/
209209
private function checkForSetMutator(string $key)
210210
{
211-
$str = 'set' . self::studly($key) . 'Attribute';
211+
$str = 'set'.self::studly($key).'Attribute';
212212

213213
if (method_exists($this, $str)) {
214214
return $str;

src/Discord/Parts/User/User.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ public function getPrivateChannel(): ExtendedPromiseInterface
128128
*
129129
* @link https://discord.com/developers/docs/resources/channel#create-message
130130
*
131-
* @param MessageBuilder|string $message The message builder that should be converted into a message, or the string content of the message.
132-
* @param bool $tts Whether the message is TTS.
133-
* @param Embed|array|null $embed An embed object or array to send in the message.
134-
* @param array|null $allowed_mentions Allowed mentions object for the message.
135-
* @param Message|null $replyTo Sends the message as a reply to the given message instance.
131+
* @param MessageBuilder|string $message The message builder that should be converted into a message, or the string content of the message.
132+
* @param bool $tts Whether the message is TTS.
133+
* @param \Discord\Parts\Embed\Embed|array|null $embed An embed object or array to send in the message.
134+
* @param array|null $allowed_mentions Allowed mentions object for the message.
135+
* @param Message|null $replyTo Sends the message as a reply to the given message instance.
136136
*
137137
* @return ExtendedPromiseInterface<Message>
138138
*/

src/Discord/Parts/WebSockets/MessageReaction.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Discord\Parts\Guild\Emoji;
1818
use Discord\Parts\Guild\Guild;
1919
use Discord\Parts\Part;
20+
use Discord\Parts\Thread\Thread;
2021
use Discord\Parts\User\Member;
2122
use Discord\Parts\User\User;
2223
use React\Promise\ExtendedPromiseInterface;
@@ -31,16 +32,16 @@
3132
*
3233
* @since 5.0.0
3334
*
34-
* @property string|null $user_id ID of the user that performed the reaction.
35-
* @property User|null $user User that performed the reaction.
36-
* @property string $channel_id ID of the channel that the reaction was performed in.
37-
* @property-read Channel|Thread $channel Channel that the reaction was performed in.
38-
* @property string $message_id ID of the message that the reaction was placed on.
39-
* @property Message|null $message Message that the reaction was placed on, null if not cached.
40-
* @property string|null $guild_id ID of the guild that owns the channel.
41-
* @property-read Guild|null $guild Guild that owns the channel.
42-
* @property Member|null $member Member object of the user that performed the reaction, null if not cached or DM channel.
43-
* @property Emoji|null $emoji The emoji that was used as the reaction.
35+
* @property string|null $user_id ID of the user that performed the reaction.
36+
* @property User|null $user User that performed the reaction.
37+
* @property string $channel_id ID of the channel that the reaction was performed in.
38+
* @property-read Channel|Thread|null $channel Channel that the reaction was performed in.
39+
* @property string $message_id ID of the message that the reaction was placed on.
40+
* @property Message|null $message Message that the reaction was placed on, null if not cached.
41+
* @property string|null $guild_id ID of the guild that owns the channel.
42+
* @property-read Guild|null $guild Guild that owns the channel.
43+
* @property Member|null $member Member object of the user that performed the reaction, null if not cached or DM channel.
44+
* @property Emoji|null $emoji The emoji that was used as the reaction.
4445
*
4546
* @property string $reaction_id ID of the reaction.
4647
*/
@@ -133,9 +134,9 @@ protected function getUserAttribute(): ?User
133134
/**
134135
* Gets the channel attribute.
135136
*
136-
* @return Channel|Thread
137+
* @return Channel|Thread|null
137138
*/
138-
protected function getChannelAttribute(): Part
139+
protected function getChannelAttribute(): ?Part
139140
{
140141
if ($guild = $this->guild) {
141142
$channels = $guild->channels;

0 commit comments

Comments
 (0)