Skip to content

Commit

Permalink
Update typecasting for Collections
Browse files Browse the repository at this point in the history
  • Loading branch information
valzargaming committed Jan 17, 2025
1 parent 604fa6f commit 4c90bf2
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/Discord/Parts/Channel/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ protected function getRecipientIdAttribute(): ?string
*
* @return Collection A collection of recipients.
*/
protected function getRecipientsAttribute(): Collection
protected function getRecipientsAttribute(): CollectionInterface
{
$recipients = Collection::for(User::class);

Expand Down Expand Up @@ -999,7 +999,7 @@ protected function getPermissionOverwritesAttribute(): ?array
*
* @since 7.4.0
*/
protected function getAvailableTagsAttribute(): Collection
protected function getAvailableTagsAttribute(): CollectionInterface
{
$available_tags = Collection::for(Tag::class);

Expand Down
10 changes: 5 additions & 5 deletions src/Discord/Parts/Channel/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ protected function getSuppressNotificationsAttribute(): bool
*
* @return Collection|Channel[]
*/
protected function getMentionChannelsAttribute(): Collection
protected function getMentionChannelsAttribute(): CollectionInterface
{
$collection = Collection::for(Channel::class);

Expand All @@ -360,7 +360,7 @@ protected function getMentionChannelsAttribute(): Collection
*
* @return Collection|Attachment[] Attachment objects.
*/
protected function getAttachmentsAttribute(): Collection
protected function getAttachmentsAttribute(): CollectionInterface
{
$attachments = Collection::for(Attachment::class);

Expand Down Expand Up @@ -492,7 +492,7 @@ protected function getGuildAttribute(): ?Guild
*
* @return Collection<?Role> The roles that were mentioned. null role only contains the ID in the collection.
*/
protected function getMentionRolesAttribute(): Collection
protected function getMentionRolesAttribute(): CollectionInterface
{
$roles = new Collection();

Expand All @@ -516,7 +516,7 @@ protected function getMentionRolesAttribute(): Collection
*
* @return Collection|User[] The users that were mentioned.
*/
protected function getMentionsAttribute(): Collection
protected function getMentionsAttribute(): CollectionInterface
{
$users = Collection::for(User::class);

Expand Down Expand Up @@ -583,7 +583,7 @@ protected function getMemberAttribute(): ?Member
*
* @return Collection<Embed> A collection of embeds.
*/
protected function getEmbedsAttribute(): Collection
protected function getEmbedsAttribute(): CollectionInterface
{
$embeds = new Collection([], null);

Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/Embed/Embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected function getAuthorAttribute(): Author
*
* @return Collection|Field[]
*/
protected function getFieldsAttribute(): Collection
protected function getFieldsAttribute(): CollectionInterface
{
$fields = Collection::for(Field::class, null);

Expand Down
18 changes: 9 additions & 9 deletions src/Discord/Parts/Guild/AuditLog/AuditLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function getGuildAttribute(): ?Guild
*
* @return Collection|Command[]
*/
protected function getApplicationCommandsAttribute(): Collection
protected function getApplicationCommandsAttribute(): CollectionInterface
{
$collection = Collection::for(Command::class);

Expand All @@ -92,7 +92,7 @@ protected function getApplicationCommandsAttribute(): Collection
*
* @return Collection|Entry[]
*/
protected function getAuditLogEntriesAttribute(): Collection
protected function getAuditLogEntriesAttribute(): CollectionInterface
{
$collection = Collection::for(Entry::class);

Expand All @@ -108,7 +108,7 @@ protected function getAuditLogEntriesAttribute(): Collection
*
* @return Collection|Rule[]
*/
protected function getAutoModerationRulesAttribute(): Collection
protected function getAutoModerationRulesAttribute(): CollectionInterface
{
$collection = Collection::for(Rule::class);

Expand All @@ -124,7 +124,7 @@ protected function getAutoModerationRulesAttribute(): Collection
*
* @return Collection|ScheduledEvent[]
*/
protected function getGuildScheduledEventsAttribute(): Collection
protected function getGuildScheduledEventsAttribute(): CollectionInterface
{
$collection = Collection::for(ScheduledEvent::class);

Expand All @@ -142,7 +142,7 @@ protected function getGuildScheduledEventsAttribute(): Collection
*
* @return Collection|Integration[]
*/
protected function getIntegrationsAttribute(): Collection
protected function getIntegrationsAttribute(): CollectionInterface
{
$collection = Collection::for(Integration::class);

Expand All @@ -158,7 +158,7 @@ protected function getIntegrationsAttribute(): Collection
*
* @return Collection|Thread[]
*/
protected function getThreadsAttribute(): Collection
protected function getThreadsAttribute(): CollectionInterface
{
$collection = Collection::for(Thread::class);

Expand All @@ -174,7 +174,7 @@ protected function getThreadsAttribute(): Collection
*
* @return Collection|User[]
*/
protected function getUsersAttribute(): Collection
protected function getUsersAttribute(): CollectionInterface
{
$collection = Collection::for(User::class);

Expand All @@ -190,7 +190,7 @@ protected function getUsersAttribute(): Collection
*
* @return Collection|Webhook[]
*/
protected function getWebhooksAttribute(): Collection
protected function getWebhooksAttribute(): CollectionInterface
{
$collection = Collection::for(Webhook::class);

Expand All @@ -210,7 +210,7 @@ protected function getWebhooksAttribute(): Collection
*
* @return Collection|Entry[]
*/
public function searchByType(int $action_type): Collection
public function searchByType(int $action_type): CollectionInterface
{
$types = array_values((new ReflectionClass(Entry::class))->getConstants());

Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/Guild/AuditLog/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected function getUserAttribute(): ?User
*
* @return Collection
*/
protected function getChangesAttribute(): Collection
protected function getChangesAttribute(): CollectionInterface
{
return new Collection($this->attributes['changes'] ?? [], 'key', null);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Discord/Parts/Guild/AutoModeration/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function getCreatorAttribute(): ?User
*
* @return Collection|Action[] A collection of actions.
*/
protected function getActionsAttribute(): Collection
protected function getActionsAttribute(): CollectionInterface
{
$actions = Collection::for(Action::class, null);

Expand All @@ -116,7 +116,7 @@ protected function getActionsAttribute(): Collection
*
* @return Collection|?Role[] A collection of roles exempt from the rule.
*/
protected function getExemptRolesAttribute(): Collection
protected function getExemptRolesAttribute(): CollectionInterface
{
$roles = new Collection();

Expand All @@ -140,7 +140,7 @@ protected function getExemptRolesAttribute(): Collection
*
* @return Collection|?Channel[] A collection of channels exempt from the rule.
*/
protected function getExemptChannelsAttribute(): Collection
protected function getExemptChannelsAttribute(): CollectionInterface
{
$channels = new Collection();

Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/Guild/CommandPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function getGuildAttribute(): ?Guild
*
* @return Collection|Permission[] A collection of permissions.
*/
protected function getPermissionsAttribute(): Collection
protected function getPermissionsAttribute(): CollectionInterface
{
$permissions = Collection::for(Permission::class);

Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/Guild/Emoji.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function getGuildAttribute(): ?Guild
*
* @return Collection<?Role> A collection of roles for the emoji.
*/
protected function getRolesAttribute(): Collection
protected function getRolesAttribute(): CollectionInterface
{
$roles = new Collection();

Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/Guild/Guild.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ protected function getSplashHashAttribute(): ?string
*
* @return Collection|StageInstance[]
*/
protected function getStageInstancesAttribute(): Collection
protected function getStageInstancesAttribute(): CollectionInterface
{
$stage_instances = Collection::for(StageInstance::class);

Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/Guild/WelcomeScreen.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class WelcomeScreen extends Part
*
* @return Collection|WelcomeChannel[] The channels of welcome screen.
*/
protected function getWelcomeChannelsAttribute(): Collection
protected function getWelcomeChannelsAttribute(): CollectionInterface
{
$collection = Collection::for(WelcomeChannel::class, null);

Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/Interactions/Command/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected function getChoicesAttribute(): ?Collection
*
* @return Collection|Option[] A collection of options.
*/
protected function getOptionsAttribute(): Collection
protected function getOptionsAttribute(): CollectionInterface
{
$options = Collection::for(Option::class, null);

Expand Down
4 changes: 2 additions & 2 deletions src/Discord/Parts/User/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ protected function getGameAttribute(): ?Activity
*
* @return Collection|Activity[]
*/
protected function getActivitiesAttribute(): Collection
protected function getActivitiesAttribute(): CollectionInterface
{
$activities = Collection::for(Activity::class, null);

Expand Down Expand Up @@ -695,7 +695,7 @@ protected function getGuildAttribute(): ?Guild
*
* @return Collection<?Role> A collection of roles the member is in. null role only contains ID in the collection.
*/
protected function getRolesAttribute(): Collection
protected function getRolesAttribute(): CollectionInterface
{
$roles = new Collection();

Expand Down
4 changes: 2 additions & 2 deletions src/Discord/Parts/WebSockets/PresenceUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected function getGuildAttribute(): ?Guild
*
* @return Collection|Activity[]
*/
protected function getActivitiesAttribute(): Collection
protected function getActivitiesAttribute(): CollectionInterface
{
$collection = Collection::for(Activity::class, null);

Expand Down Expand Up @@ -165,7 +165,7 @@ protected function getMemberAttribute(): ?Member
*
* @return Collection|Role[]
*/
protected function getRolesAttribute(): Collection
protected function getRolesAttribute(): CollectionInterface
{
if ($member = $this->member) {
return $member->roles;
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Repository/Channel/ThreadRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function archived(bool $private = false, bool $joined = false, ?int $limi
*
* @return Collection|Thread[]
*/
private function handleThreadPaginationResponse(object $response): Collection
private function handleThreadPaginationResponse(object $response): CollectionInterface
{
$collection = Collection::for(Thread::class);

Expand Down

0 comments on commit 4c90bf2

Please sign in to comment.