Fix psalm issue about userCounts

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
Carl Schwan 2022-03-11 14:17:29 +01:00
parent 3a0b934f84
commit 8d7380a15d
4 changed files with 7 additions and 4 deletions

View file

@ -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;

View file

@ -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;

View file

@ -4332,8 +4332,7 @@
</UndefinedInterfaceMethod>
</file>
<file src="lib/private/Support/Subscription/Registry.php">
<UndefinedInterfaceMethod occurrences="2">
<code>countUsers</code>
<UndefinedInterfaceMethod occurrences="1">
<code>getSupportedApps</code>
</UndefinedInterfaceMethod>
</file>

View file

@ -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;