diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-08-19 17:54:00 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-08-19 18:16:35 +0200 |
commit | fedf9c69d9c84fc0399badef39ed765de72c08f1 (patch) | |
tree | bfaae1e7efb907cb236769fada35a9cd05ebf29e /apps | |
parent | 60be722ee8781d9e94ecc66d62c0e5fcb7e3934e (diff) | |
download | nextcloud-server-fedf9c69d9c84fc0399badef39ed765de72c08f1.tar.gz nextcloud-server-fedf9c69d9c84fc0399badef39ed765de72c08f1.zip |
Use matching parameter names form interfaces and implementations
Found by Psalm 3.14.1
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 26 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/ObjectTree.php | 18 | ||||
-rw-r--r-- | apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php | 3 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Auth/Password/UserProvided.php | 4 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SMB.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/Migration/DummyUserSession.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/MountProvider.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/lib/ShareBackend/File.php | 7 | ||||
-rw-r--r-- | apps/user_ldap/lib/Group_Proxy.php | 14 | ||||
-rw-r--r-- | apps/user_ldap/lib/User_Proxy.php | 10 |
10 files changed, 49 insertions, 43 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 159f5c71673..885d128807f 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -905,15 +905,15 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * used/fetched to determine these numbers. If both are specified the * amount of times this is needed is reduced by a great degree. * - * @param mixed $id + * @param mixed $calendarId * @param int $calendarType * @return array */ - public function getCalendarObjects($id, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { + public function getCalendarObjects($calendarId, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { $query = $this->db->getQueryBuilder(); $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification']) ->from('calendarobjects') - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($id))) + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); $stmt = $query->execute(); @@ -946,16 +946,16 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * * This method must return null if the object did not exist. * - * @param mixed $id + * @param mixed $calendarId * @param string $objectUri * @param int $calendarType * @return array|null */ - public function getCalendarObject($id, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) { + public function getCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) { $query = $this->db->getQueryBuilder(); $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification']) ->from('calendarobjects') - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($id))) + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); $stmt = $query->execute(); @@ -991,7 +991,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param int $calendarType * @return array */ - public function getMultipleCalendarObjects($id, array $uris, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { + public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { if (empty($uris)) { return []; } @@ -1002,7 +1002,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $query = $this->db->getQueryBuilder(); $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification']) ->from('calendarobjects') - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($id))) + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) ->andWhere($query->expr()->in('uri', $query->createParameter('uri'))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); @@ -1288,12 +1288,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * as possible, so it gives you a good idea on what type of stuff you need * to think of. * - * @param mixed $id + * @param mixed $calendarId * @param array $filters * @param int $calendarType * @return array */ - public function calendarQuery($id, array $filters, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { + public function calendarQuery($calendarId, array $filters, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { $componentType = null; $requirePostFilter = true; $timeRange = null; @@ -1329,7 +1329,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $query = $this->db->getQueryBuilder(); $query->select($columns) ->from('calendarobjects') - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($id))) + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); if ($componentType) { @@ -1355,13 +1355,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } catch (ParseException $ex) { $this->logger->logException($ex, [ 'app' => 'dav', - 'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri'] + 'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'] ]); continue; } catch (InvalidDataException $ex) { $this->logger->logException($ex, [ 'app' => 'dav', - 'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri'] + 'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'] ]); continue; } diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php index e292744cd2f..680c0e84fca 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -189,8 +189,8 @@ class ObjectTree extends CachingTree { * This method must work recursively and delete the destination * if it exists * - * @param string $source - * @param string $destination + * @param string $sourcePath + * @param string $destinationPath * @throws FileLocked * @throws Forbidden * @throws InvalidPath @@ -201,14 +201,14 @@ class ObjectTree extends CachingTree { * @throws \Sabre\DAV\Exception\ServiceUnavailable * @return void */ - public function copy($source, $destination) { + public function copy($sourcePath, $destinationPath) { if (!$this->fileView) { throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); } - $info = $this->fileView->getFileInfo(dirname($destination)); - if ($this->fileView->file_exists($destination)) { + $info = $this->fileView->getFileInfo(dirname($destinationPath)); + if ($this->fileView->file_exists($destinationPath)) { $destinationPermission = $info && $info->isUpdateable(); } else { $destinationPermission = $info && $info->isCreatable(); @@ -218,9 +218,9 @@ class ObjectTree extends CachingTree { } // this will trigger existence check - $this->getNodeForPath($source); + $this->getNodeForPath($sourcePath); - list($destinationDir, $destinationName) = \Sabre\Uri\split($destination); + list($destinationDir, $destinationName) = \Sabre\Uri\split($destinationPath); try { $this->fileView->verifyPath($destinationDir, $destinationName); } catch (\OCP\Files\InvalidPathException $ex) { @@ -228,7 +228,7 @@ class ObjectTree extends CachingTree { } try { - $this->fileView->copy($source, $destination); + $this->fileView->copy($sourcePath, $destinationPath); } catch (StorageNotAvailableException $e) { throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage()); } catch (ForbiddenException $ex) { @@ -237,7 +237,7 @@ class ObjectTree extends CachingTree { throw new FileLocked($e->getMessage(), $e->getCode(), $e); } - list($destinationDir,) = \Sabre\Uri\split($destination); + list($destinationDir,) = \Sabre\Uri\split($destinationPath); $this->markDirty($destinationDir); } } diff --git a/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php b/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php index 911448e3498..f3bed7887f7 100644 --- a/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php @@ -93,7 +93,8 @@ class SystemTagsObjectMappingCollection implements ICollection { $this->user = $user; } - public function createFile($tagId, $data = null) { + public function createFile($name, $data = null) { + $tagId = $name; try { $tags = $this->tagManager->getTagsByIds([$tagId]); $tag = current($tags); diff --git a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php index f809cd6db6f..da7161a5239 100644 --- a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php +++ b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php @@ -64,8 +64,8 @@ class UserProvided extends AuthMechanism implements IUserProvided { return self::CREDENTIALS_IDENTIFIER_PREFIX . $storageId; } - public function saveBackendOptions(IUser $user, $id, array $options) { - $this->credentialsManager->store($user->getUID(), $this->getCredentialsIdentifier($id), [ + public function saveBackendOptions(IUser $user, $mountId, array $options) { + $this->credentialsManager->store($user->getUID(), $this->getCredentialsIdentifier($mountId), [ 'user' => $options['user'], // explicitly copy the fields we want instead of just passing the entire $options array 'password' => $options['password'] // this way we prevent users from being able to modify any other field ]); diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index ce37d556129..404aa4e12de 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -530,7 +530,7 @@ class SMB extends Common implements INotifyStorage { } } - public function touch($path, $time = null) { + public function touch($path, $mtime = null) { try { if (!$this->file_exists($path)) { $fh = $this->share->write($this->buildPath($path)); diff --git a/apps/files_external/lib/Migration/DummyUserSession.php b/apps/files_external/lib/Migration/DummyUserSession.php index 10ab505cd3b..51c7f2b60e4 100644 --- a/apps/files_external/lib/Migration/DummyUserSession.php +++ b/apps/files_external/lib/Migration/DummyUserSession.php @@ -34,7 +34,7 @@ class DummyUserSession implements IUserSession { */ private $user; - public function login($user, $password) { + public function login($uid, $password) { } public function logout() { diff --git a/apps/files_sharing/lib/MountProvider.php b/apps/files_sharing/lib/MountProvider.php index bbb9da3a775..402061c7905 100644 --- a/apps/files_sharing/lib/MountProvider.php +++ b/apps/files_sharing/lib/MountProvider.php @@ -71,10 +71,10 @@ class MountProvider implements IMountProvider { * Get all mountpoints applicable for the user and check for shares where we need to update the etags * * @param \OCP\IUser $user - * @param \OCP\Files\Storage\IStorageFactory $storageFactory + * @param \OCP\Files\Storage\IStorageFactory $loader * @return \OCP\Files\Mount\IMountPoint[] */ - public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) { + public function getMountsForUser(IUser $user, IStorageFactory $loader) { $shares = $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_USER, null, -1); $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_GROUP, null, -1)); $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_CIRCLE, null, -1)); @@ -120,7 +120,7 @@ class MountProvider implements IMountProvider { 'ownerView' => $ownerViews[$owner], 'sharingDisabledForUser' => $sharingDisabledForUser ], - $storageFactory, + $loader, $view, $foldersExistCache ); diff --git a/apps/files_sharing/lib/ShareBackend/File.php b/apps/files_sharing/lib/ShareBackend/File.php index cdda89cbc63..53810d59eba 100644 --- a/apps/files_sharing/lib/ShareBackend/File.php +++ b/apps/files_sharing/lib/ShareBackend/File.php @@ -89,14 +89,15 @@ class File implements \OCP\Share_Backend_File_Dependent { /** * create unique target - * @param string $filePath + * + * @param string $itemSource * @param string $shareWith * @param array $exclude (optional) * @return string */ - public function generateTarget($filePath, $shareWith, $exclude = null) { + public function generateTarget($itemSource, $shareWith, $exclude = null) { $shareFolder = \OCA\Files_Sharing\Helper::getShareFolder(); - $target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($filePath)); + $target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($itemSource)); // for group shares we return the target right away if ($shareWith === false) { diff --git a/apps/user_ldap/lib/Group_Proxy.php b/apps/user_ldap/lib/Group_Proxy.php index c6a2c7fb6fb..4b17c020d59 100644 --- a/apps/user_ldap/lib/Group_Proxy.php +++ b/apps/user_ldap/lib/Group_Proxy.php @@ -53,12 +53,13 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet /** * Tries the backends one after the other until a positive result is returned from the specified method * - * @param string $gid the gid connected to the request + * @param string $id the gid connected to the request * @param string $method the method of the group backend that shall be called * @param array $parameters an array of parameters to be passed - * @return mixed, the result of the method or false + * @return mixed the result of the method or false */ - protected function walkBackends($gid, $method, $parameters) { + protected function walkBackends($id, $method, $parameters) { + $gid = $id; $cacheKey = $this->getGroupCacheKey($gid); foreach ($this->backends as $configPrefix => $backend) { if ($result = call_user_func_array([$backend, $method], $parameters)) { @@ -74,13 +75,14 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet /** * Asks the backend connected to the server that supposely takes care of the gid from the request. * - * @param string $gid the gid connected to the request + * @param string $id the gid connected to the request * @param string $method the method of the group backend that shall be called * @param array $parameters an array of parameters to be passed * @param mixed $passOnWhen the result matches this variable - * @return mixed, the result of the method or false + * @return mixed the result of the method or false */ - protected function callOnLastSeenOn($gid, $method, $parameters, $passOnWhen) { + protected function callOnLastSeenOn($id, $method, $parameters, $passOnWhen) { + $gid = $id; $cacheKey = $this->getGroupCacheKey($gid); $prefix = $this->getFromCache($cacheKey); //in case the uid has been found in the past, try this stored connection first diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php index a81e4668347..6445af89112 100644 --- a/apps/user_ldap/lib/User_Proxy.php +++ b/apps/user_ldap/lib/User_Proxy.php @@ -73,12 +73,13 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface, /** * Tries the backends one after the other until a positive result is returned from the specified method * - * @param string $uid the uid connected to the request + * @param string $id the uid connected to the request * @param string $method the method of the user backend that shall be called * @param array $parameters an array of parameters to be passed * @return mixed the result of the method or false */ - protected function walkBackends($uid, $method, $parameters) { + protected function walkBackends($id, $method, $parameters) { + $uid = $id; $cacheKey = $this->getUserCacheKey($uid); foreach ($this->backends as $configPrefix => $backend) { $instance = $backend; @@ -99,13 +100,14 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface, /** * Asks the backend connected to the server that supposely takes care of the uid from the request. * - * @param string $uid the uid connected to the request + * @param string $id the uid connected to the request * @param string $method the method of the user backend that shall be called * @param array $parameters an array of parameters to be passed * @param mixed $passOnWhen the result matches this variable * @return mixed the result of the method or false */ - protected function callOnLastSeenOn($uid, $method, $parameters, $passOnWhen) { + protected function callOnLastSeenOn($id, $method, $parameters, $passOnWhen) { + $uid = $id; $cacheKey = $this->getUserCacheKey($uid); $prefix = $this->getFromCache($cacheKey); //in case the uid has been found in the past, try this stored connection first |