Skip to content

Commit c86d1d1

Browse files
committed
chore: Fix all method calls with too many arguments
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent af5acc3 commit c86d1d1

16 files changed

Lines changed: 25 additions & 71 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function onReport($reportName, $report, $uri) {
156156
// to user backends. I.e. the final result may return more results than requested.
157157
$resultNodes = $this->processFilterRulesForFileNodes($filterRules, $limit ?? null, $offset ?? null);
158158
} catch (TagNotFoundException $e) {
159-
throw new PreconditionFailed('Cannot filter by non-existing tag', 0, $e);
159+
throw new PreconditionFailed('Cannot filter by non-existing tag', $e->getMessage());
160160
}
161161

162162
$results = [];

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function createServer(
184184
!$this->config->getSystemValue('debug', false)
185185
)
186186
);
187-
$server->addPlugin(new QuotaPlugin($view, true));
187+
$server->addPlugin(new QuotaPlugin($view));
188188
$server->addPlugin(new ChecksumUpdatePlugin());
189189

190190
// Allow view-only plugin for webdav requests

apps/encryption/lib/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function isReady() {
6666
public function getPrivateKey() {
6767
$key = $this->session->get('privateKey');
6868
if (is_null($key)) {
69-
throw new PrivateKeyMissingException('please try to log-out and log-in again', 0);
69+
throw new PrivateKeyMissingException('please try to log-out and log-in again');
7070
}
7171
return $key;
7272
}

apps/files_external/lib/Command/Verify.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ private function updateStorageStatus(StorageConfig &$storage, $configInput, Outp
9797
MountConfig::getBackendStatus(
9898
$backend->getStorageClass(),
9999
$storage->getBackendOptions(),
100-
false
101100
)
102101
);
103102
} catch (InsufficientDataForMeaningfulAnswerException $e) {

apps/files_external/lib/Controller/GlobalStoragesController.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ public function create(
133133
* @param array $applicableUsers users for which to mount the storage
134134
* @param array $applicableGroups groups for which to mount the storage
135135
* @param int $priority priority
136-
* @param bool $testOnly whether to storage should only test the connection or do more things
137136
*
138137
* @return DataResponse
139138
*/
@@ -148,7 +147,6 @@ public function update(
148147
$applicableUsers,
149148
$applicableGroups,
150149
$priority,
151-
$testOnly = true,
152150
) {
153151
$storage = $this->createStorage(
154152
$mountPoint,
@@ -181,7 +179,7 @@ public function update(
181179
);
182180
}
183181

184-
$this->updateStorageStatus($storage, $testOnly);
182+
$this->updateStorageStatus($storage);
185183

186184
return new DataResponse(
187185
$storage->jsonSerialize(true),

apps/files_external/lib/Controller/StoragesController.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,8 @@ protected function manipulateStorageConfig(StorageConfig $storage) {
213213
* on whether the remote storage is available or not.
214214
*
215215
* @param StorageConfig $storage storage configuration
216-
* @param bool $testOnly whether to storage should only test the connection or do more things
217216
*/
218-
protected function updateStorageStatus(StorageConfig &$storage, $testOnly = true) {
217+
protected function updateStorageStatus(StorageConfig &$storage) {
219218
try {
220219
$this->manipulateStorageConfig($storage);
221220

@@ -226,8 +225,6 @@ protected function updateStorageStatus(StorageConfig &$storage, $testOnly = true
226225
MountConfig::getBackendStatus(
227226
$backend->getStorageClass(),
228227
$storage->getBackendOptions(),
229-
false,
230-
$testOnly
231228
)
232229
);
233230
} catch (InsufficientDataForMeaningfulAnswerException $e) {
@@ -268,15 +265,14 @@ public function index() {
268265
* Get an external storage entry.
269266
*
270267
* @param int $id storage id
271-
* @param bool $testOnly whether to storage should only test the connection or do more things
272268
*
273269
* @return DataResponse
274270
*/
275-
public function show(int $id, $testOnly = true) {
271+
public function show(int $id) {
276272
try {
277273
$storage = $this->service->getStorage($id);
278274

279-
$this->updateStorageStatus($storage, $testOnly);
275+
$this->updateStorageStatus($storage);
280276
} catch (NotFoundException $e) {
281277
return new DataResponse(
282278
[

apps/files_external/lib/Controller/UserGlobalStoragesController.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,14 @@ protected function manipulateStorageConfig(StorageConfig $storage) {
9797
* Get an external storage entry.
9898
*
9999
* @param int $id storage id
100-
* @param bool $testOnly whether to storage should only test the connection or do more things
101100
* @return DataResponse
102101
*/
103102
#[NoAdminRequired]
104-
public function show($id, $testOnly = true) {
103+
public function show($id) {
105104
try {
106105
$storage = $this->service->getStorage($id);
107106

108-
$this->updateStorageStatus($storage, $testOnly);
107+
$this->updateStorageStatus($storage);
109108
} catch (NotFoundException $e) {
110109
return new DataResponse(
111110
[
@@ -133,7 +132,6 @@ public function show($id, $testOnly = true) {
133132
*
134133
* @param int $id storage id
135134
* @param array $backendOptions backend-specific options
136-
* @param bool $testOnly whether to storage should only test the connection or do more things
137135
*
138136
* @return DataResponse
139137
*/
@@ -142,7 +140,6 @@ public function show($id, $testOnly = true) {
142140
public function update(
143141
$id,
144142
$backendOptions,
145-
$testOnly = true,
146143
) {
147144
try {
148145
$storage = $this->service->getStorage($id);
@@ -167,7 +164,7 @@ public function update(
167164
);
168165
}
169166

170-
$this->updateStorageStatus($storage, $testOnly);
167+
$this->updateStorageStatus($storage);
171168
$this->sanitizeStorage($storage);
172169

173170
return new DataResponse(

apps/files_external/lib/Controller/UserStoragesController.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ public function index() {
8585
* {@inheritdoc}
8686
*/
8787
#[NoAdminRequired]
88-
public function show(int $id, $testOnly = true) {
89-
return parent::show($id, $testOnly);
88+
public function show(int $id) {
89+
return parent::show($id);
9090
}
9191

9292
/**
@@ -152,7 +152,6 @@ public function create(
152152
* @param string $authMechanism authentication mechanism identifier
153153
* @param array $backendOptions backend-specific options
154154
* @param array $mountOptions backend-specific mount options
155-
* @param bool $testOnly whether to storage should only test the connection or do more things
156155
*
157156
* @return DataResponse
158157
*/
@@ -165,7 +164,6 @@ public function update(
165164
$authMechanism,
166165
$backendOptions,
167166
$mountOptions,
168-
$testOnly = true,
169167
) {
170168
$storage = $this->createStorage(
171169
$mountPoint,
@@ -195,7 +193,7 @@ public function update(
195193
);
196194
}
197195

198-
$this->updateStorageStatus($storage, $testOnly);
196+
$this->updateStorageStatus($storage);
199197

200198
return new DataResponse(
201199
$storage->jsonSerialize(true),

apps/files_external/lib/MountConfig.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static function substitutePlaceholdersInConfig($input, ?string $userId =
7676
* @return int see self::STATUS_*
7777
* @throws \Exception
7878
*/
79-
public static function getBackendStatus($class, $options, $isPersonal, $testOnly = true) {
79+
public static function getBackendStatus($class, $options) {
8080
if (self::$skipTest) {
8181
return StorageNotAvailableException::STATUS_SUCCESS;
8282
}
@@ -93,7 +93,7 @@ public static function getBackendStatus($class, $options, $isPersonal, $testOnly
9393
$storage = new $class($options);
9494

9595
try {
96-
$result = $storage->test($isPersonal, $testOnly);
96+
$result = $storage->test();
9797
$storage->setAvailability($result);
9898
if ($result) {
9999
return StorageNotAvailableException::STATUS_SUCCESS;

build/psalm-baseline.xml

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -688,15 +688,9 @@
688688
</MoreSpecificReturnType>
689689
</file>
690690
<file src="apps/dav/lib/Connector/Sabre/FilesReportPlugin.php">
691-
<InvalidArgument>
692-
<code><![CDATA[0]]></code>
693-
</InvalidArgument>
694691
<InvalidNullableReturnType>
695692
<code><![CDATA[bool]]></code>
696693
</InvalidNullableReturnType>
697-
<TooManyArguments>
698-
<code><![CDATA[new PreconditionFailed('Cannot filter by non-existing tag', 0, $e)]]></code>
699-
</TooManyArguments>
700694
<UndefinedClass>
701695
<code><![CDATA[Circles]]></code>
702696
</UndefinedClass>
@@ -753,9 +747,6 @@
753747
<code><![CDATA[getL10NFactory]]></code>
754748
<code><![CDATA[getUserFolder]]></code>
755749
</DeprecatedMethod>
756-
<TooManyArguments>
757-
<code><![CDATA[new QuotaPlugin($view, true)]]></code>
758-
</TooManyArguments>
759750
</file>
760751
<file src="apps/dav/lib/Connector/Sabre/ShareTypeList.php">
761752
<InvalidArgument>
@@ -1177,11 +1168,6 @@
11771168
<code><![CDATA[setAppValue]]></code>
11781169
</DeprecatedMethod>
11791170
</file>
1180-
<file src="apps/encryption/lib/Session.php">
1181-
<TooManyArguments>
1182-
<code><![CDATA[new PrivateKeyMissingException('please try to log-out and log-in again', 0)]]></code>
1183-
</TooManyArguments>
1184-
</file>
11851171
<file src="apps/encryption/lib/Settings/Admin.php">
11861172
<DeprecatedMethod>
11871173
<code><![CDATA[getAppValue]]></code>
@@ -1511,9 +1497,6 @@
15111497
<code><![CDATA[setIV]]></code>
15121498
<code><![CDATA[setKey]]></code>
15131499
</InternalMethod>
1514-
<TooManyArguments>
1515-
<code><![CDATA[test]]></code>
1516-
</TooManyArguments>
15171500
</file>
15181501
<file src="apps/files_external/lib/Service/BackendService.php">
15191502
<DeprecatedClass>
@@ -2901,9 +2884,6 @@
29012884
<FalsableReturnStatement>
29022885
<code><![CDATA[$this->appConfig->getValues($app, false)]]></code>
29032886
</FalsableReturnStatement>
2904-
<TooManyArguments>
2905-
<code><![CDATA[getFilteredValues]]></code>
2906-
</TooManyArguments>
29072887
</file>
29082888
<file src="core/Command/Db/AddMissingPrimaryKeys.php">
29092889
<DeprecatedMethod>
@@ -3314,11 +3294,6 @@
33143294
<code><![CDATA[$key]]></code>
33153295
</MoreSpecificImplementedParamType>
33163296
</file>
3317-
<file src="lib/private/App/AppStore/Fetcher/Fetcher.php">
3318-
<TooManyArguments>
3319-
<code><![CDATA[fetch]]></code>
3320-
</TooManyArguments>
3321-
</file>
33223297
<file src="lib/private/App/DependencyAnalyzer.php">
33233298
<InvalidNullableReturnType>
33243299
<code><![CDATA[bool]]></code>
@@ -3775,9 +3750,6 @@
37753750
<code><![CDATA[Mount\MountPoint[]]]></code>
37763751
<code><![CDATA[\OC\Files\Storage\Storage|null]]></code>
37773752
</MoreSpecificReturnType>
3778-
<TooManyArguments>
3779-
<code><![CDATA[addStorageWrapper]]></code>
3780-
</TooManyArguments>
37813753
</file>
37823754
<file src="lib/private/Files/Mount/MountPoint.php">
37833755
<UndefinedInterfaceMethod>
@@ -4071,11 +4043,6 @@
40714043
<code><![CDATA[getIncomplete]]></code>
40724044
</InvalidReturnType>
40734045
</file>
4074-
<file src="lib/private/Lockdown/Filesystem/NullStorage.php">
4075-
<TooManyArguments>
4076-
<code><![CDATA[new IteratorDirectory([])]]></code>
4077-
</TooManyArguments>
4078-
</file>
40794046
<file src="lib/private/Lockdown/LockdownManager.php">
40804047
<InvalidFunctionCall>
40814048
<code><![CDATA[$callback()]]></code>
@@ -4283,9 +4250,6 @@
42834250
<code><![CDATA[$share->getId()]]></code>
42844251
<code><![CDATA[(int)$data['id']]]></code>
42854252
</InvalidArgument>
4286-
<TooManyArguments>
4287-
<code><![CDATA[set]]></code>
4288-
</TooManyArguments>
42894253
<UndefinedInterfaceMethod>
42904254
<code><![CDATA[getParent]]></code>
42914255
</UndefinedInterfaceMethod>
@@ -4294,9 +4258,6 @@
42944258
<InvalidArgument>
42954259
<code><![CDATA[$id]]></code>
42964260
</InvalidArgument>
4297-
<TooManyArguments>
4298-
<code><![CDATA[update]]></code>
4299-
</TooManyArguments>
43004261
<UndefinedClass>
43014262
<code><![CDATA[\OCA\Circles\Api\v1\Circles]]></code>
43024263
</UndefinedClass>

0 commit comments

Comments
 (0)