Skip to content

Commit e8be396

Browse files
fix: role return type mismatch (#1437)
* fix: role return type mismatch * Fix role retrieval logic in RoleRepository --------- Co-authored-by: Valithor Obsidion <[email protected]>
1 parent 33e54d0 commit e8be396

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Discord/Repository/Guild/RoleRepository.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ public function getCurrentMemberHighestRole(): ?Role
7777
return null;
7878
}
7979

80-
return $guild->roles
80+
/** @var array<string, Role> */
81+
$role = $guild->roles
8182
->filter(fn (Role $role) => $botMember->roles->has($role->id))
8283
->sort(fn (Role $a, Role $b) => $b->comparePosition($a))
83-
->shift();
84+
->shift() ?? [];
85+
86+
/** @var Role|null */
87+
return array_shift($role);
8488
}
8589
}

0 commit comments

Comments
 (0)