Skip to content

Commit fd76274

Browse files
committed
refactor: Apply comments
Signed-off-by: Carl Schwan <[email protected]>
1 parent d10eb02 commit fd76274

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+186
-419
lines changed

apps/dav/lib/Connector/Sabre/TagsPlugin.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin {
4949
* @var \Sabre\DAV\Server
5050
*/
5151
private $server;
52-
53-
/**
54-
* @var ITags
55-
*/
56-
private $tagger;
52+
private ?ITags $tagger = null;
5753

5854
/**
5955
* Array of file id to tags array
@@ -105,12 +101,17 @@ public function initialize(\Sabre\DAV\Server $server) {
105101
*
106102
* @return ITags tagger
107103
*/
108-
private function getTagger() {
109-
if (!$this->tagger) {
110-
$this->tagger = $this->tagManager->load('files');
111-
assert($this->tagger !== null);
104+
private function getTagger(): ITags {
105+
if ($this->tagger) {
106+
return $this->tagger;
107+
}
108+
109+
$tagger = $this->tagManager->load('files');
110+
if ($tagger === null) {
111+
throw new \RuntimeException('Tagger not found for files');
112112
}
113-
return $this->tagger;
113+
$this->tagger = $tagger;
114+
return $tagger;
114115
}
115116

116117
/**

apps/federation/lib/SyncFederationAddressBooks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
*/
88
namespace OCA\Federation;
99

10-
use OC\OCS\DiscoveryService;
1110
use OCA\DAV\CardDAV\SyncService;
1211
use OCP\AppFramework\Http;
12+
use OCP\OCS\IDiscoveryService;
1313
use Psr\Log\LoggerInterface;
1414

1515
class SyncFederationAddressBooks {
1616
public function __construct(
1717
protected DbHandler $dbHandler,
1818
private SyncService $syncService,
19-
private DiscoveryService $ocsDiscoveryService,
19+
private IDiscoveryService $ocsDiscoveryService,
2020
private LoggerInterface $logger,
2121
) {
2222
}

apps/settings/lib/Controller/ChangePasswordController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use OCP\IRequest;
2626
use OCP\IUser;
2727
use OCP\IUserManager;
28+
use OCP\IUserSession;
2829
use OCP\Server;
2930

3031
class ChangePasswordController extends Controller {

apps/user_ldap/lib/Access.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,9 +1050,6 @@ public function countObjects(?int $limit = null, ?int $offset = null) {
10501050
/**
10511051
* Returns the LDAP handler
10521052
*
1053-
* @throws \OC\ServerNotAvailableException
1054-
*/
1055-
/**
10561053
* @param mixed[] $arguments
10571054
* @return mixed
10581055
* @throws ServerNotAvailableException

apps/user_ldap/lib/User_LDAP.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,7 @@ public function getUsers($search = '', $limit = 10, $offset = 0) {
260260
/**
261261
* checks whether a user is still available on LDAP
262262
*
263-
* @param string|User $user either the Nextcloud user
264-
* name or an instance of that user
263+
* @param string|User $user either the Nextcloud user id or an instance of that user
265264
* @throws \Exception
266265
* @throws ServerNotAvailableException
267266
*/

build/psalm-baseline.xml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,16 +3473,16 @@
34733473
</file>
34743474
<file src="lib/private/Command/CommandJob.php">
34753475
<UndefinedClass>
3476-
<code><![CDATA[\Test\Command\FilesystemCommand]]></code>
3477-
<code><![CDATA[\Test\Command\SimpleCommand]]></code>
3478-
<code><![CDATA[\Test\Command\StateFullCommand]]></code>
3476+
<code><![CDATA[FilesystemCommand]]></code>
3477+
<code><![CDATA[SimpleCommand]]></code>
3478+
<code><![CDATA[StateFullCommand]]></code>
34793479
</UndefinedClass>
34803480
</file>
34813481
<file src="lib/private/Command/QueueBus.php">
34823482
<UndefinedClass>
3483-
<code><![CDATA[\Test\Command\FilesystemCommand]]></code>
3484-
<code><![CDATA[\Test\Command\SimpleCommand]]></code>
3485-
<code><![CDATA[\Test\Command\StateFullCommand]]></code>
3483+
<code><![CDATA[FilesystemCommand]]></code>
3484+
<code><![CDATA[SimpleCommand]]></code>
3485+
<code><![CDATA[StateFullCommand]]></code>
34863486
</UndefinedClass>
34873487
</file>
34883488
<file src="lib/private/Comments/Manager.php">
@@ -3593,16 +3593,6 @@
35933593
<code><![CDATA[string]]></code>
35943594
</InvalidReturnType>
35953595
</file>
3596-
<file src="lib/private/Diagnostics/Query.php">
3597-
<ImplementedReturnTypeMismatch>
3598-
<code><![CDATA[float]]></code>
3599-
</ImplementedReturnTypeMismatch>
3600-
</file>
3601-
<file src="lib/private/Diagnostics/QueryLogger.php">
3602-
<InvalidArgument>
3603-
<code><![CDATA[microtime(true)]]></code>
3604-
</InvalidArgument>
3605-
</file>
36063596
<file src="lib/private/DirectEditing/Manager.php">
36073597
<InvalidReturnType>
36083598
<code><![CDATA[TemplateResponse]]></code>

core/routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use OC\Route\Router;
66

77
/**
8-
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
8+
* SPDX-FileCopyrightText: 2016-2025 Nextcloud GmbH and Nextcloud contributors
99
* SPDX-FileCopyrightText: 2012-2016 ownCloud, Inc.
1010
* SPDX-License-Identifier: AGPL-3.0-only
1111
*/

lib/private/AppFramework/Bootstrap/ServiceAliasRegistration.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,26 @@
1313
*/
1414
class ServiceAliasRegistration extends ARegistration {
1515
/**
16-
* @psalm-param string|class-string $alias
17-
* @paslm-param string|class-string $target
16+
* @param class-string $alias
17+
* @param class-string $target
1818
*/
1919
public function __construct(
2020
string $appId,
21-
/**
22-
* @psalm-var string|class-string
23-
*/
24-
private string $alias,
25-
/**
26-
* @psalm-var string|class-string
27-
*/
28-
private string $target,
21+
private readonly string $alias,
22+
private readonly string $target,
2923
) {
3024
parent::__construct($appId);
3125
}
3226

3327
/**
34-
* @psalm-return string|class-string
28+
* @return class-string
3529
*/
3630
public function getAlias(): string {
3731
return $this->alias;
3832
}
3933

4034
/**
41-
* @psalm-return string|class-string
35+
* @return class-string
4236
*/
4337
public function getTarget(): string {
4438
return $this->target;

lib/private/AppFramework/Bootstrap/ServiceFactoryRegistration.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ class ServiceFactoryRegistration extends ARegistration {
1818
*/
1919
private $factory;
2020

21+
/**
22+
* @param class-string $name
23+
*/
2124
public function __construct(
2225
string $appId,
23-
/**
24-
* @psalm-var string|class-string
25-
*/
2626
private string $name,
2727
callable $target,
2828
private bool $shared,

lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use OC\AppFramework\Utility\ControllerMethodReflector;
2020
use OC\Settings\AuthorizedGroupMapper;
2121
use OC\User\Session;
22-
use OCA\Talk\Controller\PageController;
22+
use OCA\Talk\Controller\PageController as TalkPageController;
2323
use OCP\App\AppPathNotFoundException;
2424
use OCP\App\IAppManager;
2525
use OCP\AppFramework\Controller;
@@ -110,7 +110,7 @@ public function beforeController($controller, $methodName) {
110110
$this->navigationManager->setActiveEntry($this->appName);
111111

112112
/** @psalm-suppress UndefinedClass */
113-
if (get_class($controller) === PageController::class && $methodName === 'showCall') {
113+
if (get_class($controller) === TalkPageController::class && $methodName === 'showCall') {
114114
$this->navigationManager->setActiveEntry('spreed');
115115
}
116116

0 commit comments

Comments
 (0)