From 4972b740b3a69a36cbdae3d8cb49b4fa309814f8 Mon Sep 17 00:00:00 2001 From: Naneynonn Date: Wed, 20 Nov 2024 01:44:14 +0200 Subject: [PATCH 1/3] update ExtendedPromiseInterface and resolve --- fakes/PromiseFake.php | 6 +- fakes/RetrierFake.php | 4 +- fakes/WebsocketFake.php | 16 +- src/Gateway/Connection.php | 6 +- src/Gateway/ConnectionInterface.php | 4 +- src/Interaction/ButtonInteraction.php | 8 +- src/Interaction/CommandInteraction.php | 14 +- src/Rest/Application.php | 10 +- .../ApplicationRoleConnectionMetadata.php | 10 +- src/Rest/AuditLog.php | 6 +- src/Rest/Channel.php | 154 +++++++-------- src/Rest/Emoji.php | 42 ++-- src/Rest/GlobalCommand.php | 12 +- src/Rest/Guild.php | 180 +++++++++--------- src/Rest/GuildAutoModeration.php | 22 +-- src/Rest/GuildCommand.php | 14 +- src/Rest/GuildScheduledEvent.php | 24 +-- src/Rest/GuildSticker.php | 22 +-- src/Rest/GuildTemplate.php | 30 +-- src/Rest/HttpResource.php | 9 +- src/Rest/Invite.php | 10 +- src/Rest/StageInstance.php | 18 +- src/Rest/Sticker.php | 10 +- src/Rest/User.php | 34 ++-- src/Rest/Webhook.php | 62 +++--- src/Websocket.php | 6 +- src/WebsocketInterface.php | 4 +- 27 files changed, 364 insertions(+), 373 deletions(-) diff --git a/fakes/PromiseFake.php b/fakes/PromiseFake.php index 383137af..cfc8de15 100644 --- a/fakes/PromiseFake.php +++ b/fakes/PromiseFake.php @@ -4,7 +4,7 @@ namespace Fakes\Ragnarok\Fenrir; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; use React\Promise\Promise; use Throwable; @@ -15,7 +15,7 @@ class PromiseFake * * @param mixed $return What the promise should resolve to */ - public static function get(mixed $return = null): ExtendedPromiseInterface + public static function get(mixed $return = null): PromiseInterface { return new Promise(static function ($resolve) use ($return) { $resolve($return); @@ -27,7 +27,7 @@ public static function get(mixed $return = null): ExtendedPromiseInterface * * @param Throwable $e The exception */ - public static function reject(Throwable $e): ExtendedPromiseInterface + public static function reject(Throwable $e): PromiseInterface { return new Promise(static function ($resolve, $reject) use ($e) { $reject($e); diff --git a/fakes/RetrierFake.php b/fakes/RetrierFake.php index 0721e51c..b6cb6923 100644 --- a/fakes/RetrierFake.php +++ b/fakes/RetrierFake.php @@ -5,11 +5,11 @@ namespace Fakes\Ragnarok\Fenrir; use Exan\Retrier\Retrier; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; class RetrierFake extends Retrier { - public function retry(int $attempts, callable $action): ExtendedPromiseInterface + public function retry(int $attempts, callable $action): PromiseInterface { return PromiseFake::get($action(1)); } diff --git a/fakes/WebsocketFake.php b/fakes/WebsocketFake.php index 2ab9eaef..b2e04e69 100644 --- a/fakes/WebsocketFake.php +++ b/fakes/WebsocketFake.php @@ -7,28 +7,22 @@ use Evenement\EventEmitter; use JsonSerializable; use Ragnarok\Fenrir\WebsocketInterface; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; class WebsocketFake extends EventEmitter implements WebsocketInterface { public array $openings = []; - public function open(string $url): ExtendedPromiseInterface + public function open(string $url): PromiseInterface { $this->openings[] = $url; return PromiseFake::get(); } - public function close(int $code, string $reason): void - { - } + public function close(int $code, string $reason): void {} - public function send(string $message, bool $useBucket = true): void - { - } + public function send(string $message, bool $useBucket = true): void {} - public function sendAsJson(array|JsonSerializable $item, bool $useBucket): void - { - } + public function sendAsJson(array|JsonSerializable $item, bool $useBucket): void {} } diff --git a/src/Gateway/Connection.php b/src/Gateway/Connection.php index d41ef91d..7dd5c3c7 100644 --- a/src/Gateway/Connection.php +++ b/src/Gateway/Connection.php @@ -31,7 +31,7 @@ use Ratchet\RFC6455\Messaging\MessageInterface; use React\EventLoop\LoopInterface; use React\EventLoop\TimerInterface; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @SuppressWarnings(PHPMD.TooManyPublicMethods) @@ -183,7 +183,7 @@ public function setSequence(int $sequence): void $this->sequence = $sequence; } - public function connect(string $url): ExtendedPromiseInterface + public function connect(string $url): PromiseInterface { $url .= '?' . http_build_query(self::QUERY_DATA); @@ -309,7 +309,7 @@ public function resume(): void ], true); } - public function open(): ExtendedPromiseInterface + public function open(): PromiseInterface { return $this->connect(self::DEFAULT_WEBSOCKET_URL); } diff --git a/src/Gateway/ConnectionInterface.php b/src/Gateway/ConnectionInterface.php index 3fab62f9..b9025ee8 100644 --- a/src/Gateway/ConnectionInterface.php +++ b/src/Gateway/ConnectionInterface.php @@ -7,7 +7,7 @@ use Exan\Eventer\Eventer; use Ragnarok\Fenrir\EventHandler; use Ragnarok\Fenrir\Gateway\Helpers\PresenceUpdateBuilder; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; interface ConnectionInterface { @@ -16,7 +16,7 @@ public function getDefaultUrl(): string; public function getSequence(): ?int; public function setSequence(int $sequence); - public function connect(string $url): ExtendedPromiseInterface; + public function connect(string $url): PromiseInterface; public function disconnect(int $code, string $reason): void; public function setSessionId(string $sessionId): void; diff --git a/src/Interaction/ButtonInteraction.php b/src/Interaction/ButtonInteraction.php index 44e29bdb..23004339 100644 --- a/src/Interaction/ButtonInteraction.php +++ b/src/Interaction/ButtonInteraction.php @@ -7,17 +7,15 @@ use Ragnarok\Fenrir\Discord; use Ragnarok\Fenrir\Gateway\Events\InteractionCreate; use Ragnarok\Fenrir\Interaction\Helpers\InteractionCallbackBuilder; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; class ButtonInteraction { - public function __construct(public readonly InteractionCreate $interaction, private Discord $discord) - { - } + public function __construct(public readonly InteractionCreate $interaction, private Discord $discord) {} public function createInteractionResponse( InteractionCallbackBuilder $interactionCallbackBuilder - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->discord->rest->webhook->createInteractionResponse( $this->interaction->id, $this->interaction->token, diff --git a/src/Interaction/CommandInteraction.php b/src/Interaction/CommandInteraction.php index 4a6236e7..490c8d64 100644 --- a/src/Interaction/CommandInteraction.php +++ b/src/Interaction/CommandInteraction.php @@ -10,7 +10,7 @@ use Ragnarok\Fenrir\Interaction\Helpers\InteractionCallbackBuilder; use Ragnarok\Fenrir\Parts\ApplicationCommandInteractionDataOptionStructure as OptionStructure; use Ragnarok\Fenrir\Rest\Helpers\Webhook\EditWebhookBuilder; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; use function Freezemage\ArrayUtils\find as array_find; @@ -30,7 +30,7 @@ public function __construct(public readonly InteractionCreate $interaction, priv public function createInteractionResponse( InteractionCallbackBuilder $interactionCallbackBuilder - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->discord->rest->webhook->createInteractionResponse( $this->interaction->id, $this->interaction->token, @@ -38,7 +38,7 @@ public function createInteractionResponse( ); } - public function getInteractionResponse(): ExtendedPromiseInterface + public function getInteractionResponse(): PromiseInterface { return $this->discord->rest->webhook->getOriginalInteractionResponse( $this->interaction->application_id, @@ -46,7 +46,7 @@ public function getInteractionResponse(): ExtendedPromiseInterface ); } - public function editInteractionResponse(EditWebhookBuilder $webhookBuilder): ExtendedPromiseInterface + public function editInteractionResponse(EditWebhookBuilder $webhookBuilder): PromiseInterface { return $this->discord->rest->webhook->editOriginalInteractionResponse( $this->interaction->application_id, @@ -55,7 +55,7 @@ public function editInteractionResponse(EditWebhookBuilder $webhookBuilder): Ext ); } - public function deleteInteractionResponse(): ExtendedPromiseInterface + public function deleteInteractionResponse(): PromiseInterface { return $this->discord->rest->webhook->deleteOriginalInteractionResponse( $this->interaction->application_id, @@ -73,7 +73,7 @@ private function findOption(array $options, array $segments): ?OptionStructure { $currentSegment = array_shift($segments); - $option = array_find($options, fn (OptionStructure $option) => $option->name === $currentSegment); + $option = array_find($options, fn(OptionStructure $option) => $option->name === $currentSegment); if (empty($segments)) { return $option; @@ -102,7 +102,7 @@ private function getSubCommandNameFromOptions(array $options): ?string { $subItem = array_values(array_filter( $options, - static fn (OptionStructure $option) => in_array( + static fn(OptionStructure $option) => in_array( $option->type, [OptionTypes::SUB_COMMAND, OptionTypes::SUB_COMMAND_GROUP] ) diff --git a/src/Rest/Application.php b/src/Rest/Application.php index a606ed34..60c600ab 100644 --- a/src/Rest/Application.php +++ b/src/Rest/Application.php @@ -5,7 +5,7 @@ namespace Ragnarok\Fenrir\Rest; use Ragnarok\Fenrir\Parts\Application as PartsApplication; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/application @@ -15,9 +15,9 @@ class Application extends HttpResource /** * @see https://discord.com/developers/docs/resources/application#get-current-application * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Application> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Application> */ - public function getCurrent(): ExtendedPromiseInterface + public function getCurrent(): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -30,9 +30,9 @@ public function getCurrent(): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/application#edit-current-application * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Application> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Application> */ - public function editCurrent(array $params): ExtendedPromiseInterface + public function editCurrent(array $params): PromiseInterface { return $this->mapPromise( $this->http->patch( diff --git a/src/Rest/ApplicationRoleConnectionMetadata.php b/src/Rest/ApplicationRoleConnectionMetadata.php index a84ca831..9f6228af 100644 --- a/src/Rest/ApplicationRoleConnectionMetadata.php +++ b/src/Rest/ApplicationRoleConnectionMetadata.php @@ -6,7 +6,7 @@ use Discord\Http\Endpoint; use Ragnarok\Fenrir\Parts\ApplicationRoleConnectionMetadata as PartsApplicationRoleConnectionMetadata; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/application-role-connection-metadata @@ -16,9 +16,9 @@ class ApplicationRoleConnectionMetadata extends HttpResource /** * @see https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationRoleConnectionMetadata> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationRoleConnectionMetadata> */ - public function getRecords(): ExtendedPromiseInterface + public function getRecords(): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -31,9 +31,9 @@ public function getRecords(): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationRoleConnectionMetadata> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationRoleConnectionMetadata> */ - public function updateRecords(array $params): ExtendedPromiseInterface + public function updateRecords(array $params): PromiseInterface { return $this->mapPromise( $this->http->put( diff --git a/src/Rest/AuditLog.php b/src/Rest/AuditLog.php index 5abd6e6f..4fbd95c8 100644 --- a/src/Rest/AuditLog.php +++ b/src/Rest/AuditLog.php @@ -7,7 +7,7 @@ use Discord\Http\Endpoint; use Ragnarok\Fenrir\Parts\AuditLog as PartsAuditLog; use Ragnarok\Fenrir\Rest\Helpers\AuditLog\GetGuildAuditLogsBuilder; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/audit-log @@ -17,12 +17,12 @@ class AuditLog extends HttpResource /** * @see https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\AuditLog> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\AuditLog> */ public function getGuildAuditLogs( string $guildId, GetGuildAuditLogsBuilder $getGuildAuditLogsBuilder - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->get( Endpoint::bind( diff --git a/src/Rest/Channel.php b/src/Rest/Channel.php index 46b2dc39..c9375d50 100644 --- a/src/Rest/Channel.php +++ b/src/Rest/Channel.php @@ -21,7 +21,7 @@ use Ragnarok\Fenrir\Rest\Helpers\Channel\StartThreadFromMessageBuilder; use Ragnarok\Fenrir\Rest\Helpers\Channel\StartThreadWithoutMessageBuilder; use Ragnarok\Fenrir\Rest\Helpers\Emoji\EmojiBuilder; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/channel @@ -36,9 +36,9 @@ class Channel extends HttpResource /** * @see https://discord.com/developers/docs/resources/channel#get-channel * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel> */ - public function get(string $channelId): ExtendedPromiseInterface + public function get(string $channelId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -54,9 +54,9 @@ public function get(string $channelId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/channel#modify-channel * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel> */ - public function modify(string $channelId, ChannelBuilder $channel, ?string $reason = null): ExtendedPromiseInterface + public function modify(string $channelId, ChannelBuilder $channel, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->post( @@ -74,9 +74,9 @@ public function modify(string $channelId, ChannelBuilder $channel, ?string $reas /** * @see https://discord.com/developers/docs/resources/channel#deleteclose-channel * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel> */ - public function delete(string $channelId, ?string $reason = null): ExtendedPromiseInterface + public function delete(string $channelId, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->delete( @@ -94,12 +94,12 @@ public function delete(string $channelId, ?string $reason = null): ExtendedPromi /** * @see https://discord.com/developers/docs/resources/channel#get-channel-messages * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Message[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Message[]> */ public function getMessages( string $channelId, GetMessagesBuilder $getMessagesBuilder = new GetMessagesBuilder() - ): ExtendedPromiseInterface { + ): PromiseInterface { $endpoint = Endpoint::bind( Endpoint::CHANNEL_MESSAGES, $channelId @@ -119,9 +119,9 @@ public function getMessages( /** * @see https://discord.com/developers/docs/resources/channel#get-channel-message * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Message> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Message> */ - public function getMessage(string $channelId, string $messageId): ExtendedPromiseInterface + public function getMessage(string $channelId, string $messageId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -138,12 +138,12 @@ public function getMessage(string $channelId, string $messageId): ExtendedPromis /** * @see https://discord.com/developers/docs/resources/channel#create-message * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Message> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Message> */ public function createMessage( string $channelId, MessageBuilder $message - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->post( Endpoint::bind( @@ -159,9 +159,9 @@ public function createMessage( /** * @see https://discord.com/developers/docs/resources/channel#crosspost-message * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Message> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Message> */ - public function crosspostMessage(string $channelId, string $messageId): ExtendedPromiseInterface + public function crosspostMessage(string $channelId, string $messageId): PromiseInterface { return $this->mapPromise( $this->http->post( @@ -178,13 +178,13 @@ public function crosspostMessage(string $channelId, string $messageId): Extended /** * @see https://discord.com/developers/docs/resources/channel#create-reaction * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function createReaction( string $channelId, string $messageId, EmojiBuilder $emoji - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->put( Endpoint::bind( Endpoint::OWN_MESSAGE_REACTION, @@ -198,13 +198,13 @@ public function createReaction( /** * @see https://discord.com/developers/docs/resources/channel#delete-own-reaction * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function deleteOwnReaction( string $channelId, string $messageId, EmojiBuilder $emoji - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->delete( Endpoint::bind( Endpoint::OWN_MESSAGE_REACTION, @@ -218,14 +218,14 @@ public function deleteOwnReaction( /** * @see https://discord.com/developers/docs/resources/channel#delete-user-reaction * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function deleteUserReaction( string $channelId, string $messageId, EmojiBuilder $emoji, string $userId - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->delete( Endpoint::bind( Endpoint::USER_MESSAGE_REACTION, @@ -240,14 +240,14 @@ public function deleteUserReaction( /** * @see https://discord.com/developers/docs/resources/channel#get-reactions * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Message> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Message> */ public function getReactions( string $channelId, string $messageId, EmojiBuilder $emoji, GetReactionsBuilder $getReactionsBuilder = new GetReactionsBuilder() - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapArrayPromise( $this->http->get( Endpoint::bind( @@ -265,9 +265,9 @@ public function getReactions( /** * @see https://discord.com/developers/docs/resources/channel#delete-all-reactions * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function deleteAllReactions(string $channelId, string $messageId): ExtendedPromiseInterface + public function deleteAllReactions(string $channelId, string $messageId): PromiseInterface { return $this->http->delete( Endpoint::bind( @@ -281,13 +281,13 @@ public function deleteAllReactions(string $channelId, string $messageId): Extend /** * @see https://discord.com/developers/docs/resources/channel#delete-all-reactions-for-emoji * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function deleteAllReactionsForEmoji( string $channelId, string $messageId, EmojiBuilder $emoji - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->delete( Endpoint::bind( Endpoint::MESSAGE_REACTION_EMOJI, @@ -301,13 +301,13 @@ public function deleteAllReactionsForEmoji( /** * @see https://discord.com/developers/docs/resources/channel#edit-message * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Message> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Message> */ public function editMessage( string $channelId, string $messageId, EditMessageBuilder $message - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->patch( Endpoint::bind( @@ -324,13 +324,13 @@ public function editMessage( /** * @see https://discord.com/developers/docs/resources/channel#delete-message * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function deleteMessage( string $channelId, string $messageId, ?string $reason = null, - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->delete( Endpoint::bind( Endpoint::CHANNEL_MESSAGE, @@ -346,13 +346,13 @@ public function deleteMessage( * * @var string[] $messageIds * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function bulkDeleteMessages( string $channelId, array $messageIds, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->post( Endpoint::bind( Endpoint::CHANNEL_MESSAGES_BULK_DELETE, @@ -366,13 +366,13 @@ public function bulkDeleteMessages( /** * @see https://discord.com/developers/docs/resources/channel#edit-channel-permissions * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function editChannelPermissions( string $channelId, EditPermissionsBuilder $editPermissionsBuilder, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->put( Endpoint::bind( Endpoint::CHANNEL_PERMISSIONS, @@ -387,9 +387,9 @@ public function editChannelPermissions( /** * @see https://discord.com/developers/docs/resources/invite#invite-object * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Invite> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Invite> */ - public function getChannelInvites(string $channelId): ExtendedPromiseInterface + public function getChannelInvites(string $channelId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -405,13 +405,13 @@ public function getChannelInvites(string $channelId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/channel#get-channel-invites * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Invite> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Invite> */ public function createChannelInvite( string $channelId, InviteBuilder $inviteBuilder = new InviteBuilder(), ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->post( Endpoint::bind( @@ -428,13 +428,13 @@ public function createChannelInvite( /** * @see https://discord.com/developers/docs/resources/channel#delete-channel-permission * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function deleteChannelPermissions( string $channelId, string $overwriteId, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->delete( Endpoint::bind( Endpoint::CHANNEL_PERMISSIONS, @@ -449,9 +449,9 @@ public function deleteChannelPermissions( /** * @see https://discord.com/developers/docs/resources/channel#follow-announcement-channel * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function followAnnouncementChannel(string $channelId, string $webhookChannelId): ExtendedPromiseInterface + public function followAnnouncementChannel(string $channelId, string $webhookChannelId): PromiseInterface { return $this->http->post( Endpoint::bind( @@ -465,9 +465,9 @@ public function followAnnouncementChannel(string $channelId, string $webhookChan /** * @see https://discord.com/developers/docs/resources/channel#trigger-typing-indicator * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function triggerTypingIndicator(string $channelId): ExtendedPromiseInterface + public function triggerTypingIndicator(string $channelId): PromiseInterface { return $this->http->post( Endpoint::bind( @@ -480,9 +480,9 @@ public function triggerTypingIndicator(string $channelId): ExtendedPromiseInterf /** * @see https://discord.com/developers/docs/resources/channel#get-pinned-messages * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Message[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Message[]> */ - public function getPinnedMessages(string $channelId): ExtendedPromiseInterface + public function getPinnedMessages(string $channelId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -498,9 +498,9 @@ public function getPinnedMessages(string $channelId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/channel#pin-message * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function pinMessage(string $channelId, string $messageId): ExtendedPromiseInterface + public function pinMessage(string $channelId, string $messageId): PromiseInterface { return $this->http->put( Endpoint::bind( @@ -514,9 +514,9 @@ public function pinMessage(string $channelId, string $messageId): ExtendedPromis /** * @see https://discord.com/developers/docs/resources/channel#unpin-message * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function unpinMessage(string $channelId, string $messageId): ExtendedPromiseInterface + public function unpinMessage(string $channelId, string $messageId): PromiseInterface { return $this->http->delete( Endpoint::bind( @@ -530,13 +530,13 @@ public function unpinMessage(string $channelId, string $messageId): ExtendedProm /** * @see https://discord.com/developers/docs/resources/channel#start-thread-from-message * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel> */ public function startThreadFromMessage( string $channelId, string $messageId, StartThreadFromMessageBuilder $startThreadFromMessageBuilder - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->post( Endpoint::bind( @@ -553,12 +553,12 @@ public function startThreadFromMessage( /** * @see https://discord.com/developers/docs/resources/channel#start-thread-without-message * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel> */ public function startThreadWithoutMessage( string $channelId, StartThreadWithoutMessageBuilder $startThreadWithoutMessageBuilder - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->post( Endpoint::bind( @@ -574,14 +574,14 @@ public function startThreadWithoutMessage( /** * @see https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel> includes $message property + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel> includes $message property */ public function startThreadInForumChannel( string $channelId, MultipartBody|array $params, ?string $reason = null - ): ExtendedPromiseInterface { - $forumChannelWithMessage = new class () extends Channel { + ): PromiseInterface { + $forumChannelWithMessage = new class() extends Channel { public Message $message; }; @@ -598,9 +598,9 @@ public function startThreadInForumChannel( /** * @see https://discord.com/developers/docs/resources/channel#join-thread * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function joinThread(string $channelId): ExtendedPromiseInterface + public function joinThread(string $channelId): PromiseInterface { return $this->http->put( Endpoint::bind( @@ -613,9 +613,9 @@ public function joinThread(string $channelId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/channel#add-thread-member * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function addThreadMember(string $channelId, string $userId): ExtendedPromiseInterface + public function addThreadMember(string $channelId, string $userId): PromiseInterface { return $this->http->put( Endpoint::bind( @@ -629,9 +629,9 @@ public function addThreadMember(string $channelId, string $userId): ExtendedProm /** * @see https://discord.com/developers/docs/resources/channel#leave-thread * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function leaveThread(string $channelId): ExtendedPromiseInterface + public function leaveThread(string $channelId): PromiseInterface { return $this->http->delete( Endpoint::bind( @@ -644,9 +644,9 @@ public function leaveThread(string $channelId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/channel#remove-thread-member * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function removeThreadMember(string $channelId, string $userId): ExtendedPromiseInterface + public function removeThreadMember(string $channelId, string $userId): PromiseInterface { return $this->http->delete( Endpoint::bind( @@ -660,9 +660,9 @@ public function removeThreadMember(string $channelId, string $userId): ExtendedP /** * @see https://discord.com/developers/docs/resources/channel#get-thread-member * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\ThreadMember> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\ThreadMember> */ - public function getThreadMember(string $channelId, string $userId): ExtendedPromiseInterface + public function getThreadMember(string $channelId, string $userId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -679,19 +679,19 @@ public function getThreadMember(string $channelId, string $userId): ExtendedProm /** * @see https://discord.com/developers/docs/resources/channel#list-thread-members * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\ThreadMember[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\ThreadMember[]> */ public function listThreadMembers( string $channelId, ?bool $withMember = null, ?string $after = null, ?int $limit = null, - ): ExtendedPromiseInterface { + ): PromiseInterface { $options = array_filter([ 'with_member' => $withMember, 'after' => $after, 'limit' => $limit, - ], static fn ($value) => !is_null($value)); + ], static fn($value) => !is_null($value)); return $this->mapArrayPromise( $this->http->get( @@ -708,9 +708,9 @@ public function listThreadMembers( /** * @see https://discord.com/developers/docs/resources/channel#list-public-archived-threads * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel[]> */ - public function listPublicArchivedThreads(string $channelId): ExtendedPromiseInterface + public function listPublicArchivedThreads(string $channelId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -726,9 +726,9 @@ public function listPublicArchivedThreads(string $channelId): ExtendedPromiseInt /** * @see https://discord.com/developers/docs/resources/channel#list-private-archived-threads * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel[]> */ - public function listPrivateArchivedThreads(string $channelId): ExtendedPromiseInterface + public function listPrivateArchivedThreads(string $channelId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -744,9 +744,9 @@ public function listPrivateArchivedThreads(string $channelId): ExtendedPromiseIn /** * @see https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel[]> */ - public function listJoinedPrivateArchivedThreads(string $channelId): ExtendedPromiseInterface + public function listJoinedPrivateArchivedThreads(string $channelId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( diff --git a/src/Rest/Emoji.php b/src/Rest/Emoji.php index d010d526..898fcbb1 100644 --- a/src/Rest/Emoji.php +++ b/src/Rest/Emoji.php @@ -7,7 +7,7 @@ use Discord\Http\Endpoint; use Ragnarok\Fenrir\Parts\Emoji as PartsEmoji; use Ragnarok\Fenrir\Rest\Helpers\Emoji\CreateEmojiBuilder; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/emoji @@ -17,9 +17,9 @@ class Emoji extends HttpResource /** * @see https://discord.com/developers/docs/resources/emoji#list-guild-emojis * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Emoji[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Emoji[]> */ - public function listGuildEmojis(string $guildId): ExtendedPromiseInterface + public function listGuildEmojis(string $guildId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -35,9 +35,9 @@ public function listGuildEmojis(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/emoji#get-guild-emoji * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Emoji> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Emoji> */ - public function getGuildEmoji(string $guildId, string $emojiId): ExtendedPromiseInterface + public function getGuildEmoji(string $guildId, string $emojiId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -54,13 +54,13 @@ public function getGuildEmoji(string $guildId, string $emojiId): ExtendedPromise /** * @see https://discord.com/developers/docs/resources/emoji#create-guild-emoji * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Emoji> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Emoji> */ public function createGuildEmoji( string $guildId, CreateEmojiBuilder $emojiBuilder, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->post( Endpoint::bind( @@ -77,14 +77,14 @@ public function createGuildEmoji( /** * @see https://discord.com/developers/docs/resources/emoji#modify-guild-emoji * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Emoji> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Emoji> */ public function modifyGuildEmoji( string $guildId, string $emojiId, CreateEmojiBuilder $emojiBuilder, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->patch( Endpoint::bind( @@ -102,13 +102,13 @@ public function modifyGuildEmoji( /** * @see https://discord.com/developers/docs/resources/emoji#delete-guild-emoji * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function deleteGuildEmoji( string $guildId, string $emojiId, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->delete( Endpoint::bind( Endpoint::GUILD_EMOJI, @@ -123,9 +123,9 @@ public function deleteGuildEmoji( /** * @see https://discord.com/developers/docs/resources/emoji#list-application-emojis * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Emoji[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Emoji[]> */ - public function listApplicationEmojis(string $applicationId): ExtendedPromiseInterface + public function listApplicationEmojis(string $applicationId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -141,9 +141,9 @@ public function listApplicationEmojis(string $applicationId): ExtendedPromiseInt /** * @see https://discord.com/developers/docs/resources/emoji#get-application-emoji * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Emoji> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Emoji> */ - public function getApplicationEmoji(string $guildId, string $emojiId): ExtendedPromiseInterface + public function getApplicationEmoji(string $guildId, string $emojiId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -160,12 +160,12 @@ public function getApplicationEmoji(string $guildId, string $emojiId): ExtendedP /** * @see https://discord.com/developers/docs/resources/emoji#create-application-emoji * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Emoji> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Emoji> */ public function createApplicationEmoji( string $applicationId, CreateEmojiBuilder $emojiBuilder, - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->post( Endpoint::bind( @@ -181,13 +181,13 @@ public function createApplicationEmoji( /** * @see https://discord.com/developers/docs/resources/emoji#modify-application-emoji * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Emoji> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Emoji> */ public function modifyApplicationEmoji( string $applicationId, string $emojiId, CreateEmojiBuilder $emojiBuilder, - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->patch( Endpoint::bind( @@ -204,12 +204,12 @@ public function modifyApplicationEmoji( /** * @see https://discord.com/developers/docs/resources/emoji#delete-application-emoji * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function deleteApplicationEmoji( string $applicationId, string $emojiId, - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->delete( Endpoint::bind( 'applications/:application/emojis/:emoji', diff --git a/src/Rest/GlobalCommand.php b/src/Rest/GlobalCommand.php index d7df403e..2e939301 100644 --- a/src/Rest/GlobalCommand.php +++ b/src/Rest/GlobalCommand.php @@ -7,14 +7,14 @@ use Discord\Http\Endpoint; use Ragnarok\Fenrir\Parts\ApplicationCommand; use Ragnarok\Fenrir\Rest\Helpers\Command\CommandBuilder; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/interactions/application-commands */ class GlobalCommand extends HttpResource { - public function getCommands(string $applicationId, bool $withLocalizations = false): ExtendedPromiseInterface + public function getCommands(string $applicationId, bool $withLocalizations = false): PromiseInterface { $endpoint = Endpoint::bind(Endpoint::GLOBAL_APPLICATION_COMMANDS, $applicationId); $endpoint->addQuery('with_localizations', $withLocalizations); @@ -30,12 +30,12 @@ public function getCommands(string $applicationId, bool $withLocalizations = fal /** * @see https://discord.com/developers/docs/interactions/application-commands#making-a-global-command * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationCommand> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationCommand> */ public function createApplicationCommand( string $applicationId, CommandBuilder $commandBuilder - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->post( Endpoint::bind( @@ -52,12 +52,12 @@ public function createApplicationCommand( /** * @see https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function deleteApplicationCommand( string $applicationId, string $commandId - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->delete( Endpoint::bind( Endpoint::GLOBAL_APPLICATION_COMMAND, diff --git a/src/Rest/Guild.php b/src/Rest/Guild.php index 0d3d8eb0..a587fb52 100644 --- a/src/Rest/Guild.php +++ b/src/Rest/Guild.php @@ -22,7 +22,7 @@ use Ragnarok\Fenrir\Parts\Widget; use Ragnarok\Fenrir\Parts\WidgetSettings; use Ragnarok\Fenrir\Rest\Helpers\Guild\ModifyChannelPositionsBuilder; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/guild @@ -37,11 +37,11 @@ class Guild extends HttpResource /** * @see https://discord.com/developers/docs/resources/guild#create-guild * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Guild> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Guild> * * @todo Convert to builder */ - public function create(array $params): ExtendedPromiseInterface + public function create(array $params): PromiseInterface { return $this->mapPromise( $this->http->post( @@ -55,9 +55,9 @@ public function create(array $params): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild#get-guild * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Guild> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Guild> */ - public function get(string $guildId, bool $withCounts = false): ExtendedPromiseInterface + public function get(string $guildId, bool $withCounts = false): PromiseInterface { $endpoint = Endpoint::bind( Endpoint::GUILD, @@ -79,9 +79,9 @@ public function get(string $guildId, bool $withCounts = false): ExtendedPromiseI /** * @see https://discord.com/developers/docs/resources/guild#get-guild-preview * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildPreview> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildPreview> */ - public function getPreview(string $guildId): ExtendedPromiseInterface + public function getPreview(string $guildId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -97,11 +97,11 @@ public function getPreview(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild#modify-guild * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Guild> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Guild> * * @todo Convert to builder */ - public function modify(string $guildId, array $params, ?string $reason = null): ExtendedPromiseInterface + public function modify(string $guildId, array $params, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->patch( @@ -119,9 +119,9 @@ public function modify(string $guildId, array $params, ?string $reason = null): /** * @see https://discord.com/developers/docs/resources/guild#delete-guild * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function delete(string $guildId): ExtendedPromiseInterface + public function delete(string $guildId): PromiseInterface { return $this->http->delete( Endpoint::bind( @@ -134,9 +134,9 @@ public function delete(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild#get-guild-channels * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel[]> */ - public function getChannels(string $guildId): ExtendedPromiseInterface + public function getChannels(string $guildId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -152,11 +152,11 @@ public function getChannels(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild#create-guild-channel * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel> * * @todo Convert to builder */ - public function createChannel(string $guildId, array $params, ?string $reason = null): ExtendedPromiseInterface + public function createChannel(string $guildId, array $params, ?string $reason = null): PromiseInterface { return $this->mapArrayPromise( $this->http->post( @@ -174,27 +174,27 @@ public function createChannel(string $guildId, array $params, ?string $reason = /** * @param ModifyChannelPositionsBuilder[] $modifyChannelPositionsBuilders * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function modifyChannelPositions( string $guildId, array $modifyChannelPositionsBuilders - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->patch( Endpoint::bind( Endpoint::GUILD_CHANNELS, $guildId, ), - array_map(fn (ModifyChannelPositionsBuilder $builder) => $builder->get(), $modifyChannelPositionsBuilders) + array_map(fn(ModifyChannelPositionsBuilder $builder) => $builder->get(), $modifyChannelPositionsBuilders) )->otherwise($this->logThrowable(...)); } /** * @see https://discord.com/developers/docs/resources/guild#list-active-guild-threads * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\ActiveGuildThreads> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\ActiveGuildThreads> */ - public function listActiveThreads(string $guildId): ExtendedPromiseInterface + public function listActiveThreads(string $guildId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -210,9 +210,9 @@ public function listActiveThreads(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild#get-guild-member * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildMember> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildMember> */ - public function getMember(string $guildId, string $memberId): ExtendedPromiseInterface + public function getMember(string $guildId, string $memberId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -229,11 +229,11 @@ public function getMember(string $guildId, string $memberId): ExtendedPromiseInt /** * @see https://discord.com/developers/docs/resources/guild#list-guild-members * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildMember[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildMember[]> * * @todo Convert to builder */ - public function listMembers(string $guildId, array $queryParams): ExtendedPromiseInterface + public function listMembers(string $guildId, array $queryParams): PromiseInterface { $endpoint = Endpoint::bind( Endpoint::GUILD_MEMBERS_SEARCH, @@ -253,9 +253,9 @@ public function listMembers(string $guildId, array $queryParams): ExtendedPromis /** * @see https://discord.com/developers/docs/resources/guild#search-guild-members * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildMember[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildMember[]> */ - public function searchMembers(string $guildId, array $queryParams): ExtendedPromiseInterface + public function searchMembers(string $guildId, array $queryParams): PromiseInterface { $endpoint = Endpoint::bind( Endpoint::GUILD_MEMBERS_SEARCH, @@ -275,9 +275,9 @@ public function searchMembers(string $guildId, array $queryParams): ExtendedProm /** * @see https://discord.com/developers/docs/resources/guild#add-guild-member * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildMember> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildMember> */ - public function addMember(string $guildId, string $userId, array $params): ExtendedPromiseInterface + public function addMember(string $guildId, string $userId, array $params): PromiseInterface { return $this->mapPromise( $this->http->put( @@ -295,14 +295,14 @@ public function addMember(string $guildId, string $userId, array $params): Exten /** * @see https://discord.com/developers/docs/resources/guild#modify-guild-member * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function modifyMember( string $guildId, string $userId, array $params, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->patch( Endpoint::bind( Endpoint::GUILD_MEMBER, @@ -317,13 +317,13 @@ public function modifyMember( /** * @see https://discord.com/developers/docs/resources/guild#modify-current-member * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function modifyCurrentMember( string $guildId, array $params, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->patch( Endpoint::bind( Endpoint::GUILD_MEMBER_SELF, @@ -337,14 +337,14 @@ public function modifyCurrentMember( /** * @see https://discord.com/developers/docs/resources/guild#add-guild-member-role * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function addMemberRole( string $guildId, string $userId, string $roleId, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->put( Endpoint::bind( Endpoint::GUILD_MEMBER_ROLE, @@ -359,14 +359,14 @@ public function addMemberRole( /** * @see https://discord.com/developers/docs/resources/guild#remove-guild-member-role * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function removeMemberRole( string $guildId, string $userId, string $roleId, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->delete( Endpoint::bind( Endpoint::GUILD_MEMBER_ROLE, @@ -381,9 +381,9 @@ public function removeMemberRole( /** * @see https://discord.com/developers/docs/resources/guild#remove-guild-member * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function removeGuildMember(string $guildId, string $userId, ?string $reason = null): ExtendedPromiseInterface + public function removeGuildMember(string $guildId, string $userId, ?string $reason = null): PromiseInterface { return $this->http->delete( Endpoint::bind( @@ -398,9 +398,9 @@ public function removeGuildMember(string $guildId, string $userId, ?string $reas /** * @see https://discord.com/developers/docs/resources/guild#get-guild-bans * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildBan[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildBan[]> */ - public function getBans(string $guildId): ExtendedPromiseInterface + public function getBans(string $guildId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -416,9 +416,9 @@ public function getBans(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild#get-guild-ban * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildBan[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildBan[]> */ - public function getBan(string $guildId, string $userId): ExtendedPromiseInterface + public function getBan(string $guildId, string $userId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -435,14 +435,14 @@ public function getBan(string $guildId, string $userId): ExtendedPromiseInterfac /** * @see https://discord.com/developers/docs/resources/guild#create-guild-ban * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function createBan( string $guildId, string $userId, array $params, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->put( Endpoint::bind( Endpoint::GUILD_BAN, @@ -457,9 +457,9 @@ public function createBan( /** * @see https://discord.com/developers/docs/resources/guild#remove-guild-ban * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function removeBan(string $guildId, string $userId, ?string $reason = null): ExtendedPromiseInterface + public function removeBan(string $guildId, string $userId, ?string $reason = null): PromiseInterface { return $this->http->delete( Endpoint::bind( @@ -474,9 +474,9 @@ public function removeBan(string $guildId, string $userId, ?string $reason = nul /** * @see https://discord.com/developers/docs/resources/guild#get-guild-roles * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Role[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Role[]> */ - public function getRoles(string $guildId): ExtendedPromiseInterface + public function getRoles(string $guildId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -492,9 +492,9 @@ public function getRoles(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild#get-guild-role * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Role> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Role> */ - public function getRole(string $guildId, string $roleId): ExtendedPromiseInterface + public function getRole(string $guildId, string $roleId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -511,9 +511,9 @@ public function getRole(string $guildId, string $roleId): ExtendedPromiseInterfa /** * @see https://discord.com/developers/docs/resources/guild#create-guild-role * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Role> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Role> */ - public function createRole(string $guildId, array $params, ?string $reason = null): ExtendedPromiseInterface + public function createRole(string $guildId, array $params, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->post( @@ -531,13 +531,13 @@ public function createRole(string $guildId, array $params, ?string $reason = nul /** * @see https://discord.com/developers/docs/resources/guild#modify-guild-role-positions * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Role[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Role[]> */ public function modifyRolePositions( string $guildId, array $params, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapArrayPromise( $this->http->patch( Endpoint::bind( @@ -554,14 +554,14 @@ public function modifyRolePositions( /** * @see https://discord.com/developers/docs/resources/guild#modify-guild-role * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Role> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Role> */ public function modifyRole( string $guildId, string $roleId, array $params, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->patch( Endpoint::bind( @@ -579,13 +579,13 @@ public function modifyRole( /** * @see https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function modifyMfaLevel( string $guildId, MfaLevel $mfaLevel, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->post( Endpoint::bind( Endpoint::GUILD_MFA, @@ -599,9 +599,9 @@ public function modifyMfaLevel( /** * @see https://discord.com/developers/docs/resources/guild#delete-guild-role * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function deleteRole(string $guildId, string $roleId, ?string $reason = null): ExtendedPromiseInterface + public function deleteRole(string $guildId, string $roleId, ?string $reason = null): PromiseInterface { return $this->http->delete( Endpoint::bind( @@ -616,9 +616,9 @@ public function deleteRole(string $guildId, string $roleId, ?string $reason = nu /** * @see https://discord.com/developers/docs/resources/guild#get-guild-prune-count * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\PruneCount> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\PruneCount> */ - public function getPruneCount(string $guildId, array $queryParams): ExtendedPromiseInterface + public function getPruneCount(string $guildId, array $queryParams): PromiseInterface { $endpoint = Endpoint::bind( Endpoint::GUILD_PRUNE, @@ -640,9 +640,9 @@ public function getPruneCount(string $guildId, array $queryParams): ExtendedProm /** * @see https://discord.com/developers/docs/resources/guild#begin-guild-prune * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\PruneCount> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\PruneCount> */ - public function beginPrune(string $guildId, array $params, ?string $reason = null): ExtendedPromiseInterface + public function beginPrune(string $guildId, array $params, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->post( @@ -660,9 +660,9 @@ public function beginPrune(string $guildId, array $params, ?string $reason = nul /** * @see https://discord.com/developers/docs/resources/guild#get-guild-voice-regions * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\VoiceRegion> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\VoiceRegion> */ - public function getVoiceRegions(string $guildId): ExtendedPromiseInterface + public function getVoiceRegions(string $guildId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -678,9 +678,9 @@ public function getVoiceRegions(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/voice#get-current-user-voice-state * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\VoiceState> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\VoiceState> */ - public function getCurrentUserVoiceState(string $guildId): ExtendedPromiseInterface + public function getCurrentUserVoiceState(string $guildId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -696,9 +696,9 @@ public function getCurrentUserVoiceState(string $guildId): ExtendedPromiseInterf /** * @see https://discord.com/developers/docs/resources/voice#get-user-voice-state * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\VoiceState> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\VoiceState> */ - public function getUserVoiceState(string $guildId, string $userId): ExtendedPromiseInterface + public function getUserVoiceState(string $guildId, string $userId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -715,9 +715,9 @@ public function getUserVoiceState(string $guildId, string $userId): ExtendedProm /** * @see https://discord.com/developers/docs/resources/guild#get-guild-invites * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Invite> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Invite> */ - public function getInvites(string $guildId): ExtendedPromiseInterface + public function getInvites(string $guildId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -733,9 +733,9 @@ public function getInvites(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild#get-guild-integrations * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Integration> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Integration> */ - public function getIntegrations(string $guildId): ExtendedPromiseInterface + public function getIntegrations(string $guildId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -751,13 +751,13 @@ public function getIntegrations(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild#delete-guild-integration * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function deleteIntegration( string $guildId, string $integrationId, ?string $reason = null - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->delete( Endpoint::bind( Endpoint::GUILD_INTEGRATION, @@ -771,9 +771,9 @@ public function deleteIntegration( /** * @see https://discord.com/developers/docs/resources/guild#get-guild-widget-settings * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\WidgetSettings> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\WidgetSettings> */ - public function getWidgetSettings(string $guildId): ExtendedPromiseInterface + public function getWidgetSettings(string $guildId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -789,9 +789,9 @@ public function getWidgetSettings(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild#modify-guild-widget * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\WidgetSettings> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\WidgetSettings> */ - public function modifyWidget(string $guildId, array $params, ?string $reason = null): ExtendedPromiseInterface + public function modifyWidget(string $guildId, array $params, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->patch( @@ -809,9 +809,9 @@ public function modifyWidget(string $guildId, array $params, ?string $reason = n /** * @see https://discord.com/developers/docs/resources/guild#get-guild-widget * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Widget> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Widget> */ - public function getWidget(string $guildId): ExtendedPromiseInterface + public function getWidget(string $guildId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -827,9 +827,9 @@ public function getWidget(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild#get-guild-vanity-url * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Invite> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Invite> */ - public function getVanityUrl(string $guildId): ExtendedPromiseInterface + public function getVanityUrl(string $guildId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -864,9 +864,9 @@ public function getWidgetImage(string $guildId, array $queryParams): string /** * @see https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\WelcomeScreen> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\WelcomeScreen> */ - public function getWelcomeScreen(string $guildId): ExtendedPromiseInterface + public function getWelcomeScreen(string $guildId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -882,9 +882,9 @@ public function getWelcomeScreen(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function modifyCurrentUserVoiceState(string $guildId, array $params): ExtendedPromiseInterface + public function modifyCurrentUserVoiceState(string $guildId, array $params): PromiseInterface { return $this->http->patch( Endpoint::bind( @@ -898,9 +898,9 @@ public function modifyCurrentUserVoiceState(string $guildId, array $params): Ext /** * @see https://discord.com/developers/docs/resources/guild#modify-user-voice-state * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function modifyUserVoiceState(string $guildId, string $userId, array $params): ExtendedPromiseInterface + public function modifyUserVoiceState(string $guildId, string $userId, array $params): PromiseInterface { return $this->http->patch( Endpoint::bind( diff --git a/src/Rest/GuildAutoModeration.php b/src/Rest/GuildAutoModeration.php index 958d324a..29db2dab 100644 --- a/src/Rest/GuildAutoModeration.php +++ b/src/Rest/GuildAutoModeration.php @@ -6,7 +6,7 @@ use Discord\Http\Endpoint; use Ragnarok\Fenrir\Parts\AutoModerationRuleObject; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/auto-moderation @@ -15,9 +15,9 @@ class GuildAutoModeration extends HttpResource { /** * @see https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\AutoModerationRuleObject[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\AutoModerationRuleObject[]> */ - public function list(string $guildId): ExtendedPromiseInterface + public function list(string $guildId): PromiseInterface { return $this->mapArrayPromise( $this->http->get(Endpoint::bind(Endpoint::GUILD_AUTO_MODERATION_RULES, $guildId)), @@ -27,9 +27,9 @@ public function list(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\AutoModerationRuleObject> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\AutoModerationRuleObject> */ - public function get(string $guildId, string $autoModerationRuleId): ExtendedPromiseInterface + public function get(string $guildId, string $autoModerationRuleId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -45,9 +45,9 @@ public function get(string $guildId, string $autoModerationRuleId): ExtendedProm /** * @see https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\AutoModerationRuleObject> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\AutoModerationRuleObject> */ - public function create(string $guildId, array $params, ?string $reason = null): ExtendedPromiseInterface + public function create(string $guildId, array $params, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->post( @@ -64,9 +64,9 @@ public function create(string $guildId, array $params, ?string $reason = null): /** * @see https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\AutoModerationRuleObject> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\AutoModerationRuleObject> */ - public function modify(string $guildId, string $autoModerationRuleId, array $params, ?string $reason = null): ExtendedPromiseInterface + public function modify(string $guildId, string $autoModerationRuleId, array $params, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->patch( @@ -84,9 +84,9 @@ public function modify(string $guildId, string $autoModerationRuleId, array $par /** * @see https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function delete(string $guildId, string $autoModerationRuleId, ?string $reason = null): ExtendedPromiseInterface + public function delete(string $guildId, string $autoModerationRuleId, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->delete( diff --git a/src/Rest/GuildCommand.php b/src/Rest/GuildCommand.php index d1a4e8af..8ae6149b 100644 --- a/src/Rest/GuildCommand.php +++ b/src/Rest/GuildCommand.php @@ -7,7 +7,7 @@ use Discord\Http\Endpoint; use Ragnarok\Fenrir\Parts\ApplicationCommand; use Ragnarok\Fenrir\Rest\Helpers\Command\CommandBuilder; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/interactions/application-commands @@ -17,9 +17,9 @@ class GuildCommand extends HttpResource /** * @see https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationCommand[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationCommand[]> */ - public function getCommands(string $guildId, string $applicationId, bool $withLocalizations = false): ExtendedPromiseInterface + public function getCommands(string $guildId, string $applicationId, bool $withLocalizations = false): PromiseInterface { $endpoint = Endpoint::bind(Endpoint::GUILD_APPLICATION_COMMANDS, $applicationId, $guildId); $endpoint->addQuery('with_localizations', $withLocalizations); @@ -35,13 +35,13 @@ public function getCommands(string $guildId, string $applicationId, bool $withLo /** * @see https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationCommand> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationCommand> */ public function createApplicationCommand( string $applicationId, string $guildId, CommandBuilder $commandBuilder - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->post( Endpoint::bind( @@ -58,13 +58,13 @@ public function createApplicationCommand( /** * @see https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function deleteApplicationCommand( string $applicationId, string $guildId, string $commandId - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->delete( Endpoint::bind( Endpoint::GUILD_APPLICATION_COMMAND, diff --git a/src/Rest/GuildScheduledEvent.php b/src/Rest/GuildScheduledEvent.php index 4ef1de2d..16578030 100644 --- a/src/Rest/GuildScheduledEvent.php +++ b/src/Rest/GuildScheduledEvent.php @@ -7,7 +7,7 @@ use Discord\Http\Endpoint; use Ragnarok\Fenrir\Parts\GuildScheduledEvent as PartsGuildScheduledEvent; use Ragnarok\Fenrir\Parts\GuildScheduledEventUser; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/guild-scheduled-event @@ -16,9 +16,9 @@ class GuildScheduledEvent extends HttpResource { /** * @see https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildScheduledEvent[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildScheduledEvent[]> */ - public function list(string $guildId, bool $withUserCount = false): ExtendedPromiseInterface + public function list(string $guildId, bool $withUserCount = false): PromiseInterface { $endpoint = Endpoint::bind(Endpoint::GUILD_SCHEDULED_EVENTS, $guildId); $endpoint->addQuery('with_user_count', $withUserCount); @@ -33,9 +33,9 @@ public function list(string $guildId, bool $withUserCount = false): ExtendedProm /** * @see https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildScheduledEvent> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildScheduledEvent> */ - public function get(string $guildId, string $scheduledEventId, bool $withUserCount = false): ExtendedPromiseInterface + public function get(string $guildId, string $scheduledEventId, bool $withUserCount = false): PromiseInterface { $endpoint = Endpoint::bind(Endpoint::GUILD_SCHEDULED_EVENT, $guildId, $scheduledEventId); $endpoint->addQuery('with_user_count', $withUserCount); @@ -50,9 +50,9 @@ public function get(string $guildId, string $scheduledEventId, bool $withUserCou /** * @see https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildScheduledEvent> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildScheduledEvent> */ - public function create(string $guildId, array $params, ?string $reason = null): ExtendedPromiseInterface + public function create(string $guildId, array $params, ?string $reason = null): PromiseInterface { return $this->mapArrayPromise( $this->http->post( @@ -66,9 +66,9 @@ public function create(string $guildId, array $params, ?string $reason = null): /** * @see https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildScheduledEvent> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildScheduledEvent> */ - public function modify(string $guildId, string $scheduledEventId, array $params, ?string $reason = null): ExtendedPromiseInterface + public function modify(string $guildId, string $scheduledEventId, array $params, ?string $reason = null): PromiseInterface { return $this->mapArrayPromise( $this->http->patch( @@ -82,9 +82,9 @@ public function modify(string $guildId, string $scheduledEventId, array $params, /** * @see https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function delete(string $guildId, string $scheduledEventId): ExtendedPromiseInterface + public function delete(string $guildId, string $scheduledEventId): PromiseInterface { return $this->http->delete( Endpoint::bind(Endpoint::GUILD_SCHEDULED_EVENT, $guildId, $scheduledEventId), @@ -101,7 +101,7 @@ public function getUsers( bool $withMembers = false, ?string $before = null, ?string $after = null, - ): ExtendedPromiseInterface { + ): PromiseInterface { $endpoint = Endpoint::bind(Endpoint::GUILD_SCHEDULED_EVENT_USERS, $guildId, $scheduledEventId); $endpoint->addQuery('limit', $limit); diff --git a/src/Rest/GuildSticker.php b/src/Rest/GuildSticker.php index ff50a186..fec78f0f 100644 --- a/src/Rest/GuildSticker.php +++ b/src/Rest/GuildSticker.php @@ -8,7 +8,7 @@ use Ragnarok\Fenrir\Parts\Sticker; use Ragnarok\Fenrir\Rest\Helpers\GuildSticker\ModifyStickerBuilder; use Ragnarok\Fenrir\Rest\Helpers\GuildSticker\StickerBuilder; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/sticker @@ -18,9 +18,9 @@ class GuildSticker extends HttpResource /** * @see https://discord.com/developers/docs/resources/sticker#list-guild-stickers * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Sticker[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Sticker[]> */ - public function list(string $guildId): ExtendedPromiseInterface + public function list(string $guildId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -36,9 +36,9 @@ public function list(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/sticker#get-guild-sticker * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Sticker> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Sticker> */ - public function get(string $guildId, string $stickerId): ExtendedPromiseInterface + public function get(string $guildId, string $stickerId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -55,9 +55,9 @@ public function get(string $guildId, string $stickerId): ExtendedPromiseInterfac /** * @see https://discord.com/developers/docs/resources/sticker#get-guild-sticker * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Sticker> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Sticker> */ - public function create(string $guildId, StickerBuilder $stickerBuilder): ExtendedPromiseInterface + public function create(string $guildId, StickerBuilder $stickerBuilder): PromiseInterface { return $this->mapPromise( $this->http->post( @@ -73,13 +73,13 @@ public function create(string $guildId, StickerBuilder $stickerBuilder): Extende /** * @see https://discord.com/developers/docs/resources/sticker#modify-guild-sticker - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Sticker> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Sticker> */ public function modify( string $guildId, string $stickerId, ModifyStickerBuilder $modifyStickerBuilder - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->patch( Endpoint::bind( @@ -96,9 +96,9 @@ public function modify( /** * @see https://discord.com/developers/docs/resources/sticker#delete-guild-sticker * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function delete(string $guildId, string $stickerId): ExtendedPromiseInterface + public function delete(string $guildId, string $stickerId): PromiseInterface { return $this->http->delete( Endpoint::bind( diff --git a/src/Rest/GuildTemplate.php b/src/Rest/GuildTemplate.php index 8b910d7a..9d29c154 100644 --- a/src/Rest/GuildTemplate.php +++ b/src/Rest/GuildTemplate.php @@ -8,7 +8,7 @@ use Ragnarok\Fenrir\Parts\Guild; use Ragnarok\Fenrir\Parts\GuildTemplate as PartsGuildTemplate; use Ragnarok\Fenrir\Rest\Helpers\HttpHelper; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/guild-template @@ -17,9 +17,9 @@ class GuildTemplate extends HttpResource { /** * @see https://discord.com/developers/docs/resources/guild-template#get-guild-templates - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildTemplate> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildTemplate> */ - public function list(string $guildId): ExtendedPromiseInterface + public function list(string $guildId): PromiseInterface { return $this->mapArrayPromise( $this->http->get(Endpoint::bind(Endpoint::GUILD_TEMPLATES, $guildId)), @@ -29,9 +29,9 @@ public function list(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild-template#get-guild-template - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildTemplate> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildTemplate> */ - public function get(string $code): ExtendedPromiseInterface + public function get(string $code): PromiseInterface { return $this->mapPromise( $this->http->get(Endpoint::bind(Endpoint::GUILDS_TEMPLATE, $code)), @@ -41,9 +41,9 @@ public function get(string $code): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild-template#create-guild-template - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildTemplate> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildTemplate> */ - public function create(string $guildId, array $params): ExtendedPromiseInterface + public function create(string $guildId, array $params): PromiseInterface { return $this->mapPromise( $this->http->post(Endpoint::bind(Endpoint::GUILD_TEMPLATES, $guildId), $params), @@ -53,9 +53,9 @@ public function create(string $guildId, array $params): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild-template#modify-guild-template - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildTemplate> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildTemplate> */ - public function modify(string $guildId, string $code, array $params): ExtendedPromiseInterface + public function modify(string $guildId, string $code, array $params): PromiseInterface { return $this->mapPromise( $this->http->patch(Endpoint::bind(Endpoint::GUILD_TEMPLATE, $guildId, $code), $params), @@ -65,9 +65,9 @@ public function modify(string $guildId, string $code, array $params): ExtendedPr /** * @see https://discord.com/developers/docs/resources/guild-template#delete-guild-template - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildTemplate> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildTemplate> */ - public function delete(string $guildId, string $code): ExtendedPromiseInterface + public function delete(string $guildId, string $code): PromiseInterface { return $this->mapPromise( $this->http->delete(Endpoint::bind(Endpoint::GUILD_TEMPLATE, $guildId, $code)), @@ -77,9 +77,9 @@ public function delete(string $guildId, string $code): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/guild-template#create-guild-from-guild-template - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Guild> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Guild> */ - public function createGuildFromTemplate(string $code, array $params): ExtendedPromiseInterface + public function createGuildFromTemplate(string $code, array $params): PromiseInterface { return $this->mapPromise( $this->http->post(Endpoint::bind(Endpoint::GUILD_TEMPLATE, $code), $params), @@ -89,9 +89,9 @@ public function createGuildFromTemplate(string $code, array $params): ExtendedPr /** * @see https://discord.com/developers/docs/resources/guild-template#sync-guild-template - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildTemplate> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildTemplate> */ - public function sync(string $guildId, string $code): ExtendedPromiseInterface + public function sync(string $guildId, string $code): PromiseInterface { return $this->mapPromise( $this->http->put(Endpoint::bind(Endpoint::GUILD_TEMPLATE, $guildId, $code)), diff --git a/src/Rest/HttpResource.php b/src/Rest/HttpResource.php index 7e5865db..17dd8585 100644 --- a/src/Rest/HttpResource.php +++ b/src/Rest/HttpResource.php @@ -7,7 +7,7 @@ use Discord\Http\Http; use Psr\Log\LoggerInterface; use Ragnarok\Fenrir\DataMapper; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; use Throwable; /** @@ -19,17 +19,16 @@ public function __construct( protected Http $http, protected DataMapper $dataMapper, protected LoggerInterface $logger - ) { - } + ) {} - protected function mapPromise(ExtendedPromiseInterface $promise, string $class): ExtendedPromiseInterface + protected function mapPromise(PromiseInterface $promise, string $class): PromiseInterface { return $promise->then(function ($data) use ($class) { return $this->dataMapper->map($data, $class); }); } - protected function mapArrayPromise(ExtendedPromiseInterface $promise, string $class): ExtendedPromiseInterface + protected function mapArrayPromise(PromiseInterface $promise, string $class): PromiseInterface { return $promise->then(function ($data) use ($class) { return $this->dataMapper->mapArray($data, $class); diff --git a/src/Rest/Invite.php b/src/Rest/Invite.php index cbe85c7f..a286e160 100644 --- a/src/Rest/Invite.php +++ b/src/Rest/Invite.php @@ -6,7 +6,7 @@ use Discord\Http\Endpoint; use Ragnarok\Fenrir\Parts\Invite as PartsInvite; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/invite @@ -16,9 +16,9 @@ class Invite extends HttpResource /** * @see https://discord.com/developers/docs/resources/invite#get-invite * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Invite> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Invite> */ - public function get(string $code): ExtendedPromiseInterface + public function get(string $code): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -34,9 +34,9 @@ public function get(string $code): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/invite#delete-invite * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function delete(string $code): ExtendedPromiseInterface + public function delete(string $code): PromiseInterface { return $this->http->delete( Endpoint::bind( diff --git a/src/Rest/StageInstance.php b/src/Rest/StageInstance.php index 8c42dad0..d609e8d2 100644 --- a/src/Rest/StageInstance.php +++ b/src/Rest/StageInstance.php @@ -6,7 +6,7 @@ use Discord\Http\Endpoint; use Ragnarok\Fenrir\Parts\StageInstance as PartsStageInstance; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/application @@ -16,9 +16,9 @@ class StageInstance extends HttpResource /** * @see https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\StageInstance> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\StageInstance> */ - public function createInstance(array $params, ?string $reason = null): ExtendedPromiseInterface + public function createInstance(array $params, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->post( @@ -33,9 +33,9 @@ public function createInstance(array $params, ?string $reason = null): ExtendedP /** * @see https://discord.com/developers/docs/resources/stage-instance#get-stage-instance * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\StageInstance> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\StageInstance> */ - public function getInstances(string $channelId): ExtendedPromiseInterface + public function getInstances(string $channelId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -51,9 +51,9 @@ public function getInstances(string $channelId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\StageInstance> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\StageInstance> */ - public function modifyInstances(string $channelId, array $params, ?string $reason = null): ExtendedPromiseInterface + public function modifyInstances(string $channelId, array $params, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->patch( @@ -71,9 +71,9 @@ public function modifyInstances(string $channelId, array $params, ?string $reaso /** * @see https://discord.com/developers/docs/resources/stage-instance#delete-stage-instance * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function deleteInstances(string $channelId, ?string $reason = null): ExtendedPromiseInterface + public function deleteInstances(string $channelId, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->delete( diff --git a/src/Rest/Sticker.php b/src/Rest/Sticker.php index 2cb04ca4..bd950992 100644 --- a/src/Rest/Sticker.php +++ b/src/Rest/Sticker.php @@ -7,7 +7,7 @@ use Discord\Http\Endpoint; use Ragnarok\Fenrir\Parts\Sticker as PartsSticker; use Ragnarok\Fenrir\Parts\StickerPack; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/sticker @@ -17,9 +17,9 @@ class Sticker extends HttpResource /** * @see https://discord.com/developers/docs/resources/sticker#get-sticker * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Sticker> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Sticker> */ - public function get(string $stickerId): ExtendedPromiseInterface + public function get(string $stickerId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -35,9 +35,9 @@ public function get(string $stickerId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\StickerPack[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\StickerPack[]> */ - public function listNitroPacks(): ExtendedPromiseInterface + public function listNitroPacks(): PromiseInterface { return $this->mapArrayPromise( $this->http->get( diff --git a/src/Rest/User.php b/src/Rest/User.php index aae07637..293aaea5 100644 --- a/src/Rest/User.php +++ b/src/Rest/User.php @@ -9,7 +9,7 @@ use Ragnarok\Fenrir\Parts\Guild; use Ragnarok\Fenrir\Parts\GuildMember; use Ragnarok\Fenrir\Parts\User as PartsUser; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/application @@ -19,9 +19,9 @@ class User extends HttpResource /** * @see https://discord.com/developers/docs/resources/user#get-user * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\User> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\User> */ - public function get(string $userId): ExtendedPromiseInterface + public function get(string $userId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -37,9 +37,9 @@ public function get(string $userId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/user#get-current-user * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\User> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\User> */ - public function getCurrent(): ExtendedPromiseInterface + public function getCurrent(): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -52,9 +52,9 @@ public function getCurrent(): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/user#modify-current-user * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\User> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\User> */ - public function modifyCurrent(array $params): ExtendedPromiseInterface + public function modifyCurrent(array $params): PromiseInterface { return $this->mapPromise( $this->http->patch( @@ -68,14 +68,14 @@ public function modifyCurrent(array $params): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/user#get-current-user-guilds * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Guild> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Guild> */ public function getCurrentUserGuilds( ?string $before = null, ?string $after = null, ?int $limit = null, ?bool $withCounts = null - ): ExtendedPromiseInterface { + ): PromiseInterface { $endpoint = Endpoint::bind(Endpoint::USER_CURRENT_GUILD); if ($before) { @@ -105,9 +105,9 @@ public function getCurrentUserGuilds( /** * @see https://discord.com/developers/docs/resources/user#get-current-user-guild-member * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\GuildMember> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\GuildMember> */ - public function getCurrentUserGuildMember(string $guildId): ExtendedPromiseInterface + public function getCurrentUserGuildMember(string $guildId): PromiseInterface { return $this->mapPromise( $this->http->get( @@ -123,9 +123,9 @@ public function getCurrentUserGuildMember(string $guildId): ExtendedPromiseInter /** * @see https://discord.com/developers/docs/resources/user#leave-guild * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function leaveGuild(string $guildId): ExtendedPromiseInterface + public function leaveGuild(string $guildId): PromiseInterface { return $this->http->delete( Endpoint::bind( @@ -138,9 +138,9 @@ public function leaveGuild(string $guildId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/user#create-dm * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel> */ - public function createDm(string $recipientId): ExtendedPromiseInterface + public function createDm(string $recipientId): PromiseInterface { return $this->mapPromise( $this->http->post( @@ -154,9 +154,9 @@ public function createDm(string $recipientId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/user#create-dm * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Channel> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Channel> */ - public function createGroupDm(array $params): ExtendedPromiseInterface + public function createGroupDm(array $params): PromiseInterface { return $this->mapPromise( $this->http->post( diff --git a/src/Rest/Webhook.php b/src/Rest/Webhook.php index a248ddb8..9eebf64f 100644 --- a/src/Rest/Webhook.php +++ b/src/Rest/Webhook.php @@ -13,7 +13,7 @@ use Ragnarok\Fenrir\Rest\Helpers\Webhook\EditWebhookMessageBuilder; use Ragnarok\Fenrir\Rest\Helpers\Webhook\ModifyWebhookBuilder; use Ragnarok\Fenrir\Rest\Helpers\Webhook\WebhookBuilder; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; /** * @see https://discord.com/developers/docs/resources/webhook @@ -28,7 +28,7 @@ public function createInteractionResponse( string $interactionId, string $interactionToken, InteractionCallbackBuilder $interactionCallbackBuilder - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->post( Endpoint::bind( Endpoint::INTERACTION_RESPONSE, @@ -45,7 +45,7 @@ public function createInteractionResponse( public function getOriginalInteractionResponse( string $applicationId, string $interactionToken - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->get( Endpoint::bind( @@ -65,7 +65,7 @@ public function editOriginalInteractionResponse( string $applicationId, string $interactionToken, EditWebhookBuilder $webhookBuilder - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->mapPromise( $this->http->patch( Endpoint::bind( @@ -85,7 +85,7 @@ public function editOriginalInteractionResponse( public function deleteOriginalInteractionResponse( string $applicationId, string $interactionToken - ): ExtendedPromiseInterface { + ): PromiseInterface { return $this->http->delete( Endpoint::bind( Endpoint::ORIGINAL_INTERACTION_RESPONSE, @@ -98,9 +98,9 @@ public function deleteOriginalInteractionResponse( /** * @see https://discord.com/developers/docs/resources/webhook#create-webhook * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Webhook> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Webhook> */ - public function create(string $channelId, CreateWebhookBuilder $builder, ?string $reason = null): ExtendedPromiseInterface + public function create(string $channelId, CreateWebhookBuilder $builder, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->post( @@ -118,9 +118,9 @@ public function create(string $channelId, CreateWebhookBuilder $builder, ?string /** * @see https://discord.com/developers/docs/resources/webhook#get-channel-webhooks * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Webhook[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Webhook[]> */ - public function getChannelWebhooks(string $channelId): ExtendedPromiseInterface + public function getChannelWebhooks(string $channelId): PromiseInterface { return $this->mapArrayPromise( $this->http->get( @@ -136,7 +136,7 @@ public function getChannelWebhooks(string $channelId): ExtendedPromiseInterface /** * @see https://discord.com/developers/docs/resources/webhook#get-guild-webhooks * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Webhook[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Webhook[]> */ public function getGuildWebhooks(string $guildId) { @@ -154,7 +154,7 @@ public function getGuildWebhooks(string $guildId) /** * @see https://discord.com/developers/docs/resources/webhook#get-webhook * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Webhook[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Webhook[]> */ public function get(string $webhookId) { @@ -172,7 +172,7 @@ public function get(string $webhookId) /** * @see https://discord.com/developers/docs/resources/webhook#get-webhook-with-token * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Webhook[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Webhook[]> */ public function getWithToken(string $webhookId, string $token) { @@ -191,9 +191,9 @@ public function getWithToken(string $webhookId, string $token) /** * @see https://discord.com/developers/docs/resources/webhook#modify-webhook * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Webhook[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Webhook[]> */ - public function modify(string $webhookId, ModifyWebhookBuilder $builder, ?string $reason = null): ExtendedPromiseInterface + public function modify(string $webhookId, ModifyWebhookBuilder $builder, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->patch( @@ -211,9 +211,9 @@ public function modify(string $webhookId, ModifyWebhookBuilder $builder, ?string /** * @see https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Webhook[]> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Webhook[]> */ - public function modifyWithToken(string $webhookId, string $token, ModifyWebhookBuilder $builder, ?string $reason = null): ExtendedPromiseInterface + public function modifyWithToken(string $webhookId, string $token, ModifyWebhookBuilder $builder, ?string $reason = null): PromiseInterface { return $this->mapPromise( $this->http->patch( @@ -232,9 +232,9 @@ public function modifyWithToken(string $webhookId, string $token, ModifyWebhookB /** * @see https://discord.com/developers/docs/resources/webhook#delete-webhook * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function delete(string $webhookId, ?string $reason = null): ExtendedPromiseInterface + public function delete(string $webhookId, ?string $reason = null): PromiseInterface { return $this->http->delete( Endpoint::bind( @@ -248,9 +248,9 @@ public function delete(string $webhookId, ?string $reason = null): ExtendedPromi /** * @see https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function deleteWithToken(string $webhookId, string $token, ?string $reason = null): ExtendedPromiseInterface + public function deleteWithToken(string $webhookId, string $token, ?string $reason = null): PromiseInterface { return $this->http->delete( Endpoint::bind( @@ -265,9 +265,9 @@ public function deleteWithToken(string $webhookId, string $token, ?string $reaso /** * @see https://discord.com/developers/docs/resources/webhook#execute-webhook * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function execute(string $webhookId, string $token, WebhookBuilder $builder, ?bool $wait = null, ?string $threadId = null): ExtendedPromiseInterface + public function execute(string $webhookId, string $token, WebhookBuilder $builder, ?bool $wait = null, ?string $threadId = null): PromiseInterface { $endpoint = Endpoint::bind( Endpoint::WEBHOOK_EXECUTE, @@ -292,9 +292,9 @@ public function execute(string $webhookId, string $token, WebhookBuilder $builde /** * @see https://discord.com/developers/docs/resources/webhook#execute-slackcompatible-webhook * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function executeSlackWebhook(string $webhookId, string $token, array $params, ?bool $wait = null, ?string $threadId = null): ExtendedPromiseInterface + public function executeSlackWebhook(string $webhookId, string $token, array $params, ?bool $wait = null, ?string $threadId = null): PromiseInterface { $endpoint = Endpoint::bind( Endpoint::WEBHOOK_EXECUTE_SLACK, @@ -319,9 +319,9 @@ public function executeSlackWebhook(string $webhookId, string $token, array $par /** * @see https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function executeGithubWebhook(string $webhookId, string $token, array $params, ?bool $wait = null, ?string $threadId = null): ExtendedPromiseInterface + public function executeGithubWebhook(string $webhookId, string $token, array $params, ?bool $wait = null, ?string $threadId = null): PromiseInterface { $endpoint = Endpoint::bind( Endpoint::WEBHOOK_EXECUTE_GITHUB, @@ -346,9 +346,9 @@ public function executeGithubWebhook(string $webhookId, string $token, array $pa /** * @see https://discord.com/developers/docs/resources/webhook#get-webhook-message * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Message> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Message> */ - public function getWebhookMessage(string $webhookId, string $token, string $messageId, ?string $threadId = null): ExtendedPromiseInterface + public function getWebhookMessage(string $webhookId, string $token, string $messageId, ?string $threadId = null): PromiseInterface { $endpoint = Endpoint::bind( Endpoint::WEBHOOK_MESSAGE, @@ -372,9 +372,9 @@ public function getWebhookMessage(string $webhookId, string $token, string $mess /** * @see https://discord.com/developers/docs/resources/webhook#edit-webhook-message * - * @return ExtendedPromiseInterface<\Ragnarok\Fenrir\Parts\Message> + * @return PromiseInterface<\Ragnarok\Fenrir\Parts\Message> */ - public function editWebhookMessage(string $webhookId, string $token, string $messageId, EditWebhookMessageBuilder $builder, ?string $threadId = null): ExtendedPromiseInterface + public function editWebhookMessage(string $webhookId, string $token, string $messageId, EditWebhookMessageBuilder $builder, ?string $threadId = null): PromiseInterface { $endpoint = Endpoint::bind( Endpoint::WEBHOOK_MESSAGE, @@ -399,7 +399,7 @@ public function editWebhookMessage(string $webhookId, string $token, string $mes /** * @see https://discord.com/developers/docs/resources/webhook#delete-webhook-message * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ public function deleteWebhookMessage(string $webhookId, string $token, string $messageId, ?string $threadId = null) { diff --git a/src/Websocket.php b/src/Websocket.php index 78deaf50..687d1460 100644 --- a/src/Websocket.php +++ b/src/Websocket.php @@ -15,7 +15,7 @@ use Ratchet\RFC6455\Messaging\MessageInterface; use React\EventLoop\Loop; use React\EventLoop\LoopInterface; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; use React\Promise\Promise; use React\Socket\Connector as SocketConnector; @@ -53,7 +53,7 @@ private function mustHaveActiveConnection(): void } } - public function open(string $url): ExtendedPromiseInterface + public function open(string $url): PromiseInterface { $this->logger->debug('Client: Attempting connection', ['url' => $url]); @@ -73,7 +73,7 @@ public function open(string $url): ExtendedPromiseInterface $this->emit(WebsocketEvents::CLOSE, [$code, $reason]); }); - $resolver(); + $resolver(null); }, function (\Exception $e) use ($url, $reject) { $this->logger->error( 'Client: Error connecting to server', diff --git a/src/WebsocketInterface.php b/src/WebsocketInterface.php index 41dea06d..47404445 100644 --- a/src/WebsocketInterface.php +++ b/src/WebsocketInterface.php @@ -6,11 +6,11 @@ use Evenement\EventEmitterInterface; use JsonSerializable; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; interface WebsocketInterface extends EventEmitterInterface { - public function open(string $url): ExtendedPromiseInterface; + public function open(string $url): PromiseInterface; public function close(int $code, string $reason): void; public function send(string $message, bool $useBucket = true): void; public function sendAsJson(array|JsonSerializable $item, bool $useBucket): void; From e7b79bbfde0925973945877d27580a2a9fc741f5 Mon Sep 17 00:00:00 2001 From: Naneynonn Date: Wed, 20 Nov 2024 01:57:00 +0200 Subject: [PATCH 2/3] replace otherwise to catch --- src/Rest/Application.php | 4 +- .../ApplicationRoleConnectionMetadata.php | 4 +- src/Rest/AuditLog.php | 2 +- src/Rest/Channel.php | 74 ++++++++-------- src/Rest/Emoji.php | 20 ++--- src/Rest/GlobalCommand.php | 4 +- src/Rest/Guild.php | 86 +++++++++---------- src/Rest/GuildAutoModeration.php | 10 +-- src/Rest/GuildCommand.php | 4 +- src/Rest/GuildScheduledEvent.php | 12 +-- src/Rest/GuildSticker.php | 10 +-- src/Rest/Invite.php | 4 +- src/Rest/StageInstance.php | 8 +- src/Rest/Sticker.php | 4 +- src/Rest/User.php | 16 ++-- src/Rest/Webhook.php | 38 ++++---- 16 files changed, 150 insertions(+), 150 deletions(-) diff --git a/src/Rest/Application.php b/src/Rest/Application.php index 60c600ab..76619565 100644 --- a/src/Rest/Application.php +++ b/src/Rest/Application.php @@ -24,7 +24,7 @@ public function getCurrent(): PromiseInterface 'applications/@me' // @todo update endpoint to Endpoint:: when available ), PartsApplication::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -40,6 +40,6 @@ public function editCurrent(array $params): PromiseInterface $params, ), PartsApplication::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/ApplicationRoleConnectionMetadata.php b/src/Rest/ApplicationRoleConnectionMetadata.php index 9f6228af..1d3ef9db 100644 --- a/src/Rest/ApplicationRoleConnectionMetadata.php +++ b/src/Rest/ApplicationRoleConnectionMetadata.php @@ -25,7 +25,7 @@ public function getRecords(): PromiseInterface Endpoint::APPLICATION_ROLE_CONNECTION_METADATA, ), PartsApplicationRoleConnectionMetadata::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -41,6 +41,6 @@ public function updateRecords(array $params): PromiseInterface $params, ), PartsApplicationRoleConnectionMetadata::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/AuditLog.php b/src/Rest/AuditLog.php index 4fbd95c8..f2b7d332 100644 --- a/src/Rest/AuditLog.php +++ b/src/Rest/AuditLog.php @@ -32,6 +32,6 @@ public function getGuildAuditLogs( $getGuildAuditLogsBuilder->get() ), PartsAuditLog::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/Channel.php b/src/Rest/Channel.php index c9375d50..37d08c07 100644 --- a/src/Rest/Channel.php +++ b/src/Rest/Channel.php @@ -48,7 +48,7 @@ public function get(string $channelId): PromiseInterface ) ), PartsChannel::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -68,7 +68,7 @@ public function modify(string $channelId, ChannelBuilder $channel, ?string $reas $this->getAuditLogReasonHeader($reason) ), PartsChannel::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -88,7 +88,7 @@ public function delete(string $channelId, ?string $reason = null): PromiseInterf $this->getAuditLogReasonHeader($reason) ), PartsChannel::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -113,7 +113,7 @@ public function getMessages( return $this->mapArrayPromise( $this->http->get($endpoint), Message::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -132,7 +132,7 @@ public function getMessage(string $channelId, string $messageId): PromiseInterfa ) ), Message::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -153,7 +153,7 @@ public function createMessage( $message->get() ), Message::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -172,7 +172,7 @@ public function crosspostMessage(string $channelId, string $messageId): PromiseI ) ), Message::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -192,7 +192,7 @@ public function createReaction( $messageId, (string) $emoji ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -212,7 +212,7 @@ public function deleteOwnReaction( $messageId, (string) $emoji ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -234,7 +234,7 @@ public function deleteUserReaction( (string) $emoji, $userId ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -259,7 +259,7 @@ public function getReactions( $getReactionsBuilder->get() ), User::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -275,7 +275,7 @@ public function deleteAllReactions(string $channelId, string $messageId): Promis $channelId, $messageId ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -295,7 +295,7 @@ public function deleteAllReactionsForEmoji( $messageId, (string) $emoji ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -318,7 +318,7 @@ public function editMessage( $message->get() ), Message::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -338,7 +338,7 @@ public function deleteMessage( $messageId ), headers: $this->getAuditLogReasonHeader($reason), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -360,7 +360,7 @@ public function bulkDeleteMessages( ), ['messages' => $messageIds], $this->getAuditLogReasonHeader($reason) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -381,7 +381,7 @@ public function editChannelPermissions( ), $editPermissionsBuilder->get(), $this->getAuditLogReasonHeader($reason) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -399,7 +399,7 @@ public function getChannelInvites(string $channelId): PromiseInterface ) ), Invite::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -422,7 +422,7 @@ public function createChannelInvite( $this->getAuditLogReasonHeader($reason) ), Invite::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -443,7 +443,7 @@ public function deleteChannelPermissions( ), null, $this->getAuditLogReasonHeader($reason) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -459,7 +459,7 @@ public function followAnnouncementChannel(string $channelId, string $webhookChan $channelId ), ['webhook_channel_id' => $webhookChannelId] - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -474,7 +474,7 @@ public function triggerTypingIndicator(string $channelId): PromiseInterface Endpoint::CHANNEL_TYPING, $channelId ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -492,7 +492,7 @@ public function getPinnedMessages(string $channelId): PromiseInterface ) ), Message::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -508,7 +508,7 @@ public function pinMessage(string $channelId, string $messageId): PromiseInterfa $channelId, $messageId ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -524,7 +524,7 @@ public function unpinMessage(string $channelId, string $messageId): PromiseInter $channelId, $messageId ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -547,7 +547,7 @@ public function startThreadFromMessage( $startThreadFromMessageBuilder->get() ), PartsChannel::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -568,7 +568,7 @@ public function startThreadWithoutMessage( $startThreadWithoutMessageBuilder->get() ), PartsChannel::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -592,7 +592,7 @@ public function startThreadInForumChannel( $this->getAuditLogReasonHeader($reason), ), $forumChannelWithMessage::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -607,7 +607,7 @@ public function joinThread(string $channelId): PromiseInterface Endpoint::THREAD_MEMBER_ME, $channelId ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -623,7 +623,7 @@ public function addThreadMember(string $channelId, string $userId): PromiseInter $channelId, $userId ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -638,7 +638,7 @@ public function leaveThread(string $channelId): PromiseInterface Endpoint::THREAD_MEMBER_ME, $channelId ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -654,7 +654,7 @@ public function removeThreadMember(string $channelId, string $userId): PromiseIn $channelId, $userId ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -673,7 +673,7 @@ public function getThreadMember(string $channelId, string $userId): PromiseInter ) ), ThreadMember::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -702,7 +702,7 @@ public function listThreadMembers( $options ), ThreadMember::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -720,7 +720,7 @@ public function listPublicArchivedThreads(string $channelId): PromiseInterface ) ), PartsChannel::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -738,7 +738,7 @@ public function listPrivateArchivedThreads(string $channelId): PromiseInterface ) ), PartsChannel::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -756,6 +756,6 @@ public function listJoinedPrivateArchivedThreads(string $channelId): PromiseInte ) ), PartsChannel::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/Emoji.php b/src/Rest/Emoji.php index 898fcbb1..bb9a008a 100644 --- a/src/Rest/Emoji.php +++ b/src/Rest/Emoji.php @@ -29,7 +29,7 @@ public function listGuildEmojis(string $guildId): PromiseInterface ) ), PartsEmoji::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -48,7 +48,7 @@ public function getGuildEmoji(string $guildId, string $emojiId): PromiseInterfac ) ), PartsEmoji::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -71,7 +71,7 @@ public function createGuildEmoji( $this->getAuditLogReasonHeader($reason) ), PartsEmoji::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -96,7 +96,7 @@ public function modifyGuildEmoji( $this->getAuditLogReasonHeader($reason) ), PartsEmoji::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -117,7 +117,7 @@ public function deleteGuildEmoji( ), null, $this->getAuditLogReasonHeader($reason) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -135,7 +135,7 @@ public function listApplicationEmojis(string $applicationId): PromiseInterface ), ), PartsEmoji::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -154,7 +154,7 @@ public function getApplicationEmoji(string $guildId, string $emojiId): PromiseIn ) ), PartsEmoji::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -175,7 +175,7 @@ public function createApplicationEmoji( $emojiBuilder->get(), ), PartsEmoji::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -198,7 +198,7 @@ public function modifyApplicationEmoji( $emojiBuilder->get(), ), PartsEmoji::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -216,6 +216,6 @@ public function deleteApplicationEmoji( $applicationId, $emojiId ), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/GlobalCommand.php b/src/Rest/GlobalCommand.php index 2e939301..0650c725 100644 --- a/src/Rest/GlobalCommand.php +++ b/src/Rest/GlobalCommand.php @@ -45,7 +45,7 @@ public function createApplicationCommand( $commandBuilder->get(), ), ApplicationCommand::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } @@ -64,6 +64,6 @@ public function deleteApplicationCommand( $applicationId, $commandId, ), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/Guild.php b/src/Rest/Guild.php index a587fb52..ca65e680 100644 --- a/src/Rest/Guild.php +++ b/src/Rest/Guild.php @@ -49,7 +49,7 @@ public function create(array $params): PromiseInterface $params ), PartsGuild::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -73,7 +73,7 @@ public function get(string $guildId, bool $withCounts = false): PromiseInterface $endpoint, ), PartsGuild::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -91,7 +91,7 @@ public function getPreview(string $guildId): PromiseInterface ) ), GuildPreview::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -113,7 +113,7 @@ public function modify(string $guildId, array $params, ?string $reason = null): $this->getAuditLogReasonHeader($reason) ), PartsGuild::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -128,7 +128,7 @@ public function delete(string $guildId): PromiseInterface Endpoint::GUILD, $guildId ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -146,7 +146,7 @@ public function getChannels(string $guildId): PromiseInterface ) ), Channel::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -168,7 +168,7 @@ public function createChannel(string $guildId, array $params, ?string $reason = $this->getAuditLogReasonHeader($reason) ), Channel::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -186,7 +186,7 @@ public function modifyChannelPositions( $guildId, ), array_map(fn(ModifyChannelPositionsBuilder $builder) => $builder->get(), $modifyChannelPositionsBuilders) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -223,7 +223,7 @@ public function getMember(string $guildId, string $memberId): PromiseInterface ), ), GuildMember::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -247,7 +247,7 @@ public function listMembers(string $guildId, array $queryParams): PromiseInterfa return $this->mapArrayPromise( $this->http->get($endpoint), GuildMember::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -269,7 +269,7 @@ public function searchMembers(string $guildId, array $queryParams): PromiseInter return $this->mapArrayPromise( $this->http->get($endpoint), GuildMember::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -289,7 +289,7 @@ public function addMember(string $guildId, string $userId, array $params): Promi $params, ), GuildMember::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -311,7 +311,7 @@ public function modifyMember( ), $params, $this->getAuditLogReasonHeader($reason), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -331,7 +331,7 @@ public function modifyCurrentMember( ), $params, $this->getAuditLogReasonHeader($reason), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -353,7 +353,7 @@ public function addMemberRole( $roleId, ), headers: $this->getAuditLogReasonHeader($reason), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -375,7 +375,7 @@ public function removeMemberRole( $roleId, ), headers: $this->getAuditLogReasonHeader($reason), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -392,7 +392,7 @@ public function removeGuildMember(string $guildId, string $userId, ?string $reas $userId, ), headers: $this->getAuditLogReasonHeader($reason), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -410,7 +410,7 @@ public function getBans(string $guildId): PromiseInterface ) ), GuildBan::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -429,7 +429,7 @@ public function getBan(string $guildId, string $userId): PromiseInterface ) ), GuildBan::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -451,7 +451,7 @@ public function createBan( ), $params, $this->getAuditLogReasonHeader($reason) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -468,7 +468,7 @@ public function removeBan(string $guildId, string $userId, ?string $reason = nul $userId, ), headers: $this->getAuditLogReasonHeader($reason) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -486,7 +486,7 @@ public function getRoles(string $guildId): PromiseInterface ) ), Role::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -505,7 +505,7 @@ public function getRole(string $guildId, string $roleId): PromiseInterface ), ), Role::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -525,7 +525,7 @@ public function createRole(string $guildId, array $params, ?string $reason = nul $this->getAuditLogReasonHeader($reason), ), Role::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -548,7 +548,7 @@ public function modifyRolePositions( $this->getAuditLogReasonHeader($reason), ), Role::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -573,7 +573,7 @@ public function modifyRole( $this->getAuditLogReasonHeader($reason), ), Role::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -593,7 +593,7 @@ public function modifyMfaLevel( ), ['level' => $mfaLevel->value], $this->getAuditLogReasonHeader($reason), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -610,7 +610,7 @@ public function deleteRole(string $guildId, string $roleId, ?string $reason = nu $roleId, ), headers: $this->getAuditLogReasonHeader($reason), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -634,7 +634,7 @@ public function getPruneCount(string $guildId, array $queryParams): PromiseInter $endpoint, ), PruneCount::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -654,7 +654,7 @@ public function beginPrune(string $guildId, array $params, ?string $reason = nul headers: $this->getAuditLogReasonHeader($reason) ), PruneCount::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -672,7 +672,7 @@ public function getVoiceRegions(string $guildId): PromiseInterface ), ), VoiceRegion::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -690,7 +690,7 @@ public function getCurrentUserVoiceState(string $guildId): PromiseInterface ), ), VoiceState::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -709,7 +709,7 @@ public function getUserVoiceState(string $guildId, string $userId): PromiseInter ), ), VoiceState::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -727,7 +727,7 @@ public function getInvites(string $guildId): PromiseInterface ), ), Invite::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -745,7 +745,7 @@ public function getIntegrations(string $guildId): PromiseInterface ), ), Integration::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -765,7 +765,7 @@ public function deleteIntegration( $integrationId, ), headers: $this->getAuditLogReasonHeader($reason), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -783,7 +783,7 @@ public function getWidgetSettings(string $guildId): PromiseInterface ), ), WidgetSettings::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -803,7 +803,7 @@ public function modifyWidget(string $guildId, array $params, ?string $reason = n $this->getAuditLogReasonHeader($reason), ), WidgetSettings::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -821,7 +821,7 @@ public function getWidget(string $guildId): PromiseInterface ) ), Widget::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -839,7 +839,7 @@ public function getVanityUrl(string $guildId): PromiseInterface ) ), Invite::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -876,7 +876,7 @@ public function getWelcomeScreen(string $guildId): PromiseInterface ), ), WelcomeScreen::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -892,7 +892,7 @@ public function modifyCurrentUserVoiceState(string $guildId, array $params): Pro $guildId, ), $params, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -909,6 +909,6 @@ public function modifyUserVoiceState(string $guildId, string $userId, array $par $userId ), $params, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/GuildAutoModeration.php b/src/Rest/GuildAutoModeration.php index 29db2dab..66398afb 100644 --- a/src/Rest/GuildAutoModeration.php +++ b/src/Rest/GuildAutoModeration.php @@ -22,7 +22,7 @@ public function list(string $guildId): PromiseInterface return $this->mapArrayPromise( $this->http->get(Endpoint::bind(Endpoint::GUILD_AUTO_MODERATION_RULES, $guildId)), AutoModerationRuleObject::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -40,7 +40,7 @@ public function get(string $guildId, string $autoModerationRuleId): PromiseInter ) ), AutoModerationRuleObject::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -59,7 +59,7 @@ public function create(string $guildId, array $params, ?string $reason = null): $this->getAuditLogReasonHeader($reason) ), AutoModerationRuleObject::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -79,7 +79,7 @@ public function modify(string $guildId, string $autoModerationRuleId, array $par $this->getAuditLogReasonHeader($reason) ), AutoModerationRuleObject::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -98,6 +98,6 @@ public function delete(string $guildId, string $autoModerationRuleId, ?string $r headers: $this->getAuditLogReasonHeader($reason) ), AutoModerationRuleObject::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/GuildCommand.php b/src/Rest/GuildCommand.php index 8ae6149b..81d4127e 100644 --- a/src/Rest/GuildCommand.php +++ b/src/Rest/GuildCommand.php @@ -52,7 +52,7 @@ public function createApplicationCommand( $commandBuilder->get(), ), ApplicationCommand::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -72,6 +72,6 @@ public function deleteApplicationCommand( $guildId, $commandId, ), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/GuildScheduledEvent.php b/src/Rest/GuildScheduledEvent.php index 16578030..8d0854ae 100644 --- a/src/Rest/GuildScheduledEvent.php +++ b/src/Rest/GuildScheduledEvent.php @@ -28,7 +28,7 @@ public function list(string $guildId, bool $withUserCount = false): PromiseInter $endpoint ), PartsGuildScheduledEvent::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -45,7 +45,7 @@ public function get(string $guildId, string $scheduledEventId, bool $withUserCou $endpoint ), PartsGuildScheduledEvent::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -61,7 +61,7 @@ public function create(string $guildId, array $params, ?string $reason = null): $this->getAuditLogReasonHeader($reason), ), PartsGuildScheduledEvent::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -77,7 +77,7 @@ public function modify(string $guildId, string $scheduledEventId, array $params, $this->getAuditLogReasonHeader($reason), ), PartsGuildScheduledEvent::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -88,7 +88,7 @@ public function delete(string $guildId, string $scheduledEventId): PromiseInterf { return $this->http->delete( Endpoint::bind(Endpoint::GUILD_SCHEDULED_EVENT, $guildId, $scheduledEventId), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -120,6 +120,6 @@ public function getUsers( $endpoint ), GuildScheduledEventUser::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/GuildSticker.php b/src/Rest/GuildSticker.php index fec78f0f..af255014 100644 --- a/src/Rest/GuildSticker.php +++ b/src/Rest/GuildSticker.php @@ -30,7 +30,7 @@ public function list(string $guildId): PromiseInterface ) ), Sticker::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -49,7 +49,7 @@ public function get(string $guildId, string $stickerId): PromiseInterface ) ), Sticker::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -68,7 +68,7 @@ public function create(string $guildId, StickerBuilder $stickerBuilder): Promise $stickerBuilder->get() ), Sticker::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -90,7 +90,7 @@ public function modify( $modifyStickerBuilder->get() ), Sticker::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -106,6 +106,6 @@ public function delete(string $guildId, string $stickerId): PromiseInterface $guildId, $stickerId ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/Invite.php b/src/Rest/Invite.php index a286e160..174d7545 100644 --- a/src/Rest/Invite.php +++ b/src/Rest/Invite.php @@ -28,7 +28,7 @@ public function get(string $code): PromiseInterface ) ), PartsInvite::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -43,6 +43,6 @@ public function delete(string $code): PromiseInterface Endpoint::INVITE, $code ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/StageInstance.php b/src/Rest/StageInstance.php index d609e8d2..d991ea4e 100644 --- a/src/Rest/StageInstance.php +++ b/src/Rest/StageInstance.php @@ -27,7 +27,7 @@ public function createInstance(array $params, ?string $reason = null): PromiseIn $this->getAuditLogReasonHeader($reason), ), PartsStageInstance::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -45,7 +45,7 @@ public function getInstances(string $channelId): PromiseInterface ), ), PartsStageInstance::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -65,7 +65,7 @@ public function modifyInstances(string $channelId, array $params, ?string $reaso $this->getAuditLogReasonHeader($reason), ), PartsStageInstance::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -84,6 +84,6 @@ public function deleteInstances(string $channelId, ?string $reason = null): Prom headers: $this->getAuditLogReasonHeader($reason), ), PartsStageInstance::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/Sticker.php b/src/Rest/Sticker.php index bd950992..554ea135 100644 --- a/src/Rest/Sticker.php +++ b/src/Rest/Sticker.php @@ -29,7 +29,7 @@ public function get(string $stickerId): PromiseInterface ) ), PartsSticker::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -46,6 +46,6 @@ public function listNitroPacks(): PromiseInterface ) ), StickerPack::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/User.php b/src/Rest/User.php index 293aaea5..62717a9d 100644 --- a/src/Rest/User.php +++ b/src/Rest/User.php @@ -31,7 +31,7 @@ public function get(string $userId): PromiseInterface ), ), PartsUser::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -46,7 +46,7 @@ public function getCurrent(): PromiseInterface Endpoint::USER_CURRENT, ), PartsUser::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -62,7 +62,7 @@ public function modifyCurrent(array $params): PromiseInterface $params ), PartsUser::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -99,7 +99,7 @@ public function getCurrentUserGuilds( $endpoint, ), Guild::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -117,7 +117,7 @@ public function getCurrentUserGuildMember(string $guildId): PromiseInterface ), ), GuildMember::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -132,7 +132,7 @@ public function leaveGuild(string $guildId): PromiseInterface Endpoint::USER_CURRENT_GUILD, $guildId, ), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -148,7 +148,7 @@ public function createDm(string $recipientId): PromiseInterface ['recipient_id' => $recipientId], ), Channel::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -164,6 +164,6 @@ public function createGroupDm(array $params): PromiseInterface $params, ), Channel::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } diff --git a/src/Rest/Webhook.php b/src/Rest/Webhook.php index 9eebf64f..9438ed2a 100644 --- a/src/Rest/Webhook.php +++ b/src/Rest/Webhook.php @@ -36,7 +36,7 @@ public function createInteractionResponse( $interactionToken ), $interactionCallbackBuilder->get() - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -55,7 +55,7 @@ public function getOriginalInteractionResponse( ) ), Message::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -76,7 +76,7 @@ public function editOriginalInteractionResponse( $webhookBuilder->get() ), Message::class - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -92,7 +92,7 @@ public function deleteOriginalInteractionResponse( $applicationId, $interactionToken ) - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -112,7 +112,7 @@ public function create(string $channelId, CreateWebhookBuilder $builder, ?string $this->getAuditLogReasonHeader($reason), ), PartsWebhook::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -130,7 +130,7 @@ public function getChannelWebhooks(string $channelId): PromiseInterface ), ), PartsWebhook::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -148,7 +148,7 @@ public function getGuildWebhooks(string $guildId) ), ), PartsWebhook::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -166,7 +166,7 @@ public function get(string $webhookId) ), ), PartsWebhook::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -185,7 +185,7 @@ public function getWithToken(string $webhookId, string $token) ), ), PartsWebhook::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -205,7 +205,7 @@ public function modify(string $webhookId, ModifyWebhookBuilder $builder, ?string $this->getAuditLogReasonHeader($reason), ), PartsWebhook::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -226,7 +226,7 @@ public function modifyWithToken(string $webhookId, string $token, ModifyWebhookB $this->getAuditLogReasonHeader($reason), ), PartsWebhook::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -242,7 +242,7 @@ public function delete(string $webhookId, ?string $reason = null): PromiseInterf $webhookId, ), headers: $this->getAuditLogReasonHeader($reason), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -259,7 +259,7 @@ public function deleteWithToken(string $webhookId, string $token, ?string $reaso $token, ), headers: $this->getAuditLogReasonHeader($reason), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -286,7 +286,7 @@ public function execute(string $webhookId, string $token, WebhookBuilder $builde return $this->http->post( $endpoint, $builder->get(), - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -313,7 +313,7 @@ public function executeSlackWebhook(string $webhookId, string $token, array $par return $this->http->post( $endpoint, $params, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -340,7 +340,7 @@ public function executeGithubWebhook(string $webhookId, string $token, array $pa return $this->http->post( $endpoint, $params, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -366,7 +366,7 @@ public function getWebhookMessage(string $webhookId, string $token, string $mess $endpoint, ), Message::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -393,7 +393,7 @@ public function editWebhookMessage(string $webhookId, string $token, string $mes $builder->get(), ), Message::class, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } /** @@ -416,6 +416,6 @@ public function deleteWebhookMessage(string $webhookId, string $token, string $m $this->http->delete( $endpoint, - )->otherwise($this->logThrowable(...)); + )->catch($this->logThrowable(...)); } } From 4306d21d22f2043e8578796b67831b28889881c1 Mon Sep 17 00:00:00 2001 From: Naneynonn Date: Wed, 20 Nov 2024 11:13:55 +0200 Subject: [PATCH 3/3] fix code style --- fakes/WebsocketFake.php | 12 +++++++++--- src/Interaction/ButtonInteraction.php | 4 +++- src/Interaction/CommandInteraction.php | 4 ++-- src/Rest/Channel.php | 4 ++-- src/Rest/Guild.php | 2 +- src/Rest/HttpResource.php | 3 ++- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/fakes/WebsocketFake.php b/fakes/WebsocketFake.php index b2e04e69..fe8beb79 100644 --- a/fakes/WebsocketFake.php +++ b/fakes/WebsocketFake.php @@ -20,9 +20,15 @@ public function open(string $url): PromiseInterface return PromiseFake::get(); } - public function close(int $code, string $reason): void {} + public function close(int $code, string $reason): void + { + } - public function send(string $message, bool $useBucket = true): void {} + public function send(string $message, bool $useBucket = true): void + { + } - public function sendAsJson(array|JsonSerializable $item, bool $useBucket): void {} + public function sendAsJson(array|JsonSerializable $item, bool $useBucket): void + { + } } diff --git a/src/Interaction/ButtonInteraction.php b/src/Interaction/ButtonInteraction.php index 23004339..ceba9b4c 100644 --- a/src/Interaction/ButtonInteraction.php +++ b/src/Interaction/ButtonInteraction.php @@ -11,7 +11,9 @@ class ButtonInteraction { - public function __construct(public readonly InteractionCreate $interaction, private Discord $discord) {} + public function __construct(public readonly InteractionCreate $interaction, private Discord $discord) + { + } public function createInteractionResponse( InteractionCallbackBuilder $interactionCallbackBuilder diff --git a/src/Interaction/CommandInteraction.php b/src/Interaction/CommandInteraction.php index 490c8d64..eee67e21 100644 --- a/src/Interaction/CommandInteraction.php +++ b/src/Interaction/CommandInteraction.php @@ -73,7 +73,7 @@ private function findOption(array $options, array $segments): ?OptionStructure { $currentSegment = array_shift($segments); - $option = array_find($options, fn(OptionStructure $option) => $option->name === $currentSegment); + $option = array_find($options, fn (OptionStructure $option) => $option->name === $currentSegment); if (empty($segments)) { return $option; @@ -102,7 +102,7 @@ private function getSubCommandNameFromOptions(array $options): ?string { $subItem = array_values(array_filter( $options, - static fn(OptionStructure $option) => in_array( + static fn (OptionStructure $option) => in_array( $option->type, [OptionTypes::SUB_COMMAND, OptionTypes::SUB_COMMAND_GROUP] ) diff --git a/src/Rest/Channel.php b/src/Rest/Channel.php index 37d08c07..a691095d 100644 --- a/src/Rest/Channel.php +++ b/src/Rest/Channel.php @@ -581,7 +581,7 @@ public function startThreadInForumChannel( MultipartBody|array $params, ?string $reason = null ): PromiseInterface { - $forumChannelWithMessage = new class() extends Channel { + $forumChannelWithMessage = new class () extends Channel { public Message $message; }; @@ -691,7 +691,7 @@ public function listThreadMembers( 'with_member' => $withMember, 'after' => $after, 'limit' => $limit, - ], static fn($value) => !is_null($value)); + ], static fn ($value) => !is_null($value)); return $this->mapArrayPromise( $this->http->get( diff --git a/src/Rest/Guild.php b/src/Rest/Guild.php index ca65e680..66e6dade 100644 --- a/src/Rest/Guild.php +++ b/src/Rest/Guild.php @@ -185,7 +185,7 @@ public function modifyChannelPositions( Endpoint::GUILD_CHANNELS, $guildId, ), - array_map(fn(ModifyChannelPositionsBuilder $builder) => $builder->get(), $modifyChannelPositionsBuilders) + array_map(fn (ModifyChannelPositionsBuilder $builder) => $builder->get(), $modifyChannelPositionsBuilders) )->catch($this->logThrowable(...)); } diff --git a/src/Rest/HttpResource.php b/src/Rest/HttpResource.php index 17dd8585..95e46a66 100644 --- a/src/Rest/HttpResource.php +++ b/src/Rest/HttpResource.php @@ -19,7 +19,8 @@ public function __construct( protected Http $http, protected DataMapper $dataMapper, protected LoggerInterface $logger - ) {} + ) { + } protected function mapPromise(PromiseInterface $promise, string $class): PromiseInterface {