From 765d1af2a6556aa5fe62fea2d7f770f8fed4af28 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 17 Nov 2025 18:08:18 +0100 Subject: [PATCH] feat: yield user by id in IUserManager::getSeenUsers Signed-off-by: Robin Appelman --- lib/private/User/Manager.php | 2 +- lib/public/IUserManager.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index 2bea9bb65dd..a94e6d979f1 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -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; } } diff --git a/lib/public/IUserManager.php b/lib/public/IUserManager.php index caf1a704cce..9b146ae6415 100644 --- a/lib/public/IUserManager.php +++ b/lib/public/IUserManager.php @@ -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 list of IUser object + * @return \Iterator list of IUser object * @since 32.0.0 */ public function getSeenUsers(int $offset = 0, ?int $limit = null): \Iterator;