Merge pull request #31542 from nextcloud/psalm-userCounts

Fix psalm issue about userCounts
This commit is contained in:
Carl Schwan 2022-03-14 11:27:43 +01:00 committed by GitHub
commit 371fa1c49a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 4 deletions

View file

@ -47,9 +47,12 @@ use OCA\User_LDAP\User\User;
use OCP\IConfig;
use OCP\IUserSession;
use OCP\Notification\IManager as INotificationManager;
use OCP\User\Backend\ICountUsersBackend;
use OCP\IUserBackend;
use OCP\UserInterface;
use Psr\Log\LoggerInterface;
class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserInterface, IUserLDAP {
class User_LDAP extends BackendUtility implements IUserBackend, 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

@ -4317,8 +4317,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;