diff --git a/apps/files/lib/BackgroundJob/CleanupFileLocks.php b/apps/files/lib/BackgroundJob/CleanupFileLocks.php index f4898b2487..df4542386e 100644 --- a/apps/files/lib/BackgroundJob/CleanupFileLocks.php +++ b/apps/files/lib/BackgroundJob/CleanupFileLocks.php @@ -48,6 +48,7 @@ class CleanupFileLocks extends TimedJob { * Makes the background job do its work * * @param array $argument unused argument + * @throws \Exception */ public function run($argument) { $lockingProvider = \OC::$server->getLockingProvider(); diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index f9e4bcb573..38c378d480 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -242,6 +242,7 @@ class ApiController extends Controller { * @param string $mode * @param string $direction * @return Response + * @throws \OCP\PreConditionNotMetException */ public function updateFileSorting($mode, $direction) { $allowedMode = ['name', 'size', 'mtime']; @@ -262,6 +263,8 @@ class ApiController extends Controller { * @NoAdminRequired * * @param bool $show + * @return Response + * @throws \OCP\PreConditionNotMetException */ public function showHiddenFiles($show) { $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', (int)$show); @@ -274,6 +277,8 @@ class ApiController extends Controller { * @NoAdminRequired * * @param bool $show + * @return Response + * @throws \OCP\PreConditionNotMetException */ public function showGridView($show) { $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_grid', (int)$show); @@ -295,10 +300,11 @@ class ApiController extends Controller { * * @NoAdminRequired * - * @param bool $show - * @param bool $key the key of the folder + * @param int $show + * @param string $key the key of the folder * * @return Response + * @throws \OCP\PreConditionNotMetException */ public function toggleShowFolder(int $show, string $key) { // ensure the edited key exists diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 49f1818780..1bcc3e4c7f 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -136,6 +136,7 @@ class ViewController extends Controller { * * @param string $fileid * @return TemplateResponse|RedirectResponse + * @throws NotFoundException */ public function showFile(string $fileid = null): Response { // This is the entry point from the `/f/{fileid}` URL which is hardcoded in the server. @@ -153,7 +154,9 @@ class ViewController extends Controller { * @param string $dir * @param string $view * @param string $fileid + * @param bool $fileNotFound * @return TemplateResponse|RedirectResponse + * @throws NotFoundException */ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false) { if ($fileid !== null) { diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index 5db9dddf8f..406dad05eb 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -454,9 +454,11 @@ class Access extends LDAPUtility { /** * returns the internal Nextcloud name for the given LDAP DN of the group, false on DN outside of search DN or failure + * * @param string $fdn the dn of the group object * @param string $ldapName optional, the display name of the object * @return string|false with the name to use in Nextcloud, false on DN outside of search DN + * @throws \Exception */ public function dn2groupname($fdn, $ldapName = null) { //To avoid bypassing the base DN settings under certain circumstances @@ -511,9 +513,11 @@ class Access extends LDAPUtility { /** * returns the internal Nextcloud name for the given LDAP DN of the user, false on DN outside of search DN or failure + * * @param string $dn the dn of the user object * @param string $ldapName optional, the display name of the object * @return string|false with with the name to use in Nextcloud + * @throws \Exception */ public function dn2username($fdn, $ldapName = null) { //To avoid bypassing the base DN settings under certain circumstances @@ -654,10 +658,12 @@ class Access extends LDAPUtility { /** * gives back the user names as they are used ownClod internally + * * @param array $ldapUsers as returned by fetchList() * @return array an array with the user names to use in Nextcloud * * gives back the user names as they are used ownClod internally + * @throws \Exception */ public function nextcloudUserNames($ldapUsers) { return $this->ldap2NextcloudNames($ldapUsers, true); @@ -665,10 +671,12 @@ class Access extends LDAPUtility { /** * gives back the group names as they are used ownClod internally + * * @param array $ldapGroups as returned by fetchList() * @return array an array with the group names to use in Nextcloud * * gives back the group names as they are used ownClod internally + * @throws \Exception */ public function nextcloudGroupNames($ldapGroups) { return $this->ldap2NextcloudNames($ldapGroups, false); @@ -753,9 +761,11 @@ class Access extends LDAPUtility { /** * caches the user display name + * * @param string $ocName the internal Nextcloud username * @param string $displayName the display name * @param string $displayName2 the second display name + * @throws \Exception */ public function cacheUserDisplayName($ocName, $displayName, $displayName2 = '') { $user = $this->userManager->get($ocName); @@ -885,6 +895,7 @@ class Access extends LDAPUtility { * @param int $offset * @param bool $forceApplyAttributes * @return array + * @throws \Exception */ public function fetchListOfUsers($filter, $attr, $limit = null, $offset = null, $forceApplyAttributes = false) { $ldapRecords = $this->searchUsers($filter, $attr, $limit, $offset); @@ -973,6 +984,7 @@ class Access extends LDAPUtility { /** * executes an LDAP search, optimized for Users + * * @param string $filter the LDAP filter for the search * @param string|string[] $attr optional, when a certain attribute shall be filtered out * @param integer $limit @@ -980,6 +992,7 @@ class Access extends LDAPUtility { * @return array with the search result * * Executes an LDAP search + * @throws ServerNotAvailableException */ public function searchUsers($filter, $attr = null, $limit = null, $offset = null) { $result = []; @@ -995,6 +1008,7 @@ class Access extends LDAPUtility { * @param int $limit * @param int $offset * @return false|int + * @throws ServerNotAvailableException */ public function countUsers($filter, $attr = array('dn'), $limit = null, $offset = null) { $result = false; @@ -1007,6 +1021,7 @@ class Access extends LDAPUtility { /** * executes an LDAP search, optimized for Groups + * * @param string $filter the LDAP filter for the search * @param string|string[] $attr optional, when a certain attribute shall be filtered out * @param integer $limit @@ -1014,6 +1029,7 @@ class Access extends LDAPUtility { * @return array with the search result * * Executes an LDAP search + * @throws ServerNotAvailableException */ public function searchGroups($filter, $attr = null, $limit = null, $offset = null) { $result = []; @@ -1025,11 +1041,13 @@ class Access extends LDAPUtility { /** * returns the number of available groups + * * @param string $filter the LDAP search filter * @param string[] $attr optional * @param int|null $limit * @param int|null $offset * @return int|bool + * @throws ServerNotAvailableException */ public function countGroups($filter, $attr = array('dn'), $limit = null, $offset = null) { $result = false; @@ -1046,6 +1064,7 @@ class Access extends LDAPUtility { * @param int|null $limit * @param int|null $offset * @return int|bool + * @throws ServerNotAvailableException */ public function countObjects($limit = null, $offset = null) { $result = false; @@ -1149,6 +1168,7 @@ class Access extends LDAPUtility { /** * processes an LDAP paged search operation + * * @param array $sr the array containing the LDAP search resources * @param string $filter the LDAP filter for the search * @param array $base an array containing the LDAP subtree(s) that shall be searched @@ -1159,6 +1179,7 @@ class Access extends LDAPUtility { * @param bool $skipHandling required for paged search when cookies to * prior results need to be gained * @return bool cookie validity, true if we have more pages, false otherwise. + * @throws ServerNotAvailableException */ private function processPagedSearchStatus($sr, $filter, $base, $iFoundItems, $limit, $offset, $pagedSearchOK, $skipHandling) { $cookie = null; @@ -1251,6 +1272,7 @@ class Access extends LDAPUtility { /** * @param array $searchResults * @return int + * @throws ServerNotAvailableException */ private function countEntriesInSearchResults($searchResults) { $counter = 0; @@ -1656,6 +1678,7 @@ class Access extends LDAPUtility { * @param bool $force the detection should be run, even if it is not set to auto * @param array|null $ldapRecord * @return bool true on success, false otherwise + * @throws ServerNotAvailableException */ private function detectUuidAttribute($dn, $isUser = true, $force = false, array $ldapRecord = null) { if($isUser) { @@ -1711,6 +1734,7 @@ class Access extends LDAPUtility { * @param bool $isUser * @param null $ldapRecord * @return bool|string + * @throws ServerNotAvailableException */ public function getUUID($dn, $isUser = true, $ldapRecord = null) { if($isUser) { @@ -1816,8 +1840,10 @@ class Access extends LDAPUtility { /** * gets a SID of the domain of the given dn + * * @param string $dn * @return string|bool + * @throws ServerNotAvailableException */ public function getSID($dn) { $domainDN = $this->getDomainDNFromDN($dn); @@ -1986,12 +2012,14 @@ class Access extends LDAPUtility { /** * Prepares a paged search, if possible + * * @param string $filter the LDAP filter for the search * @param string[] $bases an array containing the LDAP subtree(s) that shall be searched * @param string[] $attr optional, when a certain attribute shall be filtered outside * @param int $limit * @param int $offset * @return bool|true + * @throws ServerNotAvailableException */ private function initPagedSearch($filter, $bases, $attr, $limit, $offset) { $pagedSearchOK = false;