Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help static code analysis to understand code #22890

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/admin_audit/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
use Closure;
use OC\Files\Filesystem;
use OC\Files\Node\File;
use OC\Group\Manager;
use OC\Group\Manager as GroupManager;
use OC\User\Session as UserSession;
use OCA\AdminAudit\Actions\AppManagement;
use OCA\AdminAudit\Actions\Auth;
use OCA\AdminAudit\Actions\Console;
Expand Down Expand Up @@ -134,6 +135,7 @@ private function userManagementHooks(ILogger $logger,
Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete');
Util::connectHook('OC_User', 'changeUser', $userActions, 'change');

assert($userSession instanceof UserSession);
$userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']);
$userSession->listen('\OC\User', 'assignedUserId', [$userActions, 'assign']);
$userSession->listen('\OC\User', 'postUnassignedUserId', [$userActions, 'unassign']);
Expand All @@ -143,7 +145,7 @@ private function groupHooks(ILogger $logger,
IGroupManager $groupManager) {
$groupActions = new GroupManagement($logger);

/** @var IGroupManager|Manager $groupManager */
assert($groupManager instanceof GroupManager);
$groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']);
$groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']);
$groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']);
Expand Down
3 changes: 2 additions & 1 deletion apps/settings/lib/Controller/ChangePasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

namespace OCA\Settings\Controller;

use OC\Group\Manager as GroupManager;
use OC\HintException;
use OC\User\Session;
use OCP\App\IAppManager;
Expand All @@ -58,7 +59,7 @@ class ChangePasswordController extends Controller {
/** @var IL10N */
private $l;

/** @var IGroupManager */
/** @var GroupManager */
private $groupManager;

/** @var Session */
Expand Down
9 changes: 6 additions & 3 deletions apps/settings/lib/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
use OC\AppFramework\Http;
use OC\Encryption\Exceptions\ModuleDoesNotExistsException;
use OC\ForbiddenException;
use OC\Group\Manager as GroupManager;
use OC\L10N\Factory;
use OC\Security\IdentityProof\Manager;
use OC\User\Manager as UserManager;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Settings\BackgroundJobs\VerifyUserData;
use OCA\Settings\Events\BeforeTemplateRenderedEvent;
Expand All @@ -63,9 +66,9 @@
use function in_array;

class UsersController extends Controller {
/** @var IUserManager */
/** @var UserManager */
private $userManager;
/** @var IGroupManager */
/** @var GroupManager */
private $groupManager;
/** @var IUserSession */
private $userSession;
Expand All @@ -77,7 +80,7 @@ class UsersController extends Controller {
private $l10n;
/** @var IMailer */
private $mailer;
/** @var IFactory */
/** @var Factory */
private $l10nFactory;
/** @var IAppManager */
private $appManager;
Expand Down
22 changes: 0 additions & 22 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@
<code>$this-&gt;appRoot</code>
</UndefinedThisPropertyFetch>
</file>
<file src="apps/admin_audit/lib/AppInfo/Application.php">
<UndefinedInterfaceMethod occurrences="3">
<code>listen</code>
<code>listen</code>
<code>listen</code>
</UndefinedInterfaceMethod>
</file>
<file src="apps/cloud_federation_api/lib/Controller/RequestHandlerController.php">
<InvalidScalarArgument occurrences="1">
<code>$e-&gt;getCode()</code>
Expand Down Expand Up @@ -2159,11 +2152,6 @@
<code>ignoreNextcloudRequirementForApp</code>
</UndefinedInterfaceMethod>
</file>
<file src="apps/settings/lib/Controller/ChangePasswordController.php">
<UndefinedInterfaceMethod occurrences="1">
<code>getSubAdmin</code>
</UndefinedInterfaceMethod>
</file>
<file src="apps/settings/lib/Controller/CheckSetupController.php">
<InvalidArgument occurrences="2">
<code>IDBConnection::CHECK_MISSING_INDEXES_EVENT</code>
Expand Down Expand Up @@ -2195,13 +2183,6 @@
<code>$this-&gt;l10n-&gt;t('You need to set your user email before being able to send test emails.')</code>
</InvalidArgument>
</file>
<file src="apps/settings/lib/Controller/UsersController.php">
<UndefinedInterfaceMethod occurrences="3">
<code>countUsersOfGroups</code>
<code>countDisabledUsersOfGroups</code>
<code>getLanguages</code>
</UndefinedInterfaceMethod>
</file>
<file src="apps/settings/lib/Hooks.php">
<InvalidArgument occurrences="1">
<code>[$user-&gt;getEMailAddress() =&gt; $user-&gt;getDisplayName()]</code>
Expand Down Expand Up @@ -5008,9 +4989,6 @@
<code>$sortMode</code>
<code>self::SORT_NONE</code>
</InvalidPropertyAssignmentValue>
<UndefinedInterfaceMethod occurrences="1">
<code>getSubAdmin</code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/private/Http/Client/Response.php">
<InvalidNullableReturnType occurrences="1">
Expand Down
3 changes: 2 additions & 1 deletion lib/private/Group/MetaData.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

namespace OC\Group;

use OC\Group\Manager as GroupManager;
use OCP\IGroupManager;
use OCP\IUserSession;

Expand All @@ -44,7 +45,7 @@ class MetaData {
protected $isAdmin;
/** @var array */
protected $metaData = [];
/** @var IGroupManager */
/** @var GroupManager */
protected $groupManager;
/** @var bool */
protected $sorting = false;
Expand Down