diff --git a/lib/activities/CoursewareContext.php b/lib/activities/CoursewareContext.php index a7bd83b732803597d8b31372bdb5b6161e01e46e..817deb49d36c39d3236deca694da7258d5345059 100755 --- a/lib/activities/CoursewareContext.php +++ b/lib/activities/CoursewareContext.php @@ -29,28 +29,32 @@ class CoursewareContext extends Context public function getContextType() { - if($this->context == 'user') { + if ($this->context === 'user') { return \Context::USER; } - if ($this->content == 'course') { + if ($this->context === 'course') { return \Context::COURSE; } + + throw new UnexpectedValueException("Unknown context type {$this->context}"); } public function getContextFullname($format = 'default') { - if($this->context == 'user') { + if ($this->context === 'user') { $user = \User::find($this->range_id); return $user->getFullname($format); } - if($this->context == 'course') { + if ($this->context === 'course') { $course = \Course::find($this->range_id); return $course->getFullname($format); } + + throw new UnexpectedValueException("Unknown context {$this->context}"); } -} \ No newline at end of file +} diff --git a/lib/classes/Config.class.php b/lib/classes/Config.class.php index a36bde9874e8d515304a14981fd1a45c08a9c297..f977bb9d5c365bf504172454fa1e4894cea3eb1b 100644 --- a/lib/classes/Config.class.php +++ b/lib/classes/Config.class.php @@ -123,7 +123,7 @@ class Config implements ArrayAccess, Countable, IteratorAggregate * for compatibility reasons an existing variable in global * namespace with the same name is also returned * @param string $field - * @return Ambigous + * @return mixed */ public function getValue($field) { @@ -133,13 +133,15 @@ class Config implements ArrayAccess, Countable, IteratorAggregate if (isset($GLOBALS[$field]) && !isset($_REQUEST[$field])) { return $GLOBALS[$field]; } + + return null; } /** * set config entry to given value, but don't store it * in database * @param string $field - * @param unknown_type $value + * @param mixed $value * @return */ public function setValue($field, $value) @@ -324,7 +326,7 @@ class Config implements ArrayAccess, Countable, IteratorAggregate * @param string name of entry * @param array data to insert as assoc array * @throws InvalidArgumentException - * @return Ambigous <NULL, ConfigEntry> + * @return null|ConfigEntry */ public function create($field, $data = []) { diff --git a/lib/classes/Context.php b/lib/classes/Context.php index f43bd38135b6f7f620177e7dec4b2dada0583d3d..09b3a1bb4233499b1f67385ccc600757b5289c05 100644 --- a/lib/classes/Context.php +++ b/lib/classes/Context.php @@ -131,12 +131,12 @@ class Context switch (self::getType()) { case self::COURSE: return 'sem'; - break; case self::INSTITUTE: return 'inst'; - break; } + + throw new UnexpectedValueException('Invalid context type'); } /** @@ -151,9 +151,13 @@ class Context { if (self::isCourse()) { return self::get()->status; - } else if (Context::isInstitute()) { + } + + if (self::isInstitute()) { return self::get()->type; } + + throw new UnexpectedValueException('Invalid context type'); } /** @@ -172,6 +176,8 @@ class Context case self::INSTITUTE: return _('Einrichtung'); } + + throw new UnexpectedValueException('Invalid context type'); } /** diff --git a/lib/classes/CronJob.class.php b/lib/classes/CronJob.class.php index db8a033312413911d8c3e95211461d737832d626..1e7fb4121238e0ba30c3ec42823c475465196f88 100644 --- a/lib/classes/CronJob.class.php +++ b/lib/classes/CronJob.class.php @@ -126,10 +126,6 @@ abstract class CronJob /** * Unregisters a previously registered task. - * - * @param String $task_id Id of the task to be unregistered - * @return CronjobScheduler to allow chaining - * @throws InvalidArgumentException when no task with the given id exists */ public static function unregister() { diff --git a/lib/classes/ForumEntry.php b/lib/classes/ForumEntry.php index aeab01705c2f94a9cc921346530fea64911f0117..95721d75c2f74251f946c24038bf1a2f4d3a95fc 100644 --- a/lib/classes/ForumEntry.php +++ b/lib/classes/ForumEntry.php @@ -605,8 +605,6 @@ class ForumEntry implements PrivacyObject $postings = ForumEntry::getLastPostings($postings); return ['list' => $postings, 'count' => $list['count']]; - break; - case 'list': $constraint = ForumEntry::getConstraints($parent_id); @@ -632,11 +630,9 @@ class ForumEntry implements PrivacyObject $postings = ForumEntry::getLastPostings($postings); return ['list' => $postings, 'count' => $count]; - break; case 'postings': return ForumEntry::getEntries($parent_id, ForumEntry::WITH_CHILDS, '', 'ASC', $start); - break; case 'newest': $constraint = ForumEntry::getConstraints($parent_id); @@ -678,16 +674,13 @@ class ForumEntry implements PrivacyObject // return results return ['list' => $postings, 'count' => $stmt_count->fetchColumn()]; - break; case 'latest': return ForumEntry::getEntries($parent_id, ForumEntry::WITH_CHILDS, '', 'DESC', $start); - break; case 'favorites': $add = "AND ou.topic_id IS NOT NULL"; return ForumEntry::getEntries($parent_id, ForumEntry::WITH_CHILDS, $add, 'DESC', $start); - break; case 'dump': $constraint = ForumEntry::getConstraints($parent_id); @@ -703,7 +696,6 @@ class ForumEntry implements PrivacyObject $stmt->execute([$seminar_id, $constraint['lft'], $constraint['rgt']]); return ForumEntry::parseEntries($stmt->fetchAll(PDO::FETCH_ASSOC)); - break; case 'flat': $constraint = ForumEntry::getConstraints($parent_id); @@ -744,7 +736,6 @@ class ForumEntry implements PrivacyObject } return ['list' => $posting_list, 'count' => $count]; - break; case 'depth_to_large': $constraint = ForumEntry::getConstraints($parent_id); @@ -757,8 +748,9 @@ class ForumEntry implements PrivacyObject $count = DBManager::get()->query("SELECT FOUND_ROWS()")->fetchColumn(); return ['list' => $stmt->fetchAll(PDO::FETCH_ASSOC), 'count' => $count]; - break; } + + throw new InvalidArgumentException("Invalid type {$type}"); } /** diff --git a/lib/classes/MultiDimArrayObject.class.php b/lib/classes/MultiDimArrayObject.class.php index fb218febb63bf5328c13d5fde39ea56ccb853674..bcbdee49fe54354696f86c1f6e585259b7dd8112 100644 --- a/lib/classes/MultiDimArrayObject.class.php +++ b/lib/classes/MultiDimArrayObject.class.php @@ -36,7 +36,7 @@ class MultiDimArrayObject extends StudipArrayObject * Exchange the array for another one. * * @param array|ArrayObject $data - * @return + * @return array */ public function exchangeArray($data) { @@ -51,8 +51,11 @@ class MultiDimArrayObject extends StudipArrayObject $data = (array) $data; } + $storage = $this->storage; + $this->storage = $this->recursiveArrayToArrayObjects($data); + return $storage; } /** @@ -124,4 +127,3 @@ class MultiDimArrayObject extends StudipArrayObject return $data; } } - diff --git a/lib/classes/MvvQuickSearch.php b/lib/classes/MvvQuickSearch.php index bb49056983b7d3cd100a191d2372258ebc1b5ae4..2f55646bebc7583f4087667e78afbb516833a06e 100644 --- a/lib/classes/MvvQuickSearch.php +++ b/lib/classes/MvvQuickSearch.php @@ -45,7 +45,7 @@ class MvvQuickSearch extends SQLSearch if (!$id) { return $this->zusatz; } - parent::getAvatarImageTag($id, $size = Avatar::SMALL, $options); + return parent::getAvatarImageTag($id, $size = Avatar::SMALL, $options); } public function setQsName($qs_name) diff --git a/lib/classes/RangeConfig.class.php b/lib/classes/RangeConfig.class.php index a1e1bb9b300bdf795695ca7f680039358b6059a1..17375d15e70c03ed0fa49a77da0edf7e99bb7e60 100644 --- a/lib/classes/RangeConfig.class.php +++ b/lib/classes/RangeConfig.class.php @@ -194,7 +194,7 @@ class RangeConfig extends Config $data['range'] = static::RANGE_TYPE; } - parent::create($field, $data); + return parent::create($field, $data); } /** diff --git a/lib/classes/SemBrowse.class.php b/lib/classes/SemBrowse.class.php index ef6136c5df04dbdc822807a10ddfaf42db4c98b6..6e32f775ae7c23f21a260563aed27b49942969b8 100644 --- a/lib/classes/SemBrowse.class.php +++ b/lib/classes/SemBrowse.class.php @@ -1147,9 +1147,9 @@ class SemBrowse { * * @param string $target * @param string $option_name - * @return \Navigation + * @return Navigation|null */ - public static function getSearchOptionNavigation($target, $option_name = null) + public static function getSearchOptionNavigation($target, $option_name = null): ?Navigation { // return first visible search option if (is_null($option_name)) { @@ -1227,6 +1227,8 @@ class SemBrowse { 'option' => $option_name ], true)); } + + return null; } /** diff --git a/lib/classes/Seminar.class.php b/lib/classes/Seminar.class.php index 00108aa35a2fbeb73c0969b916b499bc3e0a0605..7f8886ca42b1e629d844faa968ecb03fe593e501 100644 --- a/lib/classes/Seminar.class.php +++ b/lib/classes/Seminar.class.php @@ -2344,14 +2344,15 @@ class Seminar * returns StudipModule object for given slot, null when deactivated or not available * * @param string $slot - * @return StudipModule + * @return StudipModule|null */ - public function getSlotModule($slot) + public function getSlotModule($slot): ?StudipModule { $module = 'Core' . ucfirst($slot); if ($this->course->isToolActive($module)) { return PluginEngine::getPlugin($module); } + return null; } /** diff --git a/lib/classes/StudipCache.class.php b/lib/classes/StudipCache.class.php index ac308f27014cae23f203b380cfbd83a0b61d5b31..79e80e36f5f2008d26b7b8ec55efa19157b9f477 100644 --- a/lib/classes/StudipCache.class.php +++ b/lib/classes/StudipCache.class.php @@ -54,7 +54,7 @@ interface StudipCache * * @param string $name the item's key. * @param mixed $content the item's content (will be serialized if necessary). - * @param int $expired the item's expiry time in seconds. Optional, defaults to 12h. + * @param int $expires the item's expiry time in seconds. Optional, defaults to 12h. * * @return bool returns TRUE on success or FALSE on failure. */ diff --git a/lib/classes/StudipLock.class.php b/lib/classes/StudipLock.class.php index 8152d948eb509052d0f556a3432a99e14aea73cf..601db8b10acdf7726badf45dfa6171f1cce7d041 100644 --- a/lib/classes/StudipLock.class.php +++ b/lib/classes/StudipLock.class.php @@ -82,6 +82,7 @@ class StudipLock if (self::$current) { return DBManager::get()->fetchColumn("SELECT RELEASE_LOCK(?)", [self::lockname(self::$current)]); } + return 0; } /** diff --git a/lib/classes/StudipMemoryCache.class.php b/lib/classes/StudipMemoryCache.class.php index 3946b345477ac93871ac0fa70a8f2e4a36171063..395475d415c95de835a20abbe34baecf075a78d7 100644 --- a/lib/classes/StudipMemoryCache.class.php +++ b/lib/classes/StudipMemoryCache.class.php @@ -57,11 +57,13 @@ class StudipMemoryCache implements StudipCache * @returns mixed returns TRUE on success or FALSE on failure. * */ - public function write($name, $content, $expire = self::DEFAULT_EXPIRATION) + public function write($name, $content, $expires = self::DEFAULT_EXPIRATION) { $this->memory_cache[$name] = [ 'expires' => time() + $expire, 'data' => $content, ]; + + return true; } } diff --git a/lib/classes/StudipPDO.class.php b/lib/classes/StudipPDO.class.php index 8e67c342931b24b9a0f0e9ffed7345a0e6841b9b..a758b1028df9a303826f227f4f8b07640aca5b4c 100644 --- a/lib/classes/StudipPDO.class.php +++ b/lib/classes/StudipPDO.class.php @@ -230,6 +230,7 @@ class StudipPDO extends PDO if ($ok === true) { return $st->rowCount(); } + return 0; } /** diff --git a/lib/classes/StudygroupModel.php b/lib/classes/StudygroupModel.php index be4575e9cc5852f1e45200eacc9fef0925371dc1..76899f107a31a4c55f36bbe45dc984c1202130c1 100644 --- a/lib/classes/StudygroupModel.php +++ b/lib/classes/StudygroupModel.php @@ -482,40 +482,6 @@ class StudygroupModel return (bool) $stmt->fetchColumn(); } - /** - * callback function - used to compare sequences of studygroup statuses - * - * @param array status a - * @param array status b - * @return int ordering - */ - public static function compare_status($a, $b) - { - if ($a['status'] === $b['status']) { - return strnatcmp($a['fullname'], $b['fullname']); - } - - if ($a['status'] === 'dozent') { - if ($b['status'] === 'tutor') { - return -1; - } elseif ($b['status'] === 'autor') { - return -1; - } - } elseif ($a['status'] === 'tutor') { - if ($b['status'] === 'dozent') { - return 1; - } elseif ($b['status'] === 'autor') { - return -1; - } - } elseif ($a['status'] === 'autor') { - if ($b['status'] === 'tutor') { - return 1; - } elseif ($b['status'] === 'dozent') { - return 1; - } - } - } - /** * Checks for a given seminar_id whether a course is a studygroup * diff --git a/lib/classes/TwoFactorAuth.php b/lib/classes/TwoFactorAuth.php index ef7e6685aa8705d154420df73934e02e8e989ea4..7fd9f45edb9a6b57b49e290d85f3265c4a09169c 100644 --- a/lib/classes/TwoFactorAuth.php +++ b/lib/classes/TwoFactorAuth.php @@ -171,9 +171,8 @@ final class TwoFactorAuth * @param string $text Text to display to the user * @param array $data Optional additional data to pass to the * confirmation screen (for internal use) - * @return bool */ - public function confirm($action, $text, array $data = []) + public function confirm($action, $text, array $data = []): void { if (isset($_SESSION[self::SESSION_CONFIRMATIONS]) && is_array($_SESSION[self::SESSION_CONFIRMATIONS]) @@ -183,12 +182,11 @@ final class TwoFactorAuth $_SESSION[self::SESSION_CONFIRMATIONS], [$action] ); - return true; + } else { + $this->showConfirmationScreen($text, $data + [ + 'confirm' => $action, + ]); } - - $this->showConfirmationScreen($text, $data + [ - 'confirm' => $action, - ]); } /** diff --git a/lib/classes/Visibility.php b/lib/classes/Visibility.php index c4499492089c726d0c1dd71b7145a06ea4d12542..ce191d2ab8f4d8a81b917ea4fa029dc752fe8b80 100644 --- a/lib/classes/Visibility.php +++ b/lib/classes/Visibility.php @@ -147,7 +147,7 @@ class Visibility * (under the usage of a userid) therefore all identifier set for one user * MUST be unique. * - * @param int|string $parent Determines the parent of the visibility to add. + * @param int|string $parent_identifier Determines the parent of the visibility to add. * Use the direct visibilityid of the parent visibility or the identifier. * If the visibility should be created on the top level the value has to be * 0. Plugins creating a privacysetting will automaticly be added to the @@ -159,9 +159,6 @@ class Visibility * 0 - The setting is only a header without any options * 1 (Default) - Normal setting * - * @param string $user Userid of the user that should be added the visibility. - * Default: The current logged on user - * * @param int $default int representation of the visibility that should be * set. Use with caution since the API provides the easy change of the * visibility int representation @@ -170,8 +167,6 @@ class Visibility * Important: If addPrivacySetting is called in a file of a plugin there is * no need to set the pluginid manually, because the API will normally find * it - * - * @return int the created visibilityid */ public static function addPrivacySettingForAll($name, $identifier = "", $parent_identifier = 0, $category = 1, $default = null, $pluginid = null) { diff --git a/lib/classes/admission/CourseSet.class.php b/lib/classes/admission/CourseSet.class.php index 3ea4997183cd8ad504a1ac35041e755cab487701..e79f4c08c941b635e719c57c1e7b6d0602fa6c8e 100644 --- a/lib/classes/admission/CourseSet.class.php +++ b/lib/classes/admission/CourseSet.class.php @@ -223,8 +223,6 @@ class CourseSet /** * Starts the seat distribution algorithm. - * - * @return CourseSet */ public function distributeSeats() { if ($this->algorithm) { diff --git a/lib/classes/auth_plugins/StudipAuthAbstract.class.php b/lib/classes/auth_plugins/StudipAuthAbstract.class.php index 008ed870967af72fe79df431751645fc1c33b723..a21d1513aa08c1cfc15195d50b7bb691a8879d31 100644 --- a/lib/classes/auth_plugins/StudipAuthAbstract.class.php +++ b/lib/classes/auth_plugins/StudipAuthAbstract.class.php @@ -361,9 +361,7 @@ class StudipAuthAbstract * place special treatment of new users here * * @access private - * @param - * User the user object - * @return bool + * @param User $user the user object */ function doNewUserInit($user) { diff --git a/lib/classes/calendar/SingleCalendar.php b/lib/classes/calendar/SingleCalendar.php index 60cef5ece8631781b02399acb9b54af74863f21a..da2987f246ceeca5220847c65036725c0b675c3d 100644 --- a/lib/classes/calendar/SingleCalendar.php +++ b/lib/classes/calendar/SingleCalendar.php @@ -131,7 +131,7 @@ class SingleCalendar if (!$attendee_ids) { $attendee_ids = [$GLOBALS['user']->id]; } - if (count($attendee_ids) == 1) { + if (count($attendee_ids) === 1) { if (!$this->havePermission(Calendar::PERMISSION_WRITABLE)) { return false; } @@ -142,19 +142,21 @@ class SingleCalendar $this->sendStoreMessage($event, $is_new); } return $stored; - } else { - if (in_array($this->getRangeId(), $attendee_ids)) { - // set default status if the organizer is an attendee... - $event->group_status = CalendarEvent::PARTSTAT_TENTATIVE; - } - if ($event->isNew()) { - return $this->storeAttendeeEvents($event, $attendee_ids); - } else { - if ($event->havePermission(Event::PERMISSION_WRITABLE)) { - return $this->storeAttendeeEvents($event, $attendee_ids); - } - } } + + if (in_array($this->getRangeId(), $attendee_ids)) { + // set default status if the organizer is an attendee... + $event->group_status = CalendarEvent::PARTSTAT_TENTATIVE; + } + if ($event->isNew()) { + return $this->storeAttendeeEvents($event, $attendee_ids); + } + + if (!$event->havePermission(Event::PERMISSION_WRITABLE)) { + return false; + } + + return $this->storeAttendeeEvents($event, $attendee_ids); } /** @@ -955,6 +957,8 @@ class SingleCalendar $events_created[implode('', (array) $event->getId()) . $start] = $new_event; } } + + return true; } /** diff --git a/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php b/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php index 595c5fe5202f2e78807bec740a16dcb958f236fb..780f837fd1fe42bd28bd6564a852825177a39489 100644 --- a/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php +++ b/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php @@ -39,13 +39,16 @@ class AdvancedBasicDataWizardStep extends BasicDataWizardStep $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps'); $template = $factory->open('advancedbasicdata/index'); - if ($template = $this->setupTemplateAttributes($template, $values, $stepnumber, $temp_id)) { - $values = $this->makeI18N($values[__CLASS__], ['name', 'description', 'subtitle', 'kind']); + $template = $this->setupTemplateAttributes($template, $values, $stepnumber, $temp_id); + if (!$template) { + return ''; + } - $template->set_attribute('values', array_merge($template->values, $values)); + $values = $this->makeI18N($values[__CLASS__], ['name', 'description', 'subtitle', 'kind']); - return $template->render(); - } + $template->set_attribute('values', array_merge($template->values, $values)); + + return $template->render(); } /** diff --git a/lib/classes/coursewizardsteps/BasicDataWizardStep.php b/lib/classes/coursewizardsteps/BasicDataWizardStep.php index 14793ea319e132a12f5639051d394a953652951c..b3fb7fe34d3e1600fd404de33422f81390069653 100644 --- a/lib/classes/coursewizardsteps/BasicDataWizardStep.php +++ b/lib/classes/coursewizardsteps/BasicDataWizardStep.php @@ -38,6 +38,8 @@ class BasicDataWizardStep implements CourseWizardStep if ($this->setupTemplateAttributes($tpl, $values, $stepnumber, $temp_id)) { return $tpl->render(); } + + return ''; } protected function setupTemplateAttributes($tpl, $values, $stepnumber, $temp_id) diff --git a/lib/classes/globalsearch/GlobalSearchCalendar.php b/lib/classes/globalsearch/GlobalSearchCalendar.php index edcb018146b9fb46df4c092ad9d945d815e9356d..8682226744b2b8f184d37a1e0c88dda060022d0c 100644 --- a/lib/classes/globalsearch/GlobalSearchCalendar.php +++ b/lib/classes/globalsearch/GlobalSearchCalendar.php @@ -46,18 +46,21 @@ class GlobalSearchCalendar extends GlobalSearchModule public static function getSQL($search, $filter, $limit) { $time = strtotime($search); + + if ($time === false) { + return ''; + } + $endtime = $time + 24 * 60 * 60; $user_id = DBManager::get()->quote($GLOBALS['user']->id); - if ($time) { - return "SELECT SQL_CALC_FOUND_ROWS `date`, `end_time`, `seminar_id` - FROM `termine` - JOIN `seminar_user` ON (`range_id` = `seminar_id`) - WHERE `user_id` = {$user_id} - AND `date` BETWEEN {$time} AND {$endtime} - ORDER BY `date` - LIMIT " . $limit; - } + return "SELECT SQL_CALC_FOUND_ROWS `date`, `end_time`, `seminar_id` + FROM `termine` + JOIN `seminar_user` ON (`range_id` = `seminar_id`) + WHERE `user_id` = {$user_id} + AND `date` BETWEEN {$time} AND {$endtime} + ORDER BY `date` + LIMIT " . $limit; } /** diff --git a/lib/classes/globalsearch/GlobalSearchForum.php b/lib/classes/globalsearch/GlobalSearchForum.php index 37efd26930bd8b32692103d6ec7bab432d7e61be..8c152c888f290319b3d3556d7096e9f713bf8bbd 100644 --- a/lib/classes/globalsearch/GlobalSearchForum.php +++ b/lib/classes/globalsearch/GlobalSearchForum.php @@ -166,6 +166,8 @@ class GlobalSearchForum extends GlobalSearchModule implements GlobalSearchFullte return $result; } + + return []; } /** diff --git a/lib/classes/searchtypes/SQLSearch.class.php b/lib/classes/searchtypes/SQLSearch.class.php index 7aac0a3df883706e7c3c9443734f69d06b484651..f69a65e4d28e98c0ba5410cf09f3dbe9b6d7040b 100644 --- a/lib/classes/searchtypes/SQLSearch.class.php +++ b/lib/classes/searchtypes/SQLSearch.class.php @@ -86,7 +86,6 @@ class SQLSearch extends SearchType * returns an adress of the avatar of the searched item (if avatar enabled) * * @param string $id id of the item which can be username, user_id, Seminar_id or Institut_id - * @param string $size enum(NORMAL, SMALL, MEDIUM): size of the avatar-image * * @return string adress of an image */ @@ -102,6 +101,8 @@ class SQLSearch extends SearchType return CourseAvatar::getAvatar($id)->getURL(Avatar::SMALL); case "Institut_id": return InstituteAvatar::getAvatar($id)->getURL(Avatar::SMALL); + default: + return ''; } } @@ -109,7 +110,8 @@ class SQLSearch extends SearchType * returns an html tag of the image of the searched item (if avatar enabled) * * @param string $id id of the item which can be username, user_id, Seminar_id or Institut_id - * @param constant $size enum(NORMAL, SMALL, MEDIUM): size of the avatar + * @param string $size enum(NORMAL, SMALL, MEDIUM): size of the avatar + * @param array $options * * @return string like "<img src="...avatar.jpg" ... >" */ @@ -125,6 +127,8 @@ class SQLSearch extends SearchType return CourseAvatar::getAvatar($id)->getImageTag($size, $options); case "Institut_id": return InstituteAvatar::getAvatar($id)->getImageTag($size, $options); + default: + return ''; } } diff --git a/lib/classes/searchtypes/StandardSearch.class.php b/lib/classes/searchtypes/StandardSearch.class.php index 2f1be430cde6d6107e5edfe3e8d099546793d694..62642fca5f7e7db6548a7cfd5ab59e256c3020c2 100644 --- a/lib/classes/searchtypes/StandardSearch.class.php +++ b/lib/classes/searchtypes/StandardSearch.class.php @@ -78,6 +78,8 @@ class StandardSearch extends SQLSearch return _("Arbeitsgruppe suchen"); case "Institut_id": return _("Einrichtung suchen"); + default: + throw new UnexpectedValueException("Invalid search type {$this->search}"); } } @@ -174,6 +176,8 @@ class StandardSearch extends SQLSearch "OR Institute.email LIKE :input " . "OR range_tree.name LIKE :input " . "ORDER BY Institute.Name"; + default: + throw new UnexpectedValueException("Invalid search type {$this->search}"); } } diff --git a/lib/elearning/ConnectedCMS.class.php b/lib/elearning/ConnectedCMS.class.php index 41640b7e5322727d7c703acc1ea8c97e31f80783..0aac5261f4f3ec2597e5f0d8982c515fa420580b 100644 --- a/lib/elearning/ConnectedCMS.class.php +++ b/lib/elearning/ConnectedCMS.class.php @@ -434,15 +434,10 @@ class ConnectedCMS } /** - * terminate - * - * dummy-method. returns false. can be overwritten by subclass. - * @access public - * @return boolean returns false + * dummy-method. can be overwritten by subclass. */ public function terminate() { - return false; } public function deleteConnectedModules($object_id){ diff --git a/lib/elearning/ConnectedUser.class.php b/lib/elearning/ConnectedUser.class.php index 9351955ab217c7e7b31f78048c62fea0016ddbdd..3c74a14589a57c3a33dfcb85c39b2c7fb70c9043 100644 --- a/lib/elearning/ConnectedUser.class.php +++ b/lib/elearning/ConnectedUser.class.php @@ -100,6 +100,8 @@ class ConnectedUser $this->category = $data['external_user_category']; $this->type = $data['external_user_type']; $this->is_connected = true; + + return true; } /** @@ -168,13 +170,10 @@ class ConnectedUser /** * update user-account * - * dummy-method. returns false. must be overwritten by subclass. - * @access public - * @return boolean returns false + * dummy-method. must be overwritten by subclass. */ - function updateUser() + public function updateUser() { - return false; } /** @@ -464,13 +463,12 @@ class ConnectedUser } /** - * save connection for user-account - * - * saves user-connection to database and sets type for actual user - * @access public - * @param string $user_type user-type - */ - function setConnection($user_type) + * save connection for user-account + * + * saves user-connection to database and sets type for actual user + * @param string $user_type user-type + */ + public function setConnection($user_type) { $this->setUserType($user_type); diff --git a/lib/elearning/ELearningUtils.class.php b/lib/elearning/ELearningUtils.class.php index c5b22d1a362c1bf7a5a14fdcb84eb78a95362e0c..ad49569d013c17db510ea1cd8d9bfd672365ce7c 100644 --- a/lib/elearning/ELearningUtils.class.php +++ b/lib/elearning/ELearningUtils.class.php @@ -446,8 +446,6 @@ class ELearningUtils * delete cms-data * * deletes all data belonging to the specified cms from stud.ip database - * - * @return boolean successful */ public static function deleteCMSData($cms_type) { diff --git a/lib/elearning/Ilias3ConnectedCMS.class.php b/lib/elearning/Ilias3ConnectedCMS.class.php index 83e6921b3f741cf7e549a20beda89d92917ceade..69f1e529f531dce541569ddfe6319a82bbf5f0b0 100644 --- a/lib/elearning/Ilias3ConnectedCMS.class.php +++ b/lib/elearning/Ilias3ConnectedCMS.class.php @@ -337,10 +337,8 @@ class Ilias3ConnectedCMS extends ConnectedCMS * terminate * * terminates connection. - * @access public - * @return boolean returns false */ - function terminate() + public function terminate() { // $this->soap_client->logout(); $this->soap_client->saveCacheData(); diff --git a/lib/elearning/Ilias3ConnectedPermissions.class.php b/lib/elearning/Ilias3ConnectedPermissions.class.php index e3c3b208405f64d36a7021d0adab2397d6cd2331..17319d7298e7e1d150bcf93d436aef61f255bbb4 100644 --- a/lib/elearning/Ilias3ConnectedPermissions.class.php +++ b/lib/elearning/Ilias3ConnectedPermissions.class.php @@ -168,6 +168,8 @@ class Ilias3ConnectedPermissions extends ConnectedPermissions if (!$this->getContentModulePerms($course_id)) { $messages["info"] .= _("Für den zugeordneten ILIAS-Kurs konnten keine Berechtigungen ermittelt werden.") . "<br>"; } + + return true; } /** diff --git a/lib/elearning/Ilias3ConnectedUser.class.php b/lib/elearning/Ilias3ConnectedUser.class.php index 90170f1551df6f1961b3c3fe1e2009e0ae2450b8..ef985295e0e9c4f41732a6a682b98daddbff7291 100644 --- a/lib/elearning/Ilias3ConnectedUser.class.php +++ b/lib/elearning/Ilias3ConnectedUser.class.php @@ -250,13 +250,9 @@ class Ilias3ConnectedUser extends ConnectedUser } /** - * update user - * - * update user-account - * @access public - * @return boolean returns false on error - */ - function updateUser() + * update user-account + */ + public function updateUser() { } @@ -288,18 +284,17 @@ class Ilias3ConnectedUser extends ConnectedUser } /** - * set connection - * - * set user connection - * @access public - * @param string user_type user-type - * @return boolean returns false on error - */ - function setConnection($user_type, $ignore_encrypt_passwords = false) + * set connection + * + * set user connection + * @access public + * @param string user_type user-type + */ + public function setConnection($user_type, $ignore_encrypt_passwords = false) { global $connected_cms; - if (!$ignore_encrypt_passwords && $connected_cms[$this->cms_type]->encrypt_passwords == "md5") + if (!$ignore_encrypt_passwords && $connected_cms[$this->cms_type]->encrypt_passwords === "md5") { // echo "PASSWORD-ENCRYPTION"; $this->external_password = $this->getCryptedPassword( $this->external_password ); diff --git a/lib/elearning/Ilias3ContentModule.class.php b/lib/elearning/Ilias3ContentModule.class.php index 95b2f8fd88f41e60cf79acec2aa44c9235d19a4c..b1c913ce3cf67f03168fdd58c5773d6db56337b3 100644 --- a/lib/elearning/Ilias3ContentModule.class.php +++ b/lib/elearning/Ilias3ContentModule.class.php @@ -122,6 +122,8 @@ class Ilias3ContentModule extends ContentModule } // echo "PERM".implode($this->allowed_operations,"-"); + + return true; } /** diff --git a/lib/elearning/Ilias4ConnectedCMS.class.php b/lib/elearning/Ilias4ConnectedCMS.class.php index f9e566a7ba6e53249a267be8be1e5b19e6b900aa..b8f0ea3ab14f32e0bb89cea880862a9a2a7cd091 100644 --- a/lib/elearning/Ilias4ConnectedCMS.class.php +++ b/lib/elearning/Ilias4ConnectedCMS.class.php @@ -79,7 +79,6 @@ class Ilias4ConnectedCMS extends Ilias3ConnectedCMS * checks if there are modules in the course that are not connected to the seminar * @access public * @param string $course_id course-id - * @return boolean successful */ function updateConnections($course_id) { diff --git a/lib/elearning/ObjectConnections.class.php b/lib/elearning/ObjectConnections.class.php index fc28b9b47d1204714b1ed7d8f4739d2cb62dc8cb..e360f71759b4ea1ac869a8ee0e57ca91db41881e 100644 --- a/lib/elearning/ObjectConnections.class.php +++ b/lib/elearning/ObjectConnections.class.php @@ -106,14 +106,12 @@ class ObjectConnections * @param string $object_id object-id (optional) * @return boolean connection-status */ - public static function isObjectConnected($object_id = null) + public static function isObjectConnected($object_id) { - if (isset($object_id)) { - $query = "SELECT 1 FROM object_contentmodules WHERE object_id = ?"; - $statement = DBManager::get()->prepare($query); - $statement->execute([$object_id]); - return (bool)$statement->fetchColumn(); - } + $query = "SELECT 1 FROM object_contentmodules WHERE object_id = ?"; + $statement = DBManager::get()->prepare($query); + $statement->execute([$object_id]); + return (bool)$statement->fetchColumn(); } /** diff --git a/lib/ilias_interface/ConnectedIlias.class.php b/lib/ilias_interface/ConnectedIlias.class.php index c6d0497b7c9e1bd61b8e2cf80ccf737e08011393..f49487bdcffa56908bd1a1c0dc917c8a99d3fb49 100644 --- a/lib/ilias_interface/ConnectedIlias.class.php +++ b/lib/ilias_interface/ConnectedIlias.class.php @@ -114,11 +114,7 @@ class ConnectedIlias } /** - * load settings - * * load ILIAS settings from config table - * @access public - * @return string messages */ public function loadSettings() { @@ -912,7 +908,7 @@ class ConnectedIlias * creates new ilias course * @access public * @param string $studip_course_id seminar-id - * @return boolean successful + * @return string|false|null */ public function addCourse($studip_course_id) { @@ -1034,6 +1030,8 @@ class ConnectedIlias $this->CheckUserCoursePermissions($crs_id); return $crs_id; } + + return null; } /** diff --git a/lib/ilias_interface/IliasModule.class.php b/lib/ilias_interface/IliasModule.class.php index 0aff13ba371b6fd7a82093bb596bd2cba6123803..53a8f780f102f699b551df209bc7c1c213c9f8e8 100644 --- a/lib/ilias_interface/IliasModule.class.php +++ b/lib/ilias_interface/IliasModule.class.php @@ -213,6 +213,8 @@ class IliasModule case 'add' : return 'course/ilias_interface/edit_object_assignment/'.$this->ilias_index.'?add_module=1&ilias_module_id='.$this->id; case 'remove' : return 'course/ilias_interface/edit_object_assignment/'.$this->ilias_index.'?remove_module&ilias_module_id='.$this->id; } + + throw new InvalidArgumentException("Unknown action {$action}"); } diff --git a/lib/ilias_interface/IliasObjectConnections.class.php b/lib/ilias_interface/IliasObjectConnections.class.php index c55eee7a79690621248f091128a1dfd56b7c9697..87468e996154cd0e40b116edf385f97c7718e90a 100755 --- a/lib/ilias_interface/IliasObjectConnections.class.php +++ b/lib/ilias_interface/IliasObjectConnections.class.php @@ -110,8 +110,10 @@ class IliasObjectConnections $query = "SELECT 1 FROM object_contentmodules WHERE object_id = ? AND system_type = ?"; $statement = DBManager::get()->prepare($query); $statement->execute([$object_id, $index]); - return (bool)$statement->fetchColumn(); + return (bool) $statement->fetchColumn(); } + + return false; } /** diff --git a/lib/ilias_interface/IliasSoap.class.php b/lib/ilias_interface/IliasSoap.class.php index 93f34970fb185f329a394c11874deda369dcda02..b8977bf0e85655bcd4a8c1420fdfa9a19af76a43 100644 --- a/lib/ilias_interface/IliasSoap.class.php +++ b/lib/ilias_interface/IliasSoap.class.php @@ -985,8 +985,8 @@ class IliasSoap extends StudipSoapClient return $ret; } } - return false; } + return false; } /** diff --git a/lib/ilias_interface/IliasUser.class.php b/lib/ilias_interface/IliasUser.class.php index 23968f9160549f3c94a9534b79044a6dc83fb67c..996bb85ff5fb593134851d44f26fa404084040fd 100755 --- a/lib/ilias_interface/IliasUser.class.php +++ b/lib/ilias_interface/IliasUser.class.php @@ -99,6 +99,8 @@ class IliasUser $this->category = $data['external_user_category']; $this->type = $data['external_user_type']; $this->is_connected = true; + + return true; } /** @@ -205,12 +207,11 @@ class IliasUser * set id * * returns id - * @access public * @return string id */ - function setId($ilias_user_id) + public function setId($ilias_user_id) { - $this->id = $ilias_user_id; + return $this->id = $ilias_user_id; } /** diff --git a/lib/migrations/Migration.php b/lib/migrations/Migration.php index d989d5341e36eceec6cd1d406f302d15419a3662..abaf7476605871b3c18c0d642b57ff1ca01fc7ee 100644 --- a/lib/migrations/Migration.php +++ b/lib/migrations/Migration.php @@ -45,6 +45,7 @@ abstract class Migration */ public function description() { + return ''; } /** diff --git a/lib/models/CalendarEvent.class.php b/lib/models/CalendarEvent.class.php index a7edb4aaaf53610c57e2c09e6017a7d4c2e80461..6b4f1e0f7659a4d068599f6304fa7f8c33524cce 100644 --- a/lib/models/CalendarEvent.class.php +++ b/lib/models/CalendarEvent.class.php @@ -238,7 +238,7 @@ class CalendarEvent extends SimpleORMap implements Event, PrivacyObject * TODO should throw an exception if input values are wrong * * @param array $r_rule - * @return array The values of the recurrence rule. + * @return array|false The values of the recurrence rule. */ function setRecurrence($r_rule) { @@ -453,6 +453,8 @@ class CalendarEvent extends SimpleORMap implements Event, PrivacyObject $this->event->duration = $rrule[7]; $this->event->count = $r_rule['count']; $this->event->expire = $r_rule['expire']; + + return $r_rule; } /** @@ -1027,7 +1029,9 @@ class CalendarEvent extends SimpleORMap implements Event, PrivacyObject case 'inst': case 'fak': return (string) $this->institute->name; - } + default: + return ''; + } } /** diff --git a/lib/models/CourseDate.class.php b/lib/models/CourseDate.class.php index 91c357934069f01e2a11b3f540ceecfaa2940042..e98308de3c18838e0101b37f23245ae3f15ed596 100644 --- a/lib/models/CourseDate.class.php +++ b/lib/models/CourseDate.class.php @@ -196,7 +196,7 @@ class CourseDate extends SimpleORMap implements PrivacyObject * * @param mixed $topic Topic definition (might be an id, an array or an * object) - * @return number addition of all return values, false if none was called + * @return int|false number addition of all return values, false if none was called */ public function addTopic($topic) { @@ -205,6 +205,7 @@ class CourseDate extends SimpleORMap implements PrivacyObject $this->topics[] = $topic; return $this->storeRelations('topics'); } + return false; } /** diff --git a/lib/models/Courseware/Filesystem/PublicFolder.php b/lib/models/Courseware/Filesystem/PublicFolder.php index 94a7b54a4b69244e8bfc2ae001bfd7211f25239e..271c9294adb48d2bb2a0627967cadb291b17ef90 100755 --- a/lib/models/Courseware/Filesystem/PublicFolder.php +++ b/lib/models/Courseware/Filesystem/PublicFolder.php @@ -163,6 +163,7 @@ class PublicFolder extends StandardFolder */ public function setDataFromEditTemplate($request) { + return $this; } /** @@ -204,6 +205,7 @@ class PublicFolder extends StandardFolder */ public function deleteSubfolder($subfolderId) { + return false; } /** diff --git a/lib/models/FileRef.php b/lib/models/FileRef.php index a3f9a3a1b9f19b81d83ca262aaccaa2fb59a7fbf..a8f5da2997eceea595eda97733e91d58a1a3f120 100644 --- a/lib/models/FileRef.php +++ b/lib/models/FileRef.php @@ -192,7 +192,7 @@ class FileRef extends SimpleORMap implements PrivacyObject, FeedbackRange /** * This method increments the download counter of the FileRef. * - * @return The number of rows of the file_refs table that have been altered. + * @return int The number of rows of the file_refs table that have been altered. */ public function incrementDownloadCounter() { @@ -204,6 +204,8 @@ class FileRef extends SimpleORMap implements PrivacyObject, FeedbackRange WHERE {$where_query}"; return DBManager::get()->exec($query); } + + return 0; } /** diff --git a/lib/models/Institute.class.php b/lib/models/Institute.class.php index b25e3597e42be6a4224c063a3b1c57797fb01be4..1ba4eb08a86d52aa87a186368261e9a2c41d2980 100644 --- a/lib/models/Institute.class.php +++ b/lib/models/Institute.class.php @@ -139,6 +139,7 @@ class Institute extends SimpleORMap implements Range if (Context::isInstitute()) { return Context::get(); } + return null; } /** diff --git a/lib/models/OERHostOERSI.php b/lib/models/OERHostOERSI.php index 3ceb23c4eeaf9a2e57afb70f0c9e21448588d3ad..11a61fbd29f96d14a1fcc2338bb823ff34984983 100755 --- a/lib/models/OERHostOERSI.php +++ b/lib/models/OERHostOERSI.php @@ -77,7 +77,7 @@ class OERHostOERSI extends OERHost */ public function pushDataToEndpoint($endpoint, $data) { - //nothing to do + return true; } /** diff --git a/lib/models/PersonalNotifications.class.php b/lib/models/PersonalNotifications.class.php index f403316caeb88c20815bbc5ab37762ad778872b9..dbdb266ecddb887de6a3d4139b87de24ddcb7fef 100644 --- a/lib/models/PersonalNotifications.class.php +++ b/lib/models/PersonalNotifications.class.php @@ -176,7 +176,6 @@ class PersonalNotifications extends SimpleORMap * notification-list on top of its site. * @param string $notification_id : ID of the notification * @param string|null $user_id : ID of special user the notification should belong to or (default:) null for current user - * @return boolean : true on success, false if it failed. */ public static function markAsRead($notification_id, $user_id = null) { @@ -224,7 +223,6 @@ class PersonalNotifications extends SimpleORMap * notification-list on top of its site. * @param string $html_id : HTML ID attribute of the notification * @param string|null $user_id : ID of special user the notification should belong to or (default:) null for current user - * @return boolean : true on success, false if it failed. */ public static function markAsReadByHTML($html_id, $user_id = null) { diff --git a/lib/models/SeminarCycleDate.class.php b/lib/models/SeminarCycleDate.class.php index 5f6c08ba34ce425f41f383507aec0c01190d173d..5fd6531dd9f4a267fe796f53f4a8ab241e4ad792 100644 --- a/lib/models/SeminarCycleDate.class.php +++ b/lib/models/SeminarCycleDate.class.php @@ -110,7 +110,7 @@ class SeminarCycleDate extends SimpleORMap * Returns the time fraction for a given field. * * @param String $field Time fraction field - * @return String containing the time fraction + * @return int the time fraction */ protected function getTimeFraction($field) { @@ -122,6 +122,8 @@ class SeminarCycleDate extends SimpleORMap list($end_hour, $end_minute) = explode(':', $this->end_time); return (int)$$field; } + + throw new InvalidArgumentException("Invalid field {$field}"); } /** @@ -149,6 +151,8 @@ class SeminarCycleDate extends SimpleORMap $this->end_time = sprintf('%02u:%02u:00', $this->end_hour, $value); return $this->end_minute; } + + throw new InvalidArgumentException("Invalid field {$field}"); } /** diff --git a/lib/models/SimpleORMap.class.php b/lib/models/SimpleORMap.class.php index 92cdf423af7e2dd9dec5e2a6709b76984566ee2a..3eeac13f6434c1d9941c4af06a245dd04ca67fbc 100644 --- a/lib/models/SimpleORMap.class.php +++ b/lib/models/SimpleORMap.class.php @@ -1885,7 +1885,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate * is instead invoked * * @param null|array|string $only_these - * @return number addition of all return values, false if none was called + * @return int|false number addition of all return values, false if none was called */ protected function storeRelations($only_these = null) { @@ -1955,9 +1955,9 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate WHERE ". join(" AND ", $where_query)); return true; } - } else { - return false; } + + return false; } /** diff --git a/lib/models/SimpleORMapCollection.class.php b/lib/models/SimpleORMapCollection.class.php index 38914ddbb3b5d2df6625a10e8ae5cc0356c842d3..94a52ecdfd8d2164b8c74509bfeb9fd80d595dc7 100644 --- a/lib/models/SimpleORMapCollection.class.php +++ b/lib/models/SimpleORMapCollection.class.php @@ -149,7 +149,7 @@ class SimpleORMapCollection extends SimpleCollection * by calling the finder function * * @throws InvalidArgumentException - * @return number of records after refresh + * @return ?int number of records after refresh */ public function refresh() { @@ -164,6 +164,8 @@ class SimpleORMapCollection extends SimpleCollection $this->deleted->exchangeArray([]); return $this->last_count = $this->count(); } + + return null; } /** diff --git a/lib/models/User.class.php b/lib/models/User.class.php index fd95aa9070bac813250333e1642c7feade539337..eb86a1e1433bd6e064b6b5d2624f34d4b4b1ed7d 100644 --- a/lib/models/User.class.php +++ b/lib/models/User.class.php @@ -209,13 +209,15 @@ class User extends AuthUserMd5 implements Range, PrivacyObject /** * Returns the currently authenticated user. * - * @return User User + * @return ?User User */ public static function findCurrent() { if (is_object($GLOBALS['user'])) { return $GLOBALS['user']->getAuthenticatedUser(); } + + return null; } /** @@ -241,7 +243,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject * Returns user object including user_info * * @param string $id - * @return User User + * @return ?User User */ public static function findFull($id) { @@ -253,6 +255,8 @@ class User extends AuthUserMd5 implements Range, PrivacyObject if ($data) { return self::buildExisting($data); } + + return null; } /** diff --git a/lib/modules/ConsultationModule.class.php b/lib/modules/ConsultationModule.class.php index acb15b2be6db9c4f063da75d89c99ece6292272c..ca5654d3725726bf23c214c8c50381902ce3a939 100644 --- a/lib/modules/ConsultationModule.class.php +++ b/lib/modules/ConsultationModule.class.php @@ -57,9 +57,11 @@ class ConsultationModule extends CorePlugin implements StudipModule, SystemPlugi */ public function getTabNavigation($course_id) { - if ($GLOBALS['user']->id !== 'nobody') { - return ['consultation' => new ConsultationNavigation(RangeFactory::find($course_id))]; + if ($GLOBALS['user']->id === 'nobody') { + return []; } + + return ['consultation' => new ConsultationNavigation(RangeFactory::find($course_id))]; } /** diff --git a/lib/modules/EvaluationsWidget.php b/lib/modules/EvaluationsWidget.php index 4c902c7047e89ec3379f7e7d599e67de80e9cbfc..bfe7cd81b23b2832b16231904e326539bc4bcc00 100644 --- a/lib/modules/EvaluationsWidget.php +++ b/lib/modules/EvaluationsWidget.php @@ -38,25 +38,27 @@ class EvaluationsWidget extends CorePlugin implements PortalPlugin */ public function getPortalTemplate() { + if (!Config::get()->VOTE_ENABLE) { + return null; + } + // include and show votes and tests - if (Config::get()->VOTE_ENABLE) { - $controller = new AuthenticatedController(new StudipDispatcher()); - $controller->suppress_empty_output = true; + $controller = new AuthenticatedController(new StudipDispatcher()); + $controller->suppress_empty_output = true; - $response = $controller->relay('evaluation/display/studip')->body; + $response = $controller->relay('evaluation/display/studip')->body; - $controller->suppress_empty_output = (bool)$response; - $response .= $controller->relay('questionnaire/widget/start')->body; + $controller->suppress_empty_output = (bool)$response; + $response .= $controller->relay('questionnaire/widget/start')->body; - $template = $GLOBALS['template_factory']->open('shared/string'); - $template->content = $response; + $template = $GLOBALS['template_factory']->open('shared/string'); + $template->content = $response; - if ($GLOBALS['perm']->have_perm('root')) { - $navigation = new Navigation('', 'dispatch.php/questionnaire/overview'); - $navigation->setImage(Icon::create('add', 'clickable', ["title" => _('Umfragen bearbeiten')])); - $template->icons = [$navigation]; - } - return $template; + if ($GLOBALS['perm']->have_perm('root')) { + $navigation = new Navigation('', 'dispatch.php/questionnaire/overview'); + $navigation->setImage(Icon::create('add', 'clickable', ["title" => _('Umfragen bearbeiten')])); + $template->icons = [$navigation]; } + return $template; } } diff --git a/lib/modules/FeedbackModule.class.php b/lib/modules/FeedbackModule.class.php index 99be4e5b5b347161897afb9f09b5dea4e013c6b7..c369ea72a31160c014e2054a25d13cd37bb3830a 100644 --- a/lib/modules/FeedbackModule.class.php +++ b/lib/modules/FeedbackModule.class.php @@ -39,6 +39,8 @@ class FeedbackModule extends CorePlugin implements StudipModule, SystemPlugin $navigation->addSubNavigation('index', new Navigation(_('Übersicht'), 'dispatch.php/course/feedback')); return ['feedback' => $navigation]; } + + return []; } /** * {@inheritdoc} diff --git a/lib/modules/LtiToolModule.class.php b/lib/modules/LtiToolModule.class.php index 3093615aa293fa40335011636ed4bb1397c80d28..0383f115f640807a749030571daadbdd0c0404da 100644 --- a/lib/modules/LtiToolModule.class.php +++ b/lib/modules/LtiToolModule.class.php @@ -55,6 +55,10 @@ class LtiToolModule extends CorePlugin implements StudipModule, SystemPlugin, Pr */ public function getTabNavigation($course_id) { + if ($GLOBALS['user']->id === 'nobody') { + return []; + } + $title = CourseConfig::get($course_id)->LTI_TOOL_TITLE; $grades = LtiData::countBySQL('course_id = ?', [$course_id]); @@ -67,9 +71,7 @@ class LtiToolModule extends CorePlugin implements StudipModule, SystemPlugin, Pr $navigation->addSubNavigation('grades', new Navigation(_('Ergebnisse'), 'dispatch.php/course/lti/grades')); } - if ($GLOBALS['user']->id !== 'nobody') { - return ['lti' => $navigation]; - } + return ['lti' => $navigation]; } /** diff --git a/lib/object.inc.php b/lib/object.inc.php index c0c4e15653b0f1d301a76af4c18e34cfd194974e..5f231da6de6ee41a48c746055d8e1b24fb444e0f 100644 --- a/lib/object.inc.php +++ b/lib/object.inc.php @@ -342,7 +342,7 @@ function object_return_views ($object_id) /** * converts a ouv type to an id * @param $type string former used type of visited objects or module (i.e. news, documents, wiki) - * @return int + * @return ?int */ function object_type_to_id($type) { @@ -375,6 +375,7 @@ function object_type_to_id($type) } } + return null; } /** diff --git a/lib/phplib/Seminar_Auth.class.php b/lib/phplib/Seminar_Auth.class.php index ae4a0f0ca60fe5c17f694f9ac4815834f082b60a..0411f75ae66fe54e04631cdca6403ddbe40ae2ff 100644 --- a/lib/phplib/Seminar_Auth.class.php +++ b/lib/phplib/Seminar_Auth.class.php @@ -208,6 +208,8 @@ class Seminar_Auth throw new RuntimeException("Error in auth handling: invalid state reached."); break; } + + return false; } @@ -319,11 +321,10 @@ class Seminar_Auth return $user->id; } - } else { - return false; } } - // end of single sign on + + return false; } /** diff --git a/lib/phplib/Seminar_Perm.class.php b/lib/phplib/Seminar_Perm.class.php index 736c1e3bb08d83d9e299b639c21275eb97dac5d1..a116938f8a705d35e3d49d76640d5aadb7748610 100644 --- a/lib/phplib/Seminar_Perm.class.php +++ b/lib/phplib/Seminar_Perm.class.php @@ -67,7 +67,7 @@ class Seminar_Perm /** * @param bool $user_id - * @return string + * @return string|null */ public function get_perm($user_id = false) { @@ -90,6 +90,8 @@ class Seminar_Perm return $this->studip_perms['studip'][$user_id] = $perms; } + + return null; } /** diff --git a/lib/phplib/Seminar_Register_Auth.class.php b/lib/phplib/Seminar_Register_Auth.class.php index 4af44ef47072ea190b196cc8feed24e73be5e0e5..dff388e6e93fdd68e01391f4a007e9436053eeee 100644 --- a/lib/phplib/Seminar_Register_Auth.class.php +++ b/lib/phplib/Seminar_Register_Auth.class.php @@ -151,13 +151,17 @@ class Seminar_Register_Auth extends Seminar_Auth $new_user->auth_plugin = 'standard'; $new_user->store(); - if ($new_user->user_id) { - self::sendValidationMail($new_user); - $this->auth['perm'] = $new_user->perms; - $this->auth['uname'] = $new_user->username; - $this->auth['auth_plugin'] = $new_user->auth_plugin; - return $new_user->user_id; + if (!$new_user->user_id) { + return false; } + + self::sendValidationMail($new_user); + + $this->auth['perm'] = $new_user->perms; + $this->auth['uname'] = $new_user->username; + $this->auth['auth_plugin'] = $new_user->auth_plugin; + + return $new_user->user_id; } /** diff --git a/lib/plugins/core/PortalPlugin.class.php b/lib/plugins/core/PortalPlugin.class.php index ed157a8b9f386c63fb058d269afb40bc19423c79..dce5774f96576fce5b2ea36ca3d9bf943f3bb7a8 100644 --- a/lib/plugins/core/PortalPlugin.class.php +++ b/lib/plugins/core/PortalPlugin.class.php @@ -27,7 +27,7 @@ interface PortalPlugin * admin_url admin link for this plugin (if any) * admin_title title for admin link (default: Administration) * - * @return object template object to render or NULL + * @return ?Flexi_Template template object to render or NULL */ function getPortalTemplate(); } diff --git a/lib/raumzeit/CycleData.class.php b/lib/raumzeit/CycleData.class.php index bcbdf28476863d2d99ce2d11c87dc3a1ffc684e9..587e0bc7f5f60d066816f0024506a0ca370e34a9 100644 --- a/lib/raumzeit/CycleData.class.php +++ b/lib/raumzeit/CycleData.class.php @@ -344,13 +344,11 @@ class CycleData * * @param int $filterStart * @param int $filterEnd - * @return array + * @return array|false */ function getFreeTextPredominantRoom($filterStart = 0, $filterEnd = 0) { - if ($room = CycleDataDB::getFreeTextPredominantRoomDB($this->metadate_id, $filterStart, $filterEnd)) { - return $room; - } + return CycleDataDB::getFreeTextPredominantRoomDB($this->metadate_id, $filterStart, $filterEnd); } /** diff --git a/lib/showNews.inc.php b/lib/showNews.inc.php index 6c9ed38df4d3ecf0a3d55fa18529c3af0f8b78ca..c00071357c2a32ac752b0653008676f56b6c2c62 100644 --- a/lib/showNews.inc.php +++ b/lib/showNews.inc.php @@ -150,8 +150,7 @@ function delete_news($delete_news_array) * generates proper text for confirmation question and removes range_id from news * * - * @param $remove_array array with $news_id as key and array of range_ids as value - * @param string $range_id + * @param array $remove_array with $news_id as key and array of range_ids as value * @return string text for confirmation question or empty string after removal */ function remove_news($remove_array) @@ -159,7 +158,7 @@ function remove_news($remove_array) $confirmed = false; $question_text = []; if (!is_array($remove_array)) { - return false; + return ''; } if (Request::submitted('yes') && Request::isPost()) { CSRFProtection::verifySecurityToken(); @@ -227,6 +226,8 @@ function remove_news($remove_array) if (count($question_text) == 1) { return _('Wollen Sie diese Aktion jetzt ausführen?') . "\n" . implode($question_text); } + + return ''; } /**