From 8d7380a15de1ebeaced9bada661c5f137380a674 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 11 Mar 2022 14:17:29 +0100 Subject: [PATCH] Fix psalm issue about userCounts Signed-off-by: Carl Schwan --- apps/user_ldap/lib/User_LDAP.php | 3 ++- apps/user_ldap/lib/User_Proxy.php | 3 ++- build/psalm-baseline.xml | 3 +-- lib/private/Support/Subscription/Registry.php | 2 ++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index 9cd90451ea3..f0525daa974 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -47,9 +47,10 @@ use OCA\User_LDAP\User\User; use OCP\IConfig; use OCP\IUserSession; use OCP\Notification\IManager as INotificationManager; +use OCP\User\Backend\ICountUsersBackend; use Psr\Log\LoggerInterface; -class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserInterface, IUserLDAP { +class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserInterface, IUserLDAP, ICountUsersBackend { /** @var \OCP\IConfig */ protected $ocConfig; diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php index 183c90493cf..040d4f5aa69 100644 --- a/apps/user_ldap/lib/User_Proxy.php +++ b/apps/user_ldap/lib/User_Proxy.php @@ -35,8 +35,9 @@ use OCA\User_LDAP\User\User; use OCP\IConfig; use OCP\IUserSession; use OCP\Notification\IManager as INotificationManager; +use OCP\User\Backend\ICountUsersBackend; -class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface, IUserLDAP { +class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface, IUserLDAP, ICountUsersBackend { private $backends = []; /** @var User_LDAP */ private $refBackend = null; diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 44a113f1238..a167be63eb1 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -4332,8 +4332,7 @@ - - countUsers + getSupportedApps diff --git a/lib/private/Support/Subscription/Registry.php b/lib/private/Support/Subscription/Registry.php index 1298337acb2..ba3642d021c 100644 --- a/lib/private/Support/Subscription/Registry.php +++ b/lib/private/Support/Subscription/Registry.php @@ -34,6 +34,7 @@ use OCP\IGroupManager; use OCP\IServerContainer; use OCP\IUserManager; use OCP\Notification\IManager; +use OCP\User\Backend\ICountUsersBackend; use OCP\Support\Subscription\Exception\AlreadyRegisteredException; use OCP\Support\Subscription\IRegistry; use OCP\Support\Subscription\ISubscription; @@ -189,6 +190,7 @@ class Registry implements IRegistry { $backends = $this->userManager->getBackends(); foreach ($backends as $backend) { if ($backend->implementsActions(Backend::COUNT_USERS)) { + /** @var ICountUsersBackend $backend */ $backendUsers = $backend->countUsers(); if ($backendUsers !== false) { $userCount += $backendUsers; -- 2.39.5