diff options
author | provokateurin <kate@provokateurin.de> | 2025-07-15 12:56:51 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2025-07-15 14:35:02 +0200 |
commit | 9980b4c633789e9010aecfa2df801b2f3118cc6f (patch) | |
tree | e7e652de3a9a4b8f48226737b7fc1e3f7c71749b | |
parent | af5acc35cd41e3384240489b96eb8d263498a1f2 (diff) | |
download | nextcloud-server-chore/too-many-arguments.tar.gz nextcloud-server-chore/too-many-arguments.zip |
chore: Fix all method calls with too many argumentschore/too-many-arguments
Signed-off-by: provokateurin <kate@provokateurin.de>
-rw-r--r-- | apps/dav/lib/Connector/Sabre/FilesReportPlugin.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/ServerFactory.php | 2 | ||||
-rw-r--r-- | apps/encryption/lib/Session.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/Command/Verify.php | 1 | ||||
-rw-r--r-- | apps/files_external/lib/Controller/GlobalStoragesController.php | 4 | ||||
-rw-r--r-- | apps/files_external/lib/Controller/StoragesController.php | 10 | ||||
-rw-r--r-- | apps/files_external/lib/Controller/UserGlobalStoragesController.php | 9 | ||||
-rw-r--r-- | apps/files_external/lib/Controller/UserStoragesController.php | 8 | ||||
-rw-r--r-- | apps/files_external/lib/MountConfig.php | 4 | ||||
-rw-r--r-- | build/psalm-baseline.xml | 39 | ||||
-rw-r--r-- | core/Command/Config/ListConfigs.php | 2 | ||||
-rw-r--r-- | lib/private/App/AppStore/Fetcher/Fetcher.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Filesystem.php | 5 | ||||
-rw-r--r-- | lib/private/Lockdown/Filesystem/NullStorage.php | 2 | ||||
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 2 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 2 | ||||
-rw-r--r-- | tests/Core/Command/Config/ListConfigsTest.php | 16 |
17 files changed, 33 insertions, 79 deletions
diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php index 9e625ce3184..96399a9d309 100644 --- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php @@ -156,7 +156,7 @@ class FilesReportPlugin extends ServerPlugin { // to user backends. I.e. the final result may return more results than requested. $resultNodes = $this->processFilterRulesForFileNodes($filterRules, $limit ?? null, $offset ?? null); } catch (TagNotFoundException $e) { - throw new PreconditionFailed('Cannot filter by non-existing tag', 0, $e); + throw new PreconditionFailed('Cannot filter by non-existing tag', $e->getMessage()); } $results = []; diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php index 214412e1744..3749b506d16 100644 --- a/apps/dav/lib/Connector/Sabre/ServerFactory.php +++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php @@ -184,7 +184,7 @@ class ServerFactory { !$this->config->getSystemValue('debug', false) ) ); - $server->addPlugin(new QuotaPlugin($view, true)); + $server->addPlugin(new QuotaPlugin($view)); $server->addPlugin(new ChecksumUpdatePlugin()); // Allow view-only plugin for webdav requests diff --git a/apps/encryption/lib/Session.php b/apps/encryption/lib/Session.php index e2731d9611d..df1e5d664ad 100644 --- a/apps/encryption/lib/Session.php +++ b/apps/encryption/lib/Session.php @@ -66,7 +66,7 @@ class Session { public function getPrivateKey() { $key = $this->session->get('privateKey'); if (is_null($key)) { - throw new PrivateKeyMissingException('please try to log-out and log-in again', 0); + throw new PrivateKeyMissingException('please try to log-out and log-in again'); } return $key; } diff --git a/apps/files_external/lib/Command/Verify.php b/apps/files_external/lib/Command/Verify.php index 18cbc5a6774..ecebbe0f7e6 100644 --- a/apps/files_external/lib/Command/Verify.php +++ b/apps/files_external/lib/Command/Verify.php @@ -97,7 +97,6 @@ class Verify extends Base { MountConfig::getBackendStatus( $backend->getStorageClass(), $storage->getBackendOptions(), - false ) ); } catch (InsufficientDataForMeaningfulAnswerException $e) { diff --git a/apps/files_external/lib/Controller/GlobalStoragesController.php b/apps/files_external/lib/Controller/GlobalStoragesController.php index 132295f6b35..e7274c9cfb6 100644 --- a/apps/files_external/lib/Controller/GlobalStoragesController.php +++ b/apps/files_external/lib/Controller/GlobalStoragesController.php @@ -133,7 +133,6 @@ class GlobalStoragesController extends StoragesController { * @param array $applicableUsers users for which to mount the storage * @param array $applicableGroups groups for which to mount the storage * @param int $priority priority - * @param bool $testOnly whether to storage should only test the connection or do more things * * @return DataResponse */ @@ -148,7 +147,6 @@ class GlobalStoragesController extends StoragesController { $applicableUsers, $applicableGroups, $priority, - $testOnly = true, ) { $storage = $this->createStorage( $mountPoint, @@ -181,7 +179,7 @@ class GlobalStoragesController extends StoragesController { ); } - $this->updateStorageStatus($storage, $testOnly); + $this->updateStorageStatus($storage); return new DataResponse( $storage->jsonSerialize(true), diff --git a/apps/files_external/lib/Controller/StoragesController.php b/apps/files_external/lib/Controller/StoragesController.php index 18f8d3164b7..df3a4528054 100644 --- a/apps/files_external/lib/Controller/StoragesController.php +++ b/apps/files_external/lib/Controller/StoragesController.php @@ -213,9 +213,8 @@ abstract class StoragesController extends Controller { * on whether the remote storage is available or not. * * @param StorageConfig $storage storage configuration - * @param bool $testOnly whether to storage should only test the connection or do more things */ - protected function updateStorageStatus(StorageConfig &$storage, $testOnly = true) { + protected function updateStorageStatus(StorageConfig &$storage) { try { $this->manipulateStorageConfig($storage); @@ -226,8 +225,6 @@ abstract class StoragesController extends Controller { MountConfig::getBackendStatus( $backend->getStorageClass(), $storage->getBackendOptions(), - false, - $testOnly ) ); } catch (InsufficientDataForMeaningfulAnswerException $e) { @@ -268,15 +265,14 @@ abstract class StoragesController extends Controller { * Get an external storage entry. * * @param int $id storage id - * @param bool $testOnly whether to storage should only test the connection or do more things * * @return DataResponse */ - public function show(int $id, $testOnly = true) { + public function show(int $id) { try { $storage = $this->service->getStorage($id); - $this->updateStorageStatus($storage, $testOnly); + $this->updateStorageStatus($storage); } catch (NotFoundException $e) { return new DataResponse( [ diff --git a/apps/files_external/lib/Controller/UserGlobalStoragesController.php b/apps/files_external/lib/Controller/UserGlobalStoragesController.php index 5f428db9661..88a9f936401 100644 --- a/apps/files_external/lib/Controller/UserGlobalStoragesController.php +++ b/apps/files_external/lib/Controller/UserGlobalStoragesController.php @@ -97,15 +97,14 @@ class UserGlobalStoragesController extends StoragesController { * Get an external storage entry. * * @param int $id storage id - * @param bool $testOnly whether to storage should only test the connection or do more things * @return DataResponse */ #[NoAdminRequired] - public function show($id, $testOnly = true) { + public function show($id) { try { $storage = $this->service->getStorage($id); - $this->updateStorageStatus($storage, $testOnly); + $this->updateStorageStatus($storage); } catch (NotFoundException $e) { return new DataResponse( [ @@ -133,7 +132,6 @@ class UserGlobalStoragesController extends StoragesController { * * @param int $id storage id * @param array $backendOptions backend-specific options - * @param bool $testOnly whether to storage should only test the connection or do more things * * @return DataResponse */ @@ -142,7 +140,6 @@ class UserGlobalStoragesController extends StoragesController { public function update( $id, $backendOptions, - $testOnly = true, ) { try { $storage = $this->service->getStorage($id); @@ -167,7 +164,7 @@ class UserGlobalStoragesController extends StoragesController { ); } - $this->updateStorageStatus($storage, $testOnly); + $this->updateStorageStatus($storage); $this->sanitizeStorage($storage); return new DataResponse( diff --git a/apps/files_external/lib/Controller/UserStoragesController.php b/apps/files_external/lib/Controller/UserStoragesController.php index 7b0c858e51b..7b564d57f7e 100644 --- a/apps/files_external/lib/Controller/UserStoragesController.php +++ b/apps/files_external/lib/Controller/UserStoragesController.php @@ -85,8 +85,8 @@ class UserStoragesController extends StoragesController { * {@inheritdoc} */ #[NoAdminRequired] - public function show(int $id, $testOnly = true) { - return parent::show($id, $testOnly); + public function show(int $id) { + return parent::show($id); } /** @@ -152,7 +152,6 @@ class UserStoragesController extends StoragesController { * @param string $authMechanism authentication mechanism identifier * @param array $backendOptions backend-specific options * @param array $mountOptions backend-specific mount options - * @param bool $testOnly whether to storage should only test the connection or do more things * * @return DataResponse */ @@ -165,7 +164,6 @@ class UserStoragesController extends StoragesController { $authMechanism, $backendOptions, $mountOptions, - $testOnly = true, ) { $storage = $this->createStorage( $mountPoint, @@ -195,7 +193,7 @@ class UserStoragesController extends StoragesController { ); } - $this->updateStorageStatus($storage, $testOnly); + $this->updateStorageStatus($storage); return new DataResponse( $storage->jsonSerialize(true), diff --git a/apps/files_external/lib/MountConfig.php b/apps/files_external/lib/MountConfig.php index a7d9e6f2603..5637ee71ec1 100644 --- a/apps/files_external/lib/MountConfig.php +++ b/apps/files_external/lib/MountConfig.php @@ -76,7 +76,7 @@ class MountConfig { * @return int see self::STATUS_* * @throws \Exception */ - public static function getBackendStatus($class, $options, $isPersonal, $testOnly = true) { + public static function getBackendStatus($class, $options) { if (self::$skipTest) { return StorageNotAvailableException::STATUS_SUCCESS; } @@ -93,7 +93,7 @@ class MountConfig { $storage = new $class($options); try { - $result = $storage->test($isPersonal, $testOnly); + $result = $storage->test(); $storage->setAvailability($result); if ($result) { return StorageNotAvailableException::STATUS_SUCCESS; diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index db43a3e7336..44e54ae7f54 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -688,15 +688,9 @@ </MoreSpecificReturnType> </file> <file src="apps/dav/lib/Connector/Sabre/FilesReportPlugin.php"> - <InvalidArgument> - <code><![CDATA[0]]></code> - </InvalidArgument> <InvalidNullableReturnType> <code><![CDATA[bool]]></code> </InvalidNullableReturnType> - <TooManyArguments> - <code><![CDATA[new PreconditionFailed('Cannot filter by non-existing tag', 0, $e)]]></code> - </TooManyArguments> <UndefinedClass> <code><![CDATA[Circles]]></code> </UndefinedClass> @@ -753,9 +747,6 @@ <code><![CDATA[getL10NFactory]]></code> <code><![CDATA[getUserFolder]]></code> </DeprecatedMethod> - <TooManyArguments> - <code><![CDATA[new QuotaPlugin($view, true)]]></code> - </TooManyArguments> </file> <file src="apps/dav/lib/Connector/Sabre/ShareTypeList.php"> <InvalidArgument> @@ -1177,11 +1168,6 @@ <code><![CDATA[setAppValue]]></code> </DeprecatedMethod> </file> - <file src="apps/encryption/lib/Session.php"> - <TooManyArguments> - <code><![CDATA[new PrivateKeyMissingException('please try to log-out and log-in again', 0)]]></code> - </TooManyArguments> - </file> <file src="apps/encryption/lib/Settings/Admin.php"> <DeprecatedMethod> <code><![CDATA[getAppValue]]></code> @@ -1511,9 +1497,6 @@ <code><![CDATA[setIV]]></code> <code><![CDATA[setKey]]></code> </InternalMethod> - <TooManyArguments> - <code><![CDATA[test]]></code> - </TooManyArguments> </file> <file src="apps/files_external/lib/Service/BackendService.php"> <DeprecatedClass> @@ -2901,9 +2884,6 @@ <FalsableReturnStatement> <code><![CDATA[$this->appConfig->getValues($app, false)]]></code> </FalsableReturnStatement> - <TooManyArguments> - <code><![CDATA[getFilteredValues]]></code> - </TooManyArguments> </file> <file src="core/Command/Db/AddMissingPrimaryKeys.php"> <DeprecatedMethod> @@ -3314,11 +3294,6 @@ <code><![CDATA[$key]]></code> </MoreSpecificImplementedParamType> </file> - <file src="lib/private/App/AppStore/Fetcher/Fetcher.php"> - <TooManyArguments> - <code><![CDATA[fetch]]></code> - </TooManyArguments> - </file> <file src="lib/private/App/DependencyAnalyzer.php"> <InvalidNullableReturnType> <code><![CDATA[bool]]></code> @@ -3775,9 +3750,6 @@ <code><![CDATA[Mount\MountPoint[]]]></code> <code><![CDATA[\OC\Files\Storage\Storage|null]]></code> </MoreSpecificReturnType> - <TooManyArguments> - <code><![CDATA[addStorageWrapper]]></code> - </TooManyArguments> </file> <file src="lib/private/Files/Mount/MountPoint.php"> <UndefinedInterfaceMethod> @@ -4071,11 +4043,6 @@ <code><![CDATA[getIncomplete]]></code> </InvalidReturnType> </file> - <file src="lib/private/Lockdown/Filesystem/NullStorage.php"> - <TooManyArguments> - <code><![CDATA[new IteratorDirectory([])]]></code> - </TooManyArguments> - </file> <file src="lib/private/Lockdown/LockdownManager.php"> <InvalidFunctionCall> <code><![CDATA[$callback()]]></code> @@ -4283,9 +4250,6 @@ <code><![CDATA[$share->getId()]]></code> <code><![CDATA[(int)$data['id']]]></code> </InvalidArgument> - <TooManyArguments> - <code><![CDATA[set]]></code> - </TooManyArguments> <UndefinedInterfaceMethod> <code><![CDATA[getParent]]></code> </UndefinedInterfaceMethod> @@ -4294,9 +4258,6 @@ <InvalidArgument> <code><![CDATA[$id]]></code> </InvalidArgument> - <TooManyArguments> - <code><![CDATA[update]]></code> - </TooManyArguments> <UndefinedClass> <code><![CDATA[\OCA\Circles\Api\v1\Circles]]></code> </UndefinedClass> diff --git a/core/Command/Config/ListConfigs.php b/core/Command/Config/ListConfigs.php index b81bfbf4d18..a7c195276eb 100644 --- a/core/Command/Config/ListConfigs.php +++ b/core/Command/Config/ListConfigs.php @@ -125,7 +125,7 @@ class ListConfigs extends Base { */ protected function getAppConfigs(string $app, bool $noSensitiveValues) { if ($noSensitiveValues) { - return $this->appConfig->getFilteredValues($app, false); + return $this->appConfig->getFilteredValues($app); } else { return $this->appConfig->getValues($app, false); } diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php index 2e949fedb51..24876675d60 100644 --- a/lib/private/App/AppStore/Fetcher/Fetcher.php +++ b/lib/private/App/AppStore/Fetcher/Fetcher.php @@ -56,7 +56,7 @@ abstract class Fetcher { * * @return array */ - protected function fetch($ETag, $content) { + protected function fetch($ETag, $content, $allowUnstable = false) { $appstoreenabled = $this->config->getSystemValueBool('appstoreenabled', true); if ((int)$this->config->getAppValue('settings', 'appstore-fetcher-lastFailure', '0') > time() - self::RETRY_AFTER_FAILURE_SECONDS) { return []; diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index 48c069de0b9..8fe56cf060c 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -8,6 +8,7 @@ namespace OC\Files; use OC\Files\Mount\MountPoint; +use OC\Files\Storage\StorageFactory; use OC\User\NoUserException; use OCP\Cache\CappedMemoryCache; use OCP\EventDispatcher\IEventDispatcher; @@ -178,7 +179,9 @@ class Filesystem { } $mounts = self::getMountManager()->getAll(); - if (!self::getLoader()->addStorageWrapper($wrapperName, $wrapper, $priority, $mounts)) { + /** @var StorageFactory $loader */ + $loader = self::getLoader(); + if (!$loader->addStorageWrapper($wrapperName, $wrapper, $priority, $mounts)) { // do not re-wrap if storage with this name already existed return; } diff --git a/lib/private/Lockdown/Filesystem/NullStorage.php b/lib/private/Lockdown/Filesystem/NullStorage.php index 71a40d8da1e..fd952fae637 100644 --- a/lib/private/Lockdown/Filesystem/NullStorage.php +++ b/lib/private/Lockdown/Filesystem/NullStorage.php @@ -30,7 +30,7 @@ class NullStorage extends Common { } public function opendir(string $path): IteratorDirectory { - return new IteratorDirectory([]); + return new IteratorDirectory(); } public function is_dir(string $path): bool { diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index e1eebe1e450..a2c0fd15eb4 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -284,7 +284,7 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv ->set('expiration', $qb->createNamedParameter($expirationDate, IQueryBuilder::PARAM_DATETIME_MUTABLE)) ->set('note', $qb->createNamedParameter($share->getNote())) ->set('label', $qb->createNamedParameter($share->getLabel())) - ->set('hide_download', $qb->createNamedParameter($share->getHideDownload() ? 1 : 0), IQueryBuilder::PARAM_INT) + ->set('hide_download', $qb->createNamedParameter($share->getHideDownload() ? 1 : 0, IQueryBuilder::PARAM_INT)) ->executeStatement(); } diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 01664c6a0a3..9bfa810b108 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -12,6 +12,7 @@ use OC\KnownUser\KnownUserService; use OC\Share20\Exception\ProviderException; use OCA\Files_Sharing\AppInfo\Application; use OCA\Files_Sharing\SharedStorage; +use OCA\ShareByMail\ShareByMailProvider; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\File; use OCP\Files\Folder; @@ -869,6 +870,7 @@ class Manager implements IManager { // Now update the share! $provider = $this->factory->getProviderForType($share->getShareType()); if ($share->getShareType() === IShare::TYPE_EMAIL) { + /** @var ShareByMailProvider $provider */ $share = $provider->update($share, $plainTextPassword); } else { $share = $provider->update($share); diff --git a/tests/Core/Command/Config/ListConfigsTest.php b/tests/Core/Command/Config/ListConfigsTest.php index 2f2de288e9d..e4af55116c0 100644 --- a/tests/Core/Command/Config/ListConfigsTest.php +++ b/tests/Core/Command/Config/ListConfigsTest.php @@ -70,10 +70,10 @@ class ListConfigsTest extends TestCase { ], // app config [ - ['files', false, [ + ['files', [ 'enabled' => 'yes', ]], - ['core', false, [ + ['core', [ 'global_cache_gc_lastrun' => '1430388388', ]], ], @@ -150,10 +150,10 @@ class ListConfigsTest extends TestCase { ], // app config [ - ['files', false, [ + ['files', [ 'enabled' => 'yes', ]], - ['core', false, [ + ['core', [ 'global_cache_gc_lastrun' => '1430388388', ]], ], @@ -185,10 +185,10 @@ class ListConfigsTest extends TestCase { ], // app config [ - ['files', false, [ + ['files', [ 'enabled' => 'yes', ]], - ['core', false, [ + ['core', [ 'global_cache_gc_lastrun' => '1430388388', ]], ], @@ -213,10 +213,10 @@ class ListConfigsTest extends TestCase { ], // app config [ - ['files', false, [ + ['files', [ 'enabled' => 'yes', ]], - ['core', false, [ + ['core', [ 'global_cache_gc_lastrun' => '1430388388', ]], ], |