feat: yield user by id in IUserManager::getSeenUsers

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2025-11-17 18:08:18 +01:00
parent c80c980e29
commit 765d1af2a6
No known key found for this signature in database
GPG key ID: 42B69D8A64526EFB
2 changed files with 4 additions and 2 deletions

View file

@ -826,7 +826,7 @@ class Manager extends PublicEmitter implements IUserManager {
foreach ($this->backends as $backend) {
if ($backend->userExists($userId)) {
$user = new LazyUser($userId, $this, null, $backend);
yield $user;
yield $userId => $user;
break;
}
}

View file

@ -240,9 +240,11 @@ interface IUserManager {
* An iterator is returned allowing the caller to stop the iteration at any time.
* The offset argument allows the caller to continue the iteration at a specific offset.
*
* @since 33.0.0 users are yielded with the user id as key
*
* @param int $offset from which offset to fetch
* @param int|null $limit maximum number of records to fetch
* @return \Iterator<IUser> list of IUser object
* @return \Iterator<string, IUser> list of IUser object
* @since 32.0.0
*/
public function getSeenUsers(int $offset = 0, ?int $limit = null): \Iterator;