diff --git a/auth/classes/output/verify_age_location_page.php b/auth/classes/output/verify_age_location_page.php index 4d8b79072b8..8aa19490fd1 100644 --- a/auth/classes/output/verify_age_location_page.php +++ b/auth/classes/output/verify_age_location_page.php @@ -40,7 +40,7 @@ require_once($CFG->libdir.'/formslib.php'); */ class verify_age_location_page implements renderable, templatable { - /** @var mform The form object */ + /** @var \moodleform The form object */ protected $form; /** @var string Error message */ @@ -49,7 +49,7 @@ class verify_age_location_page implements renderable, templatable { /** * Constructor * - * @param mform $form The form object + * @param \moodleform $form The form object * @param string $errormessage The error message. */ public function __construct($form, $errormessage = null) { @@ -61,7 +61,7 @@ class verify_age_location_page implements renderable, templatable { * Export the page data for the mustache template. * * @param renderer_base $output renderer to be used to render the page elements. - * @return stdClass + * @return \stdClass */ public function export_for_template(renderer_base $output) { global $SITE; diff --git a/comment/lib.php b/comment/lib.php index 7c95224fc15..e555f93927c 100644 --- a/comment/lib.php +++ b/comment/lib.php @@ -543,7 +543,7 @@ class comment { * * @param int $page * @param str $sortdirection sort direction, ASC or DESC - * @return array + * @return array|false */ public function get_comments($page = '', $sortdirection = 'DESC') { global $DB, $CFG, $USER, $OUTPUT; @@ -956,7 +956,7 @@ class comment { /** * Revoke validate callbacks * - * @param stdClass $params addtionall parameters need to add to callbacks + * @param array $params addtionall parameters need to add to callbacks */ protected function validate($params=array()) { foreach ($params as $key=>$value) { @@ -1074,7 +1074,7 @@ class comment { /** * Returns the comment area associated with the commentarea * - * @return stdClass + * @return string */ public function get_commentarea() { return $this->commentarea; diff --git a/comment/locallib.php b/comment/locallib.php index d3b0004162b..009e6cdd450 100644 --- a/comment/locallib.php +++ b/comment/locallib.php @@ -242,7 +242,7 @@ class comment_manager { * @param stdClass $context context object * @param string $component component name * @param int $since the time to check - * @param stdClass $cm course module object + * @param stdClass|\cm_info|null $cm course module object * @return array list of comments db records since the given timelimit * @since Moodle 3.2 */ diff --git a/course/format/classes/base.php b/course/format/classes/base.php index f7650aa06cc..83537b5bf16 100644 --- a/course/format/classes/base.php +++ b/course/format/classes/base.php @@ -97,7 +97,6 @@ abstract class base { * * @param string $format * @param int $courseid - * @return course_format */ protected function __construct($format, $courseid) { $this->format = $format; @@ -315,7 +314,7 @@ abstract class base { * Returns a record from course database table plus additional fields * that course format defines * - * @return stdClass + * @return ?stdClass */ public function get_course() { global $DB; @@ -503,7 +502,7 @@ abstract class base { * * @param int|stdClass $section either section number (field course_section.section) or row from course_section table * @param int $strictness - * @return section_info + * @return ?section_info */ final public function get_section($section, $strictness = IGNORE_MISSING) { if (is_object($section)) { @@ -791,7 +790,7 @@ abstract class base { * * Used in course/rest.php * - * @return array This will be passed in ajax respose + * @return ?array This will be passed in ajax respose */ public function ajax_section_move() { return null; @@ -902,7 +901,7 @@ abstract class base { * Also note that if $navigation->includesectionnum is not null, the section with this relative * number needs is expected to be loaded * - * @param global_navigation $navigation + * @param \global_navigation $navigation * @param navigation_node $node The course node within the navigation */ public function extend_course_navigation($navigation, navigation_node $node) { @@ -1138,7 +1137,7 @@ abstract class base { * * This function is called from course_edit_form::definition_after_data() * - * @param MoodleQuickForm $mform form the elements are added to + * @param \MoodleQuickForm $mform form the elements are added to * @param bool $forsection 'true' if this is a section edit form, 'false' if this is course edit form * @return array array of references to the added form elements */ @@ -1368,7 +1367,7 @@ abstract class base { * @param array $customdata the array with custom data to be passed to the form * /course/editsection.php passes section_info object in 'cs' field * for filling availability fields - * @return moodleform + * @return \moodleform */ public function editsection_form($action, $customdata = array()) { global $CFG; @@ -1414,7 +1413,7 @@ abstract class base { * Return instance of format_FORMATNAME_XXX in this function, the appropriate method from * plugin renderer will be called * - * @return null|renderable null for no output or object with data for plugin renderer + * @return null|\renderable null for no output or object with data for plugin renderer */ public function course_header() { return null; @@ -1426,7 +1425,7 @@ abstract class base { * * See course_format::course_header() for usage * - * @return null|renderable null for no output or object with data for plugin renderer + * @return null|\renderable null for no output or object with data for plugin renderer */ public function course_footer() { return null; @@ -1437,7 +1436,7 @@ abstract class base { * * See course_format::course_header() for usage * - * @return null|renderable null for no output or object with data for plugin renderer + * @return null|\renderable null for no output or object with data for plugin renderer */ public function course_content_header() { return null; @@ -1448,7 +1447,7 @@ abstract class base { * * See course_format::course_header() for usage * - * @return null|renderable null for no output or object with data for plugin renderer + * @return null|\renderable null for no output or object with data for plugin renderer */ public function course_content_footer() { return null; @@ -1458,7 +1457,7 @@ abstract class base { * Returns instance of page renderer used by this plugin * * @param moodle_page $page - * @return renderer_base + * @return \renderer_base */ public function get_renderer(moodle_page $page) { try { @@ -1788,7 +1787,7 @@ abstract class base { * @param stdClass $section * @param string $itemtype * @param mixed $newvalue - * @return \core\output\inplace_editable + * @return ?\core\output\inplace_editable */ public function inplace_editable_update_section_name($section, $itemtype, $newvalue) { if ($itemtype === 'sectionname' || $itemtype === 'sectionnamenl') { @@ -1812,7 +1811,7 @@ abstract class base { * moodlecourse/courseduration setting. Course formats like format_weeks for * example can overwrite this method and return a value based on their internal options. * - * @param moodleform $mform + * @param \MoodleQuickForm $mform * @param array $fieldnames The form - field names mapping. * @return int */ @@ -1855,7 +1854,7 @@ abstract class base { /** * Get the start date value from the course settings page form. * - * @param moodleform $mform + * @param \MoodleQuickForm $mform * @param array $fieldnames The form - field names mapping. * @return int */ diff --git a/course/lib.php b/course/lib.php index 0d43762d618..004e135fd20 100644 --- a/course/lib.php +++ b/course/lib.php @@ -288,7 +288,7 @@ function build_mnet_logs_array($hostid, $course, $user=0, $date=0, $order="l.tim * course modules from sequences. Only to be used in site maintenance mode when we are * sure that another user is not in the middle of the process of moving/removing a module. * @param bool $checkonly Only performs the check without updating DB, outputs all errors as debug messages. - * @return array array of messages with found problems. Empty output means everything is ok + * @return array|false array of messages with found problems. Empty output means everything is ok */ function course_integrity_check($courseid, $rawmods = null, $sections = null, $fullcheck = false, $checkonly = false) { global $DB; @@ -914,7 +914,7 @@ function course_delete_module($cmid, $async = false) { * The real deletion of the module is handled by the task, which calls 'course_delete_module($cmid)'. * * @param int $cmid the course module id. - * @return bool whether the module was successfully scheduled for deletion. + * @return ?bool whether the module was successfully scheduled for deletion. * @throws \moodle_exception */ function course_module_flag_for_async_deletion($cmid) { @@ -1242,7 +1242,7 @@ function course_delete_section_async($section, $forcedeleteifnotempty = true) { * This function does not check permissions or clean values - this has to be done prior to calling it. * * @param int|stdClass $courseorid - * @param stdClass $section record from course_sections table - it will be updated with the new values + * @param stdClass|section_info $section record from course_sections table - it will be updated with the new values * @param array|stdClass $data */ function course_update_section($courseorid, $section, $data) { @@ -1304,7 +1304,7 @@ function course_can_delete_section($course, $section) { * @param array $sections * @param int $origin_position * @param int $target_position - * @return array + * @return array|false */ function reorder_sections($sections, $origin_position, $target_position) { if (!is_array($sections)) { @@ -1612,7 +1612,7 @@ function course_get_cm_edit_actions(cm_info $mod, $indent = -1, $sr = null) { * * @param cm_info $mod The module to produce a move button for * @param int $sr The section to link back to (used for creating the links) - * @return The markup for the move action, or an empty string if not available. + * @return string The markup for the move action, or an empty string if not available. */ function course_get_cm_move(cm_info $mod, $sr = null) { global $OUTPUT; @@ -1859,7 +1859,7 @@ function can_delete_course($courseid) { * Save the Your name for 'Some role' strings. * * @param integer $courseid the id of this course. - * @param array $data the data that came from the course settings form. + * @param array|stdClass $data the data that came from the course settings form. */ function save_local_role_names($courseid, $data) { global $DB; @@ -3095,7 +3095,7 @@ function update_module($moduleinfo) { * @param object $cm The course module to duplicate * @param int $sr The section to link back to (used for creating the links) * @throws moodle_exception if the plugin doesn't support duplication - * @return Object containing: + * @return stdClass Object containing: * - fullcontent: The HTML markup for the created CM * - cmid: The CMID of the newly created CM * - redirect: Whether to trigger a redirect following this change @@ -3471,7 +3471,7 @@ function course_get_tagged_courses($tag, $exclusivemode = false, $fromctx = 0, $ * @param string $itemtype * @param int $itemid * @param mixed $newvalue - * @return \core\output\inplace_editable + * @return ?\core\output\inplace_editable */ function core_course_inplace_editable($itemtype, $itemid, $newvalue) { if ($itemtype === 'activityname') { @@ -3560,7 +3560,7 @@ function core_course_drawer(): string { * @param int $contextid context id where to search for records * @param bool $recursivecontext search in subcontexts as well * @param int $page 0-based number of page being displayed - * @return \core_tag\output\tagindex + * @return ?\core_tag\output\tagindex */ function course_get_tagged_course_modules($tag, $exclusivemode = false, $fromcontextid = 0, $contextid = 0, $recursivecontext = 1, $page = 0) { diff --git a/course/modlib.php b/course/modlib.php index 8b99058b60e..c1305150b83 100644 --- a/course/modlib.php +++ b/course/modlib.php @@ -497,7 +497,7 @@ function set_moduleinfo_defaults($moduleinfo) { * Check that the user can add a module. Also returns some information like the module, context and course section info. * The fucntion create the course section if it doesn't exist. * - * @param object $course the course of the module + * @param stdClass $course the course of the module * @param string $modulename the module name * @param int $sectionnum the section of the module * @return array list containing module, context, course section. diff --git a/lib/accesslib.php b/lib/accesslib.php index 0d4cfd6a406..be16794bfb3 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -383,7 +383,7 @@ function get_role_definitions_uncached(array $roleids) { * Get the default guest role, this is used for guest account, * search engine spiders, etc. * - * @return stdClass role record + * @return stdClass|false role record */ function get_guest_role() { global $CFG, $DB; @@ -970,7 +970,7 @@ function get_empty_accessdata() { * @access private * @param int $userid * @param bool $preloadonly true means do not return access array - * @return array accessdata + * @return ?array accessdata */ function get_user_accessdata($userid, $preloadonly=false) { global $CFG, $ACCESSLIB_PRIVATE, $USER; @@ -2587,7 +2587,7 @@ function is_inside_frontpage(context $context) { * Returns capability information (cached) * * @param string $capabilityname - * @return stdClass or null if capability not found + * @return ?stdClass object or null if capability not found */ function get_capability_info($capabilityname) { $caps = get_all_capabilities(); @@ -2619,7 +2619,7 @@ function get_capability_info($capabilityname) { * Do not use this function except in the get_capability_info * * @param string $capabilityname - * @return stdClass|null with deprecation message and potential replacement if not null + * @return array|null with deprecation message and potential replacement if not null */ function get_deprecated_capability_info($capabilityname) { $cache = cache::make('core', 'capabilities'); diff --git a/lib/adminlib.php b/lib/adminlib.php index ed0ec215a95..635550da8a1 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -729,7 +729,7 @@ interface part_of_admin_tree { /** * Mostly useful for removing of some parts of the tree in admin tree block. * - * @return True is hidden from normal list view + * @return bool True is hidden from normal list view */ public function is_hidden(); @@ -1723,7 +1723,7 @@ abstract class admin_setting { public $description; /** @var mixed Can be string or array of string */ public $defaultsetting; - /** @var string */ + /** @var ?callable */ public $updatedcallback; /** @var mixed can be String or Null. Null means main config table */ public $plugin; // null means main config table @@ -1888,7 +1888,7 @@ abstract class admin_setting { /** * Write the values of the flags for this admin setting. * - * @param array $data - The data submitted from the form or null to set the default value for new installs. + * @param ?array $data - The data submitted from the form or null to set the default value for new installs. * @return bool - true if successful. */ public function write_setting_flags($data) { @@ -2065,7 +2065,7 @@ abstract class admin_setting { /** * Function called if setting updated - cleanup, cache reset, etc. - * @param string $functionname Sets the function name + * @param callable $functionname Sets the function name * @return void */ public function set_updatedcallback($functionname) { @@ -2196,9 +2196,9 @@ class admin_setting_flag { private $shortname = ''; /** @var string String used as the label for this flag */ private $displayname = ''; - /** @var Checkbox for this flag is displayed in admin page */ + /** @var bool Checkbox for this flag is displayed in admin page */ const ENABLED = true; - /** @var Checkbox for this flag is not displayed in admin page */ + /** @var bool Checkbox for this flag is not displayed in admin page */ const DISABLED = false; /** @@ -3175,8 +3175,8 @@ class admin_setting_configmulticheckbox extends admin_setting { * @param string $name unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting' for ones in config_plugins. * @param string $visiblename localised * @param string $description long localised info - * @param array $defaultsetting array of selected - * @param array|callable $choices array of $value => $label for each checkbox, or a callback + * @param ?array $defaultsetting array of selected + * @param array|callable|null $choices array of $value => $label for each checkbox, or a callback */ public function __construct($name, $visiblename, $description, $defaultsetting, $choices) { if (is_array($choices)) { @@ -3421,7 +3421,7 @@ class admin_setting_configselect extends admin_setting { * @param string $name unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting' for ones in config_plugins. * @param string $visiblename localised * @param string $description long localised info - * @param string|int $defaultsetting + * @param string|int|array $defaultsetting * @param array|callable|null $choices array of $value=>$label for each selection, or callback */ public function __construct($name, $visiblename, $description, $defaultsetting, $choices) { @@ -3658,7 +3658,7 @@ class admin_setting_configmultiselect extends admin_setting_configselect { * @param string $visiblename localised * @param string $description long localised info * @param array $defaultsetting array of selected items - * @param array $choices array of $value=>$label for each list item + * @param ?array $choices array of $value=>$label for each list item */ public function __construct($name, $visiblename, $description, $defaultsetting, $choices) { parent::__construct($name, $visiblename, $description, $defaultsetting, $choices); @@ -3856,7 +3856,7 @@ class admin_setting_configtime extends admin_setting { * Store the time (hours and minutes) * * @param array $data Must be form 'h'=>xx, 'm'=>xx - * @return bool true if success, false if not + * @return string error message or empty string on success */ public function write_setting($data) { if (!is_array($data)) { @@ -4097,7 +4097,7 @@ class admin_setting_configduration extends admin_setting { * Store the duration as seconds. * * @param array $data Must be form 'h'=>xx, 'm'=>xx - * @return bool true if success, false if not + * @return string error message or empty string on success */ public function write_setting($data) { if (!is_array($data)) { @@ -5098,7 +5098,7 @@ class admin_setting_emoticons extends admin_setting { /** * Return the current setting(s) * - * @return array Current settings array + * @return ?array Current settings array */ public function get_setting() { global $CFG; @@ -5122,7 +5122,7 @@ class admin_setting_emoticons extends admin_setting { * Save selected settings * * @param array $data Array of settings to save - * @return bool + * @return string error message or empty string on success */ public function write_setting($data) { @@ -5321,7 +5321,7 @@ class admin_setting_langlist extends admin_setting_configtext { * Save the new setting * * @param string $data The new setting - * @return bool + * @return string error message or empty string on success */ public function write_setting($data) { $return = parent::write_setting($data); @@ -5620,7 +5620,7 @@ class admin_setting_special_calendar_weekend extends admin_setting { * Save the new settings * * @param array $data Array of new settings - * @return bool + * @return string error message or empty string on success */ public function write_setting($data) { if (!is_array($data)) { @@ -5740,7 +5740,7 @@ class admin_setting_pickroles extends admin_setting_configmulticheckbox { /** * Return the default setting for this control * - * @return array Array of default settings + * @return ?array Array of default settings */ public function get_defaultsetting() { global $CFG; @@ -6364,7 +6364,7 @@ class admin_setting_gradecat_combo extends admin_setting { /** * Return the current setting(s) array * - * @return array Array of value=>xx, forced=>xx + * @return ?array Array of value=>xx, forced=>xx */ public function get_setting() { global $CFG; @@ -7130,7 +7130,7 @@ class admin_page_manageportfolios extends admin_externalpage { /** * Searches page for the specified string. * @param string $query The string to search for - * @return bool True if it is found on this page + * @return array */ public function search($query) { global $CFG; @@ -7181,7 +7181,7 @@ class admin_page_managerepositories extends admin_externalpage { /** * Searches page for the specified string. * @param string $query The string to search for - * @return bool True if it is found on this page + * @return array */ public function search($query) { global $CFG; @@ -8150,7 +8150,7 @@ abstract class admin_setting_manage_plugins extends admin_setting { /** * Get the type of plugin to manage. * - * @param plugininfo The plugin info class. + * @param \core\plugininfo\base $plugininfo The plugin info class. * @return string */ abstract public function get_info_column($plugininfo); @@ -9194,7 +9194,7 @@ function admin_output_new_settings_by_page($node) { * @param string $description * @param mixed $label link label to id, true by default or string being the label to connect it to * @param string $warning warning text - * @param sting $defaultinfo defaults info, null means nothing, '' is converted to "Empty" string, defaults to null + * @param ?string $defaultinfo defaults info, null means nothing, '' is converted to "Empty" string, defaults to null * @param string $query search query to be highlighted * @return string XHTML */ @@ -9692,7 +9692,7 @@ class admin_setting_enablemobileservice extends admin_setting_configcheckbox { /** * Set the 'webservice/rest:use' to the Authenticated user role (allow or not) - * @param type $status true to allow, false to not set + * @param bool $status true to allow, false to not set */ private function set_protocol_cap($status) { global $CFG; @@ -10472,7 +10472,7 @@ class admin_setting_configcolourpicker extends admin_setting { * Saves the setting * * @param string $data - * @return bool + * @return string error message or empty string on success */ public function write_setting($data) { $data = $this->validate($data); @@ -10794,7 +10794,7 @@ class admin_setting_devicedetectregex extends admin_setting { * * @deprecated Moodle 4.3 MDL-78468 - No longer used since the devicedetectregex was removed. * @todo Final deprecation on Moodle 4.7 MDL-79052 - * @return array Current settings array + * @return ?array Current settings array */ public function get_setting() { debugging( @@ -10818,7 +10818,7 @@ class admin_setting_devicedetectregex extends admin_setting { * @deprecated Moodle 4.3 MDL-78468 - No longer used since the devicedetectregex was removed. * @todo Final deprecation on Moodle 4.7 MDL-79052 * @param array $data Array of settings to save - * @return bool + * @return string error message or empty string on success */ public function write_setting($data) { debugging( diff --git a/lib/authlib.php b/lib/authlib.php index 7a8d9097f7b..eaf7983f903 100644 --- a/lib/authlib.php +++ b/lib/authlib.php @@ -162,7 +162,7 @@ class auth_plugin_base { * If you are using a plugin config variable in this method, please make sure it is set before using it, * as this method can be called even if the plugin is disabled, in which case the config values won't be set. * - * @return moodle_url url of the profile page or null if standard used + * @return ?moodle_url url of the profile page or null if standard used */ function change_password_url() { //override if needed @@ -187,7 +187,7 @@ class auth_plugin_base { * This method is used if can_edit_profile() returns true. * This method is called only when user is logged in, it may use global $USER. * - * @return moodle_url url of the profile page or null if standard used + * @return ?moodle_url url of the profile page or null if standard used */ function edit_profile_url() { //override if needed @@ -314,7 +314,7 @@ class auth_plugin_base { /** * Return a form to capture user details for account creation. * This is used in /login/signup.php. - * @return moodle_form A form which edits a record from the user table. + * @return moodleform A form which edits a record from the user table. */ function signup_form() { global $CFG; @@ -1265,7 +1265,7 @@ function signup_setup_new_user($user) { /** * Check if user confirmation is enabled on this site and return the auth plugin handling registration if enabled. * - * @return stdClass the current auth plugin handling user registration or false if registration not enabled + * @return auth_plugin_base|false the current auth plugin handling user registration or false if registration not enabled * @since Moodle 3.2 */ function signup_get_user_confirmation_authplugin() { diff --git a/lib/badgeslib.php b/lib/badgeslib.php index 2e0b0f5b1f6..357aad0d363 100644 --- a/lib/badgeslib.php +++ b/lib/badgeslib.php @@ -236,7 +236,7 @@ function badges_notify_badge_award(badge $badge, $userid, $issued, $filepathhash /** * Caclulates date for the next message digest to badge creators. * - * @param in $schedule Type of message schedule BADGE_MESSAGE_DAILY|BADGE_MESSAGE_WEEKLY|BADGE_MESSAGE_MONTHLY. + * @param int $schedule Type of message schedule BADGE_MESSAGE_DAILY|BADGE_MESSAGE_WEEKLY|BADGE_MESSAGE_MONTHLY. * @return int Timestamp for next cron */ function badges_calculate_message_schedule($schedule) { @@ -598,7 +598,7 @@ function print_badge_image(badge $badge, stdClass $context, $size = 'small') { * @param int $badgeid ID of the original badge. * @param int $userid ID of badge recipient (optional). * @param boolean $pathhash Return file pathhash instead of image url (optional). - * @return string|url Returns either new file path hash or new file URL + * @return string|moodle_url|null Returns either new file path hash or new file URL */ function badges_bake($hash, $badgeid, $userid = 0, $pathhash = false) { global $CFG, $USER; @@ -1221,7 +1221,6 @@ function badges_external_delete_mappings($sitebackpackid) { * @param integer $sitebackpackid The site backpack to connect to. * @param string $type The type of this remote object. * @param string $internalid The id for this object on the Moodle site. - * @return boolean */ function badges_external_delete_mapping($sitebackpackid, $type, $internalid) { global $DB; @@ -1471,7 +1470,7 @@ function badges_verify_backpack(int $backpackid) { * @param stdClass $backpack The Badgr backpack we are pushing to * @param string $type The type of object we are dealing with either Issuer, Assertion OR Badge. * @param string $externalid The externalid as provided by the backpack - * @return string The public URL to access Badgr objects + * @return ?string The public URL to access Badgr objects */ function badges_generate_badgr_open_url($backpack, $type, $externalid) { if (badges_open_badges_backpack_api($backpack->id) == OPEN_BADGES_V2) { diff --git a/lib/blocklib.php b/lib/blocklib.php index 3ccb07a0734..127aba33e1d 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -929,10 +929,10 @@ class block_manager { * and incremented by the position of the block in the $blocks array * * @param array $blocks array with array keys the region names, and values an array of block names. - * @param string $pagetypepattern optional. Passed to {@link add_block()} - * @param string $subpagepattern optional. Passed to {@link add_block()} - * @param boolean $showinsubcontexts optional. Passed to {@link add_block()} - * @param integer $weight optional. Determines the starting point that the blocks are added in the region. + * @param string|null $pagetypepattern optional. Passed to {@see self::add_block()} + * @param string|null $subpagepattern optional. Passed to {@see self::add_block()} + * @param bool $showinsubcontexts optional. Passed to {@see self::add_block()} + * @param int $weight optional. Determines the starting point that the blocks are added in the region. */ public function add_blocks($blocks, $pagetypepattern = NULL, $subpagepattern = NULL, $showinsubcontexts=false, $weight=0) { $initialweight = $weight; @@ -2128,7 +2128,7 @@ function block_instance_by_id($blockinstanceid) { * @param string $blockname the name of the block. * @param stdClass $instance block_instances DB table row (optional). * @param moodle_page $page the page this block is appearing on. - * @return block_base the requested block instance. + * @return block_base|false the requested block instance. */ function block_instance($blockname, $instance = NULL, $page = NULL) { if(!block_load_class($blockname)) { @@ -2389,7 +2389,7 @@ function mod_page_type_list($pagetype, $parentcontext = null, $currentcontext = * Return a {@link block_contents} representing the add a new block UI, if * this user is allowed to see it. * - * @return block_contents an appropriate block_contents, or null if the user + * @return ?block_contents an appropriate block_contents, or null if the user * cannot add any blocks here. */ function block_add_block_ui($page, $output) { @@ -2601,7 +2601,7 @@ function blocks_set_visibility($instance, $page, $newvisibility) { * * @param $int blockid block type id. If null, an array of all block types is returned. * @param bool $notusedanymore No longer used. - * @return array|object row from block table, or all rows. + * @return array|object|false row from block table, or all rows. */ function blocks_get_record($blockid = NULL, $notusedanymore = false) { global $PAGE; diff --git a/lib/classes/collator.php b/lib/classes/collator.php index 374848497bf..10002bfc366 100644 --- a/lib/classes/collator.php +++ b/lib/classes/collator.php @@ -34,19 +34,19 @@ defined('MOODLE_INTERNAL') || die(); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class core_collator { - /** @var compare items using general PHP comparison, equivalent to Collator::SORT_REGULAR, this may bot be locale aware! */ + /** @var int compare items using general PHP comparison, equivalent to Collator::SORT_REGULAR, this may bot be locale aware! */ const SORT_REGULAR = 0; - /** @var compare items as strings, equivalent to Collator::SORT_STRING */ + /** @var int compare items as strings, equivalent to Collator::SORT_STRING */ const SORT_STRING = 1; - /** @var compare items as numbers, equivalent to Collator::SORT_NUMERIC */ + /** @var int compare items as numbers, equivalent to Collator::SORT_NUMERIC */ const SORT_NUMERIC = 2; - /** @var compare items like natsort(), equivalent to SORT_NATURAL */ + /** @var int compare items like natsort(), equivalent to SORT_NATURAL */ const SORT_NATURAL = 6; - /** @var do not ignore case when sorting, use bitwise "|" with SORT_NATURAL or SORT_STRING, equivalent to Collator::UPPER_FIRST */ + /** @var int do not ignore case when sorting, use bitwise "|" with SORT_NATURAL or SORT_STRING, equivalent to Collator::UPPER_FIRST */ const CASE_SENSITIVE = 64; /** @var Collator|false|null **/ diff --git a/lib/completionlib.php b/lib/completionlib.php index 3cda36ee2bb..ab7f7deac70 100644 --- a/lib/completionlib.php +++ b/lib/completionlib.php @@ -949,7 +949,7 @@ class completion_info { * Resetting state of manual tickbox has same result as deleting state for * it. * - * @param stcClass|cm_info $cm Activity + * @param stdClass|cm_info $cm Activity */ public function reset_all_state($cm) { global $DB; @@ -991,7 +991,7 @@ class completion_info { * fill the cache, retrieves information from the entire course not just for * this one activity * @param int $userid User ID or 0 (default) for current user - * @param null $unused This parameter has been deprecated since 4.0 and should not be used anymore. + * @param mixed $unused This parameter has been deprecated since 4.0 and should not be used anymore. * @return object Completion data. Record from course_modules_completion plus other completion statuses such as * - Completion status for 'must-receive-grade' completion rule. * - Custom completion statuses defined by the activity module plugin. @@ -1443,7 +1443,7 @@ class completion_info { * @param int $start User to start at if paging (optional) * @param context $extracontext If set, includes extra user information fields * as appropriate to display for current user in this context - * @return stdClass with ->total and ->start (same as $start) and ->users; + * @return array with ->total and ->start (same as $start) and ->users; * an array of user objects (like mdl_user id, firstname, lastname) * containing an additional ->progress array of coursemoduleid => completionstate */ @@ -1495,7 +1495,7 @@ class completion_info { * * @param stdClass|cm_info $cm Course-module for item that owns grade * @param grade_item $item Grade item - * @param stdClass $grade + * @param stdClass|grade_grade $grade * @param bool $deleted * @param bool $isbulkupdate If bulk grade update is happening. */ @@ -1590,7 +1590,6 @@ class completion_info { * This is to be used only for system errors (things that shouldn't happen) * and not user-level errors. * - * @global type $CFG * @param string $error Error string (will not be displayed to user unless debugging is enabled) * @throws moodle_exception Exception with the error string as debug info */ diff --git a/lib/componentlib.class.php b/lib/componentlib.class.php index e04d2bdf161..50d16743a4d 100644 --- a/lib/componentlib.class.php +++ b/lib/componentlib.class.php @@ -792,7 +792,7 @@ class lang_installer { * * @uses component_installer * @param string $langcode - * @return int return status + * @return string return status */ protected function install_language_pack($langcode) { diff --git a/lib/csvlib.class.php b/lib/csvlib.class.php index 00345879892..67d72f91297 100644 --- a/lib/csvlib.class.php +++ b/lib/csvlib.class.php @@ -190,7 +190,7 @@ class csv_import_reader { /** * Returns list of columns * - * @return array + * @return array|false */ public function get_columns() { if (isset($this->_columns)) { @@ -456,7 +456,7 @@ class csv_export_writer { * Echos or returns a csv data line by line for displaying. * * @param bool $return Set to true to return a string with the csv data. - * @return string csv data. + * @return ?string csv data. */ public function print_csv_data($return = false) { fseek($this->fp, 0); @@ -548,7 +548,7 @@ class csv_export_writer { * @param string $delimiter The name of the delimiter. Supported types(comma, tab, semicolon, colon, cfg) * @param string $enclosure How speical fields are enclosed. * @param bool $return If true will return a string with the csv data. - * @return string csv data. + * @return ?string csv data. */ public static function print_array(array &$records, $delimiter = 'comma', $enclosure = '"', $return = false) { $csvdata = new csv_export_writer($delimiter, $enclosure); diff --git a/lib/datalib.php b/lib/datalib.php index eac742b6ae2..43c0fd439f4 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -63,7 +63,7 @@ define('USER_SEARCH_EXACT_MATCH', 2); * Returns $user object of the main admin user * * @static stdClass $mainadmin - * @return stdClass {@link $USER} record from DB, false if not found + * @return stdClass|false {user} record from DB, false if not found */ function get_admin() { global $CFG, $DB; @@ -1205,7 +1205,7 @@ function increment_revision_number($table, $field, $select, array $params = null * * @global object * @param int $courseid The id of the course as found in the 'course' table. - * @return array + * @return array|false */ function get_course_mods($courseid) { global $DB; @@ -1236,7 +1236,7 @@ function get_course_mods($courseid) { * @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; * IGNORE_MULTIPLE means return first, ignore multiple records found(not recommended); * MUST_EXIST means throw exception if no record or multiple records found - * @return stdClass + * @return stdClass|false */ function get_coursemodule_from_id($modulename, $cmid, $courseid=0, $sectionnum=false, $strictness=IGNORE_MISSING) { global $DB; diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php index 5e9420a9227..a97f884217d 100644 --- a/lib/dml/moodle_database.php +++ b/lib/dml/moodle_database.php @@ -128,7 +128,7 @@ abstract class moodle_database { /** @var cache_application for column info */ protected $metacache; - /** @var cache_request for column info on temp tables */ + /** @var cache_application|cache_session|cache_store for column info on temp tables */ protected $metacachetemp; /** @var bool flag marking database instance as disposed */ @@ -188,7 +188,7 @@ abstract class moodle_database { * @param string $type Database driver's type. (eg: mysqli, pgsql, mssql, sqldrv, oci, etc.) * @param string $library Database driver's library (native, pdo, etc.) * @param bool $external True if this is an external database. - * @return moodle_database driver object or null if error, for example of driver object see {@link mysqli_native_moodle_database} + * @return ?moodle_database driver object or null if error, for example of driver object see {@see mysqli_native_moodle_database} */ public static function get_driver_instance($type, $library, $external = false) { global $CFG; @@ -380,7 +380,7 @@ abstract class moodle_database { /** * Returns transaction trace for debugging purposes. * @private to be used by core only - * @return array or null if not in transaction. + * @return ?array or null if not in transaction. */ public function get_transaction_start_backtrace() { if (!$this->transactions) { diff --git a/lib/dmllib.php b/lib/dmllib.php index 021241742d8..497a00f8d2e 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -269,8 +269,8 @@ class dml_transaction_exception extends dml_exception { /** * Constructor - * @param array $debuginfo Optional debugging information. - * @param moodle_transaction $transaction The instance of the transaction.(Optional) + * @param ?string $debuginfo Optional debugging information. + * @param ?moodle_transaction $transaction The instance of the transaction.(Optional) */ function __construct($debuginfo=null, $transaction=null) { $this->transaction = $transaction; // TODO: MDL-20625 use the info from $transaction for debugging purposes diff --git a/lib/enrollib.php b/lib/enrollib.php index cd2c2f77c54..d5015df6bc7 100644 --- a/lib/enrollib.php +++ b/lib/enrollib.php @@ -137,7 +137,7 @@ function enrol_get_plugins($enabled) { /** * Returns instance of enrol plugin * @param string $name name of enrol plugin ('manual', 'guest', ...) - * @return enrol_plugin + * @return ?enrol_plugin */ function enrol_get_plugin($name) { global $CFG; @@ -1476,7 +1476,7 @@ function is_enrolled(context $context, $user = null, $withcapability = '', $only * @param string|array $capability optional, may include a capability name, or array of names. * If an array is provided then this is the equivalent of a logical 'OR', * i.e. the user needs to have one of these capabilities. - * @param int|array $groupids The groupids, 0 or [] means all groups and USERSWITHOUTGROUP no group + * @param int|array|null $groupids The groupids, 0 or [] means all groups and USERSWITHOUTGROUP no group * @param bool $onlyactive consider only active enrolments in enabled plugins and time restrictions * @param bool $onlysuspended inverse of onlyactive, consider only suspended enrolments * @param int $enrolid The enrolment ID. If not 0, only users enrolled using this enrolment method will be returned. @@ -1528,7 +1528,7 @@ function get_enrolled_with_capabilities_join(context $context, $prefix = '', $ca * * @param context $context * @param string $withcapability - * @param int|array $groupids The groupids, 0 or [] means all groups and USERSWITHOUTGROUP no group + * @param int|array|null $groupids The groupids, 0 or [] means all groups and USERSWITHOUTGROUP no group * @param bool $onlyactive consider only active enrolments in enabled plugins and time restrictions * @param bool $onlysuspended inverse of onlyactive, consider only suspended enrolments * @param int $enrolid The enrolment ID. If not 0, only users enrolled using this enrolment method will be returned. @@ -1963,7 +1963,6 @@ abstract class enrol_plugin { * Sets plugin config value * @param string $name name of config * @param string $value string config value, null means delete - * @return string value */ public function set_config($name, $value) { $pluginname = $this->get_name(); @@ -2428,7 +2427,7 @@ abstract class enrol_plugin { /** * Returns link to page which may be used to add new instance of enrolment plugin in course. * @param int $courseid - * @return moodle_url page url + * @return ?moodle_url page url */ public function get_newinstance_link($courseid) { // override for most plugins, check if instance already exists in cases only one instance is supported @@ -2469,7 +2468,7 @@ abstract class enrol_plugin { * Does the access control tests automatically. * * @param object $instance - * @return moodle_url + * @return ?moodle_url */ public function get_manual_enrol_link($instance) { return NULL; @@ -2479,7 +2478,7 @@ abstract class enrol_plugin { * Returns list of unenrol links for all enrol instances in course. * * @param stdClass $instance - * @return moodle_url or NULL if self unenrolment not supported + * @return ?moodle_url or NULL if self unenrolment not supported */ public function get_unenrolself_link($instance) { global $USER, $CFG, $DB; @@ -2665,7 +2664,7 @@ abstract class enrol_plugin { * Not all plugins support this. * * @param object $course - * @return int id of new instance or null if no default supported + * @return ?int id of new instance or null if no default supported */ public function add_default_instance($course) { return null; diff --git a/lib/environmentlib.php b/lib/environmentlib.php index bafbda78a45..2dcd9fe4aa0 100644 --- a/lib/environmentlib.php +++ b/lib/environmentlib.php @@ -895,7 +895,7 @@ function environment_check_php($version, $env_select) { * Looks for buggy PCRE implementation, we need unicode support in Moodle... * @param string $version xml version we are going to use to test this server * @param int|string $env_select one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. String means plugin name. - * @return stdClass results encapsulated in one environment_result object, null if irrelevant + * @return ?environment_results results encapsulated in one environment_result object, null if irrelevant */ function environment_check_pcre_unicode($version, $env_select) { $result = new environment_results('pcreunicode'); @@ -1102,8 +1102,8 @@ function environment_check_database($version, $env_select) { * such bypass functions are able to directly handling the result object * although it should be only under exceptional conditions. * - * @param string xmldata containing the bypass data - * @param object result object to be updated + * @param array $xml xml containing the bypass data + * @param environment_results $result object to be updated * @return void */ function process_environment_bypass($xml, &$result) { @@ -1143,8 +1143,8 @@ function process_environment_bypass($xml, &$result) { * such restrict functions are able to directly handling the result object * although it should be only under exceptional conditions. * - * @param string xmldata containing the restrict data - * @param object result object to be updated + * @param array $xml xmldata containing the restrict data + * @param environment_results $result object to be updated * @return void */ function process_environment_restrict($xml, &$result) { @@ -1180,8 +1180,8 @@ function process_environment_restrict($xml, &$result) { * * @uses INCORRECT_FEEDBACK_FOR_REQUIRED * @uses INCORRECT_FEEDBACK_FOR_OPTIONAL - * @param string xmldata containing the feedback data - * @param object reult object to be updated + * @param array $xml xmldata containing the feedback data + * @param environment_results $result object to be updated */ function process_environment_messages($xml, &$result) { diff --git a/lib/external/classes/util.php b/lib/external/classes/util.php index e4083f3b544..d62ce8444d8 100644 --- a/lib/external/classes/util.php +++ b/lib/external/classes/util.php @@ -462,7 +462,7 @@ class util { * * @param string|null $content The string to be filtered. Should be plain text, expect * possibly for multilang tags. - * @param context $context The id of the context for the string or the context (affects filters). + * @param int|context $context The id of the context for the string or the context (affects filters). * @param boolean $striplinks To strip any link in the result text. Moodle 1.8 default changed from false to true! MDL-8713 * @param array $options options array/object or courseid * @return string text diff --git a/lib/externallib.php b/lib/externallib.php index b17375c43cf..4be88559154 100644 --- a/lib/externallib.php +++ b/lib/externallib.php @@ -92,7 +92,7 @@ function external_generate_token($tokentype, $serviceorid, $userid, $contextorid * * @param string $servicename name of the web service. Service name as defined in db/services.php * @param int $context context within which the web service can operate. - * @return int returns token id. + * @return string returns token id. * @since Moodle 2.0 */ function external_create_service_token($servicename, $contextid) { diff --git a/lib/filelib.php b/lib/filelib.php index a61384c1a4b..71e7daa06bb 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -482,7 +482,7 @@ function file_prepare_draft_area(&$draftitemid, $contextid, $component, $fileare * @param int $contextid This parameter and the next two identify the file area to use. * @param string $component * @param string $filearea helps identify the file area. - * @param int $itemid helps identify the file area. + * @param ?int $itemid helps identify the file area. * @param array $options * bool $options.forcehttps Force the user of https * bool $options.reverse Reverse the behaviour of the function @@ -926,7 +926,7 @@ function file_restore_source_field_from_draft_file($storedfile) { /** * Removes those files from the user drafts filearea which are not referenced in the editor text. * - * @param stdClass $editor The online text editor element from the submitted form data. + * @param array $editor The online text editor element from the submitted form data. */ function file_remove_editor_orphaned_files($editor) { global $CFG, $USER; @@ -1475,7 +1475,7 @@ function format_array_postdata_for_curlcall($arraydata, $currentdata, &$data) { * Transform a PHP array into POST parameter * (see the recursive function format_array_postdata_for_curlcall) * @param array $postdata - * @return array containing all POST parameters (1 row = 1 POST parameter) + * @return string containing all POST parameters (1 row = 1 POST parameter) */ function format_postdata_for_curlcall($postdata) { $data = array(); @@ -1860,7 +1860,7 @@ function mimeinfo_from_type($element, $mimetype) { * * @param stored_file|file_info|stdClass|array $file (in case of object attributes $file->filename * and $file->mimetype are expected) - * @param null $unused This parameter has been deprecated since 4.3 and should not be used anymore. + * @param mixed $unused This parameter has been deprecated since 4.3 and should not be used anymore. * @return string */ function file_file_icon($file, $unused = null) { @@ -1911,7 +1911,7 @@ function file_file_icon($file, $unused = null) { * echo $OUTPUT->pix_icon(file_folder_icon(), ''); * * - * @param null $unused This parameter has been deprecated since 4.3 and should not be used anymore. + * @param mixed $unused This parameter has been deprecated since 4.3 and should not be used anymore. * @return string */ function file_folder_icon($unused = null) { @@ -1940,7 +1940,7 @@ function file_folder_icon($unused = null) { * @todo MDL-31074 When an $OUTPUT->icon method is available this function should be altered * to conform with that. * @param string $mimetype The mimetype to fetch an icon for - * @param null $unused This parameter has been deprecated since 4.3 and should not be used anymore. + * @param mixed $unused This parameter has been deprecated since 4.3 and should not be used anymore. * @return string The relative path to the icon */ function file_mimetype_icon($mimetype, $unused = null) { @@ -1964,7 +1964,7 @@ function file_mimetype_icon($mimetype, $unused = null) { * @todo MDL-31074 Implement $size * @category files * @param string $filename The filename to get the icon for - * @param null $unused This parameter has been deprecated since 4.3 and should not be used anymore. + * @param mixed $unused This parameter has been deprecated since 4.3 and should not be used anymore. * @return string */ function file_extension_icon($filename, $unused = null) { @@ -3149,7 +3149,7 @@ class curl { private $cookie = false; /** @var bool tracks multiple headers in response - redirect detection */ private $responsefinished = false; - /** @var security helper class, responsible for checking host/ports against allowed/blocked entries.*/ + /** @var ?\core\files\curl_security_helper security helper class, responsible for checking host/ports against allowed/blocked entries.*/ private $securityhelper; /** @var bool ignoresecurity a flag which can be supplied to the constructor, allowing security to be bypassed. */ private $ignoresecurity; @@ -3177,7 +3177,7 @@ class curl { if (!function_exists('curl_init')) { $this->error = 'cURL module must be enabled!'; trigger_error($this->error, E_USER_ERROR); - return false; + return; } // All settings of this class should be init here. @@ -3379,7 +3379,7 @@ class curl { /** * Set HTTP Request Header * - * @param array $header + * @param array|string $header */ public function setHeader($header) { if (is_array($header)) { @@ -3719,7 +3719,7 @@ class curl { * This augments all installed plugin's security helpers if there is any. * * @param string $url the url to check. - * @return string - an error message if URL is blocked or null if URL is not blocked. + * @return ?string - an error message if URL is blocked or null if URL is not blocked. */ protected function check_securityhelper_blocklist(string $url): ?string { @@ -3761,7 +3761,7 @@ class curl { * * @param string $url The URL to request * @param array $options - * @return bool + * @return string */ protected function request($url, $options = array()) { // Reset here so that the data is valid when result returned from cache, or if we return due to a blocked URL hit. @@ -3969,7 +3969,7 @@ class curl { * * @param string $url * @param array $options - * @return bool + * @return string */ public function head($url, $options = array()) { $options['CURLOPT_HTTPGET'] = 0; @@ -3984,7 +3984,7 @@ class curl { * @param string $url * @param array|string $params * @param array $options - * @return bool + * @return string */ public function patch($url, $params = '', $options = array()) { $options['CURLOPT_CUSTOMREQUEST'] = 'PATCH'; @@ -4012,7 +4012,7 @@ class curl { * @param string $url * @param array|string $params * @param array $options - * @return bool + * @return string */ public function post($url, $params = '', $options = array()) { $options['CURLOPT_POST'] = 1; @@ -4038,9 +4038,9 @@ class curl { * HTTP GET method * * @param string $url - * @param array $params + * @param ?array $params * @param array $options - * @return bool + * @return string */ public function get($url, $params = array(), $options = array()) { $options['CURLOPT_HTTPGET'] = 1; @@ -4113,7 +4113,7 @@ class curl { * @param string $url * @param array $params * @param array $options - * @return bool + * @return ?string */ public function put($url, $params = array(), $options = array()) { $file = ''; @@ -4150,7 +4150,7 @@ class curl { * @param string $url * @param array $param * @param array $options - * @return bool + * @return string */ public function delete($url, $param = array(), $options = array()) { $options['CURLOPT_CUSTOMREQUEST'] = 'DELETE'; @@ -4166,7 +4166,7 @@ class curl { * * @param string $url * @param array $options - * @return bool + * @return string */ public function trace($url, $options = array()) { $options['CURLOPT_CUSTOMREQUEST'] = 'TRACE'; @@ -4179,7 +4179,7 @@ class curl { * * @param string $url * @param array $options - * @return bool + * @return string */ public function options($url, $options = array()) { $options['CURLOPT_CUSTOMREQUEST'] = 'OPTIONS'; diff --git a/lib/filestorage/file_exceptions.php b/lib/filestorage/file_exceptions.php index 7639810933f..09eba433d78 100644 --- a/lib/filestorage/file_exceptions.php +++ b/lib/filestorage/file_exceptions.php @@ -37,7 +37,7 @@ class file_exception extends moodle_exception { * Constructor * * @param string $errorcode error code - * @param stdClass $a Extra words and phrases that might be required in the error string + * @param mixed $a Extra words and phrases that might be required in the error string * @param string $debuginfo optional debugging information */ function __construct($errorcode, $a=NULL, $debuginfo = NULL) { @@ -129,7 +129,7 @@ class file_reference_exception extends file_exception { /** * Constructor. * - * @param int $repositoryid the id of the repository that provides the referenced file + * @param ?int $repositoryid the id of the repository that provides the referenced file * @param string $reference the information for the repository to locate the file * @param int|null $referencefileid the id of the record in {files_reference} if known * @param int|null $fileid the id of the referrer's record in {files} if known diff --git a/lib/filestorage/file_storage.php b/lib/filestorage/file_storage.php index 5f2555f8187..25796e2fdaa 100644 --- a/lib/filestorage/file_storage.php +++ b/lib/filestorage/file_storage.php @@ -1929,7 +1929,7 @@ class file_storage { /** * When user referring to a moodle file, we build the reference field * - * @param array $params + * @param array|stdClass $params * @return string */ public static function pack_reference($params) { diff --git a/lib/filterlib.php b/lib/filterlib.php index bc010e92614..74770ddb34d 100644 --- a/lib/filterlib.php +++ b/lib/filterlib.php @@ -140,7 +140,7 @@ class filter_manager { * @param string $filtername The filter name, for example 'tex'. * @param context $context context object. * @param array $localconfig array of local configuration variables for this filter. - * @return moodle_text_filter The filter, or null, if this type of filter is + * @return ?moodle_text_filter The filter, or null, if this type of filter is * not recognised or could not be created. */ protected function make_filter_object($filtername, $context, $localconfig) { diff --git a/lib/form/filemanager.php b/lib/form/filemanager.php index 79473a89a50..c8422d94aa0 100644 --- a/lib/form/filemanager.php +++ b/lib/form/filemanager.php @@ -63,7 +63,7 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element implements temp * @param string $elementLabel (optional) filemanager label * @param array $attributes (optional) Either a typical HTML attribute string * or an associative array - * @param array $options set of options to initalize filemanager + * @param array|stdClass $options set of options to initalize filemanager */ public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=null) { global $CFG, $PAGE; diff --git a/lib/form/group.php b/lib/form/group.php index aa5132b648c..19c1a2dc9c9 100644 --- a/lib/form/group.php +++ b/lib/form/group.php @@ -159,6 +159,7 @@ class MoodleQuickForm_group extends HTML_QuickForm_group implements templatable * @param string $event Name of event * @param mixed $arg event arguments * @param mixed $caller calling object + * @return ?bool */ public function onQuickFormEvent($event, $arg, &$caller) { $this->setMoodleForm($caller); diff --git a/lib/formslib.php b/lib/formslib.php index 5c9667dfbd0..30f291d659a 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -1519,7 +1519,7 @@ abstract class moodleform { * @param array $simulatedsubmitteddata An associative array of form values (same format as $_POST). * @param array $simulatedsubmittedfiles An associative array of files uploaded (same format as $_FILES). Can be omitted. * @param string $method 'post' or 'get', defaults to 'post'. - * @param null $formidentifier the default is to use the class name for this class but you may need to provide + * @param ?string $formidentifier the default is to use the class name for this class but you may need to provide * a different value here for some forms that are used more than once on the * same page. */ diff --git a/lib/gdlib.php b/lib/gdlib.php index bd69ece35fa..5dad53fb714 100644 --- a/lib/gdlib.php +++ b/lib/gdlib.php @@ -43,7 +43,7 @@ defined('MOODLE_INTERNAL') || die(); * @param int $dst_h the height of the destination rectangle * @param int $src_w the width of the source rectangle * @param int $src_h the height of the source rectangle - * @return bool tru on success, false otherwise + * @return ?bool tru on success, false otherwise */ function imagecopybicubic($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) { global $CFG; diff --git a/lib/googleapi.php b/lib/googleapi.php index b6b04725830..a1ce4024591 100644 --- a/lib/googleapi.php +++ b/lib/googleapi.php @@ -250,7 +250,7 @@ class google_oauth extends oauth2_client { * @param string $url The URL to request * @param array $options * @param mixed $acceptheader Not used. - * @return bool + * @return string */ protected function request($url, $options = array(), $acceptheader = 'application/json') { return parent::request($url, $options, false); diff --git a/lib/grade/grade_grade.php b/lib/grade/grade_grade.php index e0a768466d9..d4ba86d0941 100644 --- a/lib/grade/grade_grade.php +++ b/lib/grade/grade_grade.php @@ -265,7 +265,7 @@ class grade_grade extends grade_object { /** * Loads the grade_item object referenced by $this->itemid and saves it as $this->grade_item for easy access * - * @return grade_item The grade_item instance referenced by $this->itemid + * @return ?grade_item The grade_item instance referenced by $this->itemid */ public function load_grade_item() { if (empty($this->itemid)) { @@ -449,7 +449,7 @@ class grade_grade extends grade_object { /** * Returns timestamp when last graded, null if no grade present * - * @return int + * @return ?int */ public function get_dategraded() { //TODO: HACK - create new fields (MDL-31379) @@ -712,7 +712,7 @@ class grade_grade extends grade_object { * @param float $source_max * @param float $target_min * @param float $target_max - * @return float Converted value + * @return ?float Converted value */ public static function standardise_score($rawgrade, $source_min, $source_max, $target_min, $target_max) { if (is_null($rawgrade)) { @@ -743,7 +743,7 @@ class grade_grade extends grade_object { * * @param array $dependson Array to flatten * @param array $dependencydepth Array of itemids => depth. Initially these should be all set to 1. - * @return array Flattened array + * @return bool|null */ protected static function flatten_dependencies_array(&$dependson, &$dependencydepth) { // Flatten the nested dependencies - this will handle recursion bombs because it removes duplicates. @@ -1030,7 +1030,7 @@ class grade_grade extends grade_object { * Returns true if the grade's value is superior or equal to the grade item's gradepass value, false otherwise. * * @param grade_item $grade_item An optional grade_item of which gradepass value we can use, saves having to load the grade_grade's grade_item - * @return bool + * @return ?bool */ public function is_passed($grade_item = null) { if (empty($grade_item)) { diff --git a/lib/gradelib.php b/lib/gradelib.php index 936fc135c8b..770a233ab83 100644 --- a/lib/gradelib.php +++ b/lib/gradelib.php @@ -380,7 +380,7 @@ function grade_needs_regrade_progress_bar($courseid) { * * @param stdClass $course The course to regrade * @param callable $callback A function to call if regrading took place - * @return moodle_url The URL to redirect to if redirecting + * @return moodle_url|false The URL to redirect to if redirecting */ function grade_regrade_final_grades_if_required($course, callable $callback = null) { global $PAGE, $OUTPUT; diff --git a/lib/grouplib.php b/lib/grouplib.php index 63a65da6626..d232327d036 100644 --- a/lib/grouplib.php +++ b/lib/grouplib.php @@ -145,7 +145,7 @@ function groups_get_group_by_name($courseid, $name) { * @category group * @param int $courseid The id of the course * @param string $idnumber idnumber of group - * @return group object + * @return stdClass|false group object */ function groups_get_group_by_idnumber($courseid, $idnumber) { if (empty($idnumber)) { @@ -186,7 +186,7 @@ function groups_get_grouping_by_name($courseid, $name) { * @category group * @param int $courseid The id of the course * @param string $idnumber idnumber of the group - * @return grouping object + * @return stdClass|false grouping object */ function groups_get_grouping_by_idnumber($courseid, $idnumber) { if (empty($idnumber)) { diff --git a/lib/modinfolib.php b/lib/modinfolib.php index 6531d775d6f..c01c46a755b 100644 --- a/lib/modinfolib.php +++ b/lib/modinfolib.php @@ -350,7 +350,7 @@ class course_modinfo { * Gets data about specific numbered section. * @param int $sectionnumber Number (not id) of section * @param int $strictness Use MUST_EXIST to throw exception if it doesn't - * @return section_info Information for numbered section or null if not found + * @return ?section_info Information for numbered section or null if not found */ public function get_section_info($sectionnumber, $strictness = IGNORE_MISSING) { if (!array_key_exists($sectionnumber, $this->sectioninfobynum)) { @@ -1991,7 +1991,7 @@ class cm_info implements IteratorAggregate { * Returns a localised human-readable name of the module type. * * @param bool $plural If true, the function returns the plural form of the name. - * @return lang_string + * @return ?lang_string */ public function get_module_type_name($plural = false) { $modnames = get_module_types_names($plural); @@ -2312,9 +2312,9 @@ class cm_info implements IteratorAggregate { * Constructor should not be called directly; use {@link get_fast_modinfo()} * * @param course_modinfo $modinfo Parent object - * @param stdClass $notused1 Argument not used + * @param mixed $notused1 Argument not used * @param stdClass $mod Module object from the modinfo field of course table - * @param stdClass $notused2 Argument not used + * @param mixed $notused2 Argument not used */ public function __construct(course_modinfo $modinfo, $notused1, $mod, $notused2) { $this->modinfo = $modinfo; @@ -3245,10 +3245,10 @@ class section_info implements IteratorAggregate { * Constructs object from database information plus extra required data. * @param object $data Array entry from cached sectioncache * @param int $number Section number (array key) - * @param int $notused1 argument not used (informaion is available in $modinfo) - * @param int $notused2 argument not used (informaion is available in $modinfo) + * @param mixed $notused1 argument not used (informaion is available in $modinfo) + * @param mixed $notused2 argument not used (informaion is available in $modinfo) * @param course_modinfo $modinfo Owner (needed for checking availability) - * @param int $notused3 argument not used (informaion is available in $modinfo) + * @param mixed $notused3 argument not used (informaion is available in $modinfo) */ public function __construct($data, $number, $notused1, $notused2, $modinfo, $notused3) { global $CFG; @@ -3339,7 +3339,7 @@ class section_info implements IteratorAggregate { * or availability information or additional properties added by course format * * @param string $name name of the property - * @return bool + * @return mixed */ public function __get($name) { if (isset(self::$standardproperties[$name])) { diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 22b56caf6f7..6ce7c9d39b9 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -915,7 +915,8 @@ function html_is_blank($string) { * NOTE: this function is called from lib/db/upgrade.php * * @param string $name the key to set - * @param string $value the value to set (without magic quotes) + * @param string|int|bool|null $value the value to set (without magic quotes), + * null to unset the value * @param string $plugin (optional) the plugin scope, default null * @return bool true or exception */ @@ -1454,7 +1455,7 @@ function mark_user_preferences_changed($userid) { * @category preference * @access public * @param string $name The key to set as preference for the specified user - * @param string $value The value to set for the $name key in the specified user's + * @param string|int|bool|null $value The value to set for the $name key in the specified user's * record, null means delete current value. * @param stdClass|int|null $user A moodle user object or id, null means current user * @throws coding_exception @@ -6232,7 +6233,7 @@ function email_is_not_allowed($email) { /** * Returns local file storage instance * - * @return file_storage + * @return ?file_storage */ function get_file_storage($reset = false) { global $CFG; @@ -6280,7 +6281,7 @@ function get_file_browser() { * Returns file packer * * @param string $mimetype default application/zip - * @return file_packer + * @return file_packer|false */ function get_file_packer($mimetype='application/zip') { global $CFG; @@ -6394,7 +6395,7 @@ function get_max_upload_file_size($sitebytes=0, $coursebytes=0, $modulebytes=0, * @param int $sitebytes Set maximum size * @param int $coursebytes Current course $course->maxbytes (in bytes) * @param int $modulebytes Current module ->maxbytes (in bytes) - * @param stdClass $user The user + * @param stdClass|int|null $user The user * @param bool $unused This parameter has been deprecated and is not used any more. * @return int The maximum size for uploading files. */ @@ -10078,7 +10079,7 @@ function get_mnet_environment() { * during xmlrpc server code execution, any code wishing to access * information about the remote peer must use this to get it. * - * @return mnet_remote_client the equivalent of old $MNETREMOTE_CLIENT global + * @return mnet_remote_client|false the equivalent of old $MNETREMOTE_CLIENT global */ function get_mnet_remote_client() { if (!defined('MNET_SERVER')) { @@ -10458,7 +10459,7 @@ class lang_string { * string properties... the string cannot be regenerated so we need to ensure * it is generated for this. * - * @return string + * @return array */ public function __sleep() { $this->get_string(); diff --git a/lib/myprofilelib.php b/lib/myprofilelib.php index 7917898a0f3..71b86242389 100644 --- a/lib/myprofilelib.php +++ b/lib/myprofilelib.php @@ -31,8 +31,6 @@ defined('MOODLE_INTERNAL') || die(); * @param stdClass $user user object * @param bool $iscurrentuser is the user viewing profile, current user ? * @param stdClass $course course object - * - * @return bool */ function core_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) { global $CFG, $USER, $DB, $PAGE, $OUTPUT; diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 09cfc188f1e..faa07ae5c07 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -372,7 +372,7 @@ class navigation_node implements renderable { * * @param string $text * @param moodle_url|action_link|string $action - * @param int $type + * @param ?int $type * @param string $shorttext * @param string|int $key * @param pix_icon $icon @@ -443,7 +443,7 @@ class navigation_node implements renderable { * use the get method instead. * * @param int|string $key The key of the node we are looking for - * @param int $type One of navigation_node::TYPE_* + * @param ?int $type One of navigation_node::TYPE_* * @return navigation_node|false */ public function find($key, $type) { @@ -1165,7 +1165,7 @@ class navigation_node_collection implements IteratorAggregate, Countable { * * @param string|int $key The key of the node we want to find. * @param int $type One of navigation_node::TYPE_*. - * @return navigation_node|null + * @return navigation_node|null|false */ public function get($key, $type=null) { if ($type !== null) { @@ -1969,7 +1969,7 @@ class global_navigation extends navigation_node { * @param int $categoryid The category id to load or null/0 to load all base level categories * @param bool $showbasecategories If set to true all base level categories will be loaded as well * as the requested category and any parent categories. - * @return navigation_node|void returns a navigation node if a category has been loaded. + * @return true|void */ protected function load_all_categories($categoryid = self::LOAD_ROOT_CATEGORIES, $showbasecategories = false) { global $CFG, $DB; @@ -3205,7 +3205,7 @@ class global_navigation extends navigation_node { * may be of more use to you. * * @param string|int $key The key of the node you wish to receive. - * @param int $type One of navigation_node::TYPE_* + * @param ?int $type One of navigation_node::TYPE_* * @return navigation_node|false */ public function find($key, $type) { @@ -3656,7 +3656,7 @@ class navbar extends navigation_node { global $CFG; if (during_initial_install()) { $this->duringinstall = true; - return false; + return; } $this->page = $page; $this->text = get_string('home'); @@ -4174,7 +4174,7 @@ class flat_navigation extends navigation_node_collection { */ public function __construct(moodle_page &$page) { if (during_initial_install()) { - return false; + return; } debugging("Flat navigation has been deprecated in favour of primary/secondary navigation concepts"); $this->page = $page; @@ -4327,7 +4327,7 @@ class settings_navigation extends navigation_node { */ public function __construct(moodle_page &$page) { if (during_initial_install()) { - return false; + return; } $this->page = $page; // Initialise the main navigation. It is most important that this is done diff --git a/lib/oauthlib.php b/lib/oauthlib.php index 00950048581..9a8bc8f150d 100644 --- a/lib/oauthlib.php +++ b/lib/oauthlib.php @@ -639,7 +639,7 @@ abstract class oauth2_client extends curl { * @param string $url The URL to request * @param array $options * @param mixed $acceptheader mimetype (as string) or false to skip sending an accept header. - * @return bool + * @return string */ protected function request($url, $options = array(), $acceptheader = 'application/json') { $murl = new moodle_url($url); diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index ea031e1b0dc..932b760a1b9 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -494,7 +494,7 @@ class help_icon implements renderable, templatable { * Export this data so it can be used as the context for a mustache template. * * @param renderer_base $output Used to do a final render of any components that need to be rendered for export. - * @return array + * @return stdClass */ public function export_for_template(renderer_base $output) { global $CFG; @@ -1135,7 +1135,7 @@ class single_select implements renderable, templatable { * @param string $name name of selection field - the changing parameter in url * @param array $options list of options * @param string $selected selected element - * @param array $nothing + * @param ?array $nothing * @param string $formid */ public function __construct(moodle_url $url, $name, array $options, $selected = '', $nothing = array('' => 'choosedots'), $formid = null) { @@ -1438,7 +1438,7 @@ class url_select implements renderable, templatable { * Clean a URL. * * @param string $value The URL. - * @return The cleaned URL. + * @return string The cleaned URL. */ protected function clean_url($value) { global $CFG; @@ -1849,7 +1849,7 @@ class html_writer { * Generates random html element id. * * @staticvar int $counter - * @staticvar type $uniq + * @staticvar string $uniq * @param string $base A string fragment that will be included in the random ID. * @return string A unique ID */ @@ -1941,7 +1941,7 @@ class html_writer { * array(1=>'One', '--1uniquekey'=>array('More'=>array(2=>'Two', 3=>'Three'))) * @param string $name name of select element * @param string|array $selected value or array of values depending on multiple attribute - * @param array|bool $nothing add nothing selected option, or false of not added + * @param array|bool|null $nothing add nothing selected option, or false of not added * @param array $attributes html select element attributes * @return string HTML fragment */ @@ -3771,7 +3771,7 @@ class custom_menu_item implements renderable, templatable { * Export this data so it can be used as the context for a mustache template. * * @param renderer_base $output Used to do a final render of any components that need to be rendered for export. - * @return array + * @return stdClass */ public function export_for_template(renderer_base $output) { $syscontext = context_system::instance(); @@ -4482,7 +4482,7 @@ class action_menu implements renderable, templatable { /** * Adds an action to this action menu. * - * @param action_menu_link|pix_icon|subpanel|string $action + * @param action_link|pix_icon|subpanel|string $action */ public function add($action) { diff --git a/lib/outputlib.php b/lib/outputlib.php index 63e2376b57a..3fdc780118d 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -558,7 +558,7 @@ class theme_config { public $doctype = 'html5'; /** - * @var string requiredblocks If set to a string, will list the block types that cannot be deleted. Defaults to + * @var string|false requiredblocks If set to a string, will list the block types that cannot be deleted. Defaults to * navigation and settings. */ public $requiredblocks = false; @@ -1686,7 +1686,7 @@ class theme_config { * the stylesheet for the theme. It will look at parents themes and check the * SCSS properties there. * - * @return False when SCSS is not used. + * @return array|false False when SCSS is not used. * An array with the import paths, and the path to the SCSS file or Closure as second. */ public function get_scss_property() { @@ -1927,7 +1927,7 @@ class theme_config { /** * Flip a stylesheet to RTL. * - * @param Object $csstree The parsed CSS tree structure to flip. + * @param mixed $csstree The parsed CSS tree structure to flip. * @return void */ protected function rtlize($csstree) { @@ -2120,7 +2120,7 @@ class theme_config { * * @param string $image name of image, may contain relative path * @param string $component - * @param bool $svg|null Should SVG images also be looked for? If null, falls back to auto-detection of browser support + * @param bool|null $svg Should SVG images also be looked for? If null, falls back to auto-detection of browser support * @return string full file path */ public function resolve_image_location($image, $component, $svg = false) { @@ -2368,7 +2368,7 @@ class theme_config { * @param string $themename * @param stdClass $settings from config_plugins table * @param boolean $parentscheck true to also check the parents. . - * @return stdClass The theme configuration + * @return ?stdClass The theme configuration */ private static function find_theme_config($themename, $settings, $parentscheck = true) { // We have to use the variable name $THEME (upper case) because that @@ -2691,7 +2691,7 @@ class xhtml_container_stack { * warning will be output. * * @param string $type The type of container. - * @return string the HTML required to close the container. + * @return ?string the HTML required to close the container. */ public function pop($type) { if (empty($this->opencontainers)) { diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 0fef2261c53..e2bde4a322c 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -1904,7 +1904,7 @@ class core_renderer extends renderer_base { /** * Renders a primary action_menu_filler item. * - * @param action_menu_link_filler $action + * @param action_menu_filler $action * @return string HTML fragment */ protected function render_action_menu_filler(action_menu_filler $action) { @@ -2935,7 +2935,7 @@ EOD; * * @param moodle_url $url The URL + params to send through when clicking the button * @param string $method - * @return string HTML the button + * @return ?string HTML the button */ public function edit_button(moodle_url $url, string $method = 'post') { @@ -2957,7 +2957,7 @@ EOD; /** * Create a navbar switch for toggling editing mode. * - * @return string Html containing the edit switch + * @return ?string Html containing the edit switch */ public function edit_switch() { if ($this->page->user_allowed_editing()) { @@ -5104,7 +5104,7 @@ EOD; /** * Render the login signup form into a nice template for the theme. * - * @param mform $form + * @param moodleform $form * @return string */ public function render_login_signup_form($form) { @@ -5205,7 +5205,7 @@ EOD; /** * Renders release information in the footer popup - * @return string Moodle release info. + * @return ?string Moodle release info. */ public function moodle_release() { global $CFG; @@ -5410,7 +5410,7 @@ class core_renderer_cli extends core_renderer { /** * Renders a Check API result * - * @param result $result + * @param core\check\result $result * @return string fragment */ public function check_result(core\check\result $result) { @@ -5898,7 +5898,7 @@ class core_renderer_maintenance extends core_renderer { /** * Does nothing. The maintenance renderer has no need for login information. * - * @param null $withlinks + * @param mixed $withlinks * @return string */ public function login_info($withlinks = null) { diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index fac5d701600..6ca4c759613 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -1867,9 +1867,9 @@ class YUI_config { /** * Create a new group within the YUI_config system. * - * @param String $name The name of the group. This must be unique and + * @param string $name The name of the group. This must be unique and * not previously used. - * @param Array $config The configuration for this group. + * @param array $config The configuration for this group. * @return void */ public function add_group($name, $config) { @@ -1885,9 +1885,9 @@ class YUI_config { * Note, any existing configuration for that group will be wiped out. * This includes module configuration. * - * @param String $name The name of the group. This must be unique and + * @param string $name The name of the group. This must be unique and * not previously used. - * @param Array $config The configuration for this group. + * @param array $config The configuration for this group. * @return void */ public function update_group($name, $config) { @@ -1906,7 +1906,7 @@ class YUI_config { * name of the module being loaded. * * @param $function String the body of the JavaScript function. This should be used i - * @return String the name of the function to use in the group pattern configuration. + * @return string the name of the function to use in the group pattern configuration. */ public function set_config_function($function) { $configname = 'yui' . (count($this->jsconfigfunctions) + 1) . 'ConfigFn'; @@ -1924,7 +1924,7 @@ class YUI_config { * When jsrev is positive, the function is minified and stored in a MUC cache for subsequent uses. * * @param $file The path to the JavaScript function used for YUI configuration. - * @return String the name of the function to use in the group pattern configuration. + * @return string the name of the function to use in the group pattern configuration. */ public function set_config_source($file) { global $CFG; @@ -1950,7 +1950,7 @@ class YUI_config { /** * Retrieve the list of JavaScript functions for YUI_config groups. * - * @return String The complete set of config functions + * @return string The complete set of config functions */ public function get_config_functions() { $configfunctions = ''; @@ -1966,7 +1966,7 @@ class YUI_config { * Update the header JavaScript with any required modification for the YUI Loader. * * @param $js String The JavaScript to manipulate. - * @return String the modified JS string. + * @return string the modified JS string. */ public function update_header_js($js) { // Update the names of the the configFn variables. @@ -1981,9 +1981,9 @@ class YUI_config { /** * Add configuration for a specific module. * - * @param String $name The name of the module to add configuration for. - * @param Array $config The configuration for the specified module. - * @param String $group The name of the group to add configuration for. + * @param string $name The name of the module to add configuration for. + * @param array $config The configuration for the specified module. + * @param string $group The name of the group to add configuration for. * If not specified, then this module is added to the global * configuration. * @return void @@ -2047,7 +2047,7 @@ class YUI_config { * This works through all modules capable of serving YUI modules, and attempts to get * metadata for each of those modules. * - * @return Array of module metadata + * @return array of module metadata */ private function get_moodle_metadata() { $moodlemodules = array(); @@ -2084,8 +2084,8 @@ class YUI_config { /** * Helper function process and return the YUI metadata for all of the modules under the specified path. * - * @param String $path the UNC path to the YUI src directory. - * @return Array the complete array for frankenstyle directory. + * @param string $path the UNC path to the YUI src directory. + * @return array the complete array for frankenstyle directory. */ private function get_moodle_path_metadata($path) { // Add module metadata is stored in frankenstyle_modname/yui/src/yui_modname/meta/yui_modname.json. @@ -2114,10 +2114,10 @@ class YUI_config { * We must do this because we aggressively cache content on the browser, and we must also override use of the * external CDN which will serve the true authoritative copy of the code without our patches. * - * @param String combobase The local combobase - * @param String yuiversion The current YUI version - * @param Int patchlevel The patch level we're working to for YUI - * @param Array patchedmodules An array containing the names of the patched modules + * @param string $combobase The local combobase + * @param string $yuiversion The current YUI version + * @param int $patchlevel The patch level we're working to for YUI + * @param array $patchedmodules An array containing the names of the patched modules * @return void */ public function define_patched_core_modules($combobase, $yuiversion, $patchlevel, $patchedmodules) { diff --git a/lib/pagelib.php b/lib/pagelib.php index fc2c57cb2a0..cd649a39d7a 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -1183,7 +1183,7 @@ class moodle_page { /** * Set the main context to which this page belongs. * - * @param context $context a context object. You normally get this with context_xxxx::instance(). + * @param ?context $context a context object. You normally get this with context_xxxx::instance(). */ public function set_context($context) { if ($context === null) { @@ -1892,8 +1892,6 @@ class moodle_page { /** * Reset the theme and output for a new context. This only makes sense from * external::validate_context(). Do not cheat. - * - * @return string the name of the theme that should be used on this page. */ public function reset_theme_and_output() { global $COURSE, $SITE; diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index 7e4b275f16a..b38afa78d5a 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -1045,7 +1045,7 @@ function portfolio_expected_time_db($recordcount) { * Function to send portfolio report to admins * * @param array $insane array of insane plugins - * @param array $instances (optional) if reporting instances rather than whole plugins + * @param bool $instances (optional) if reporting instances rather than whole plugins */ function portfolio_insane_notify_admins($insane, $instances=false) { diff --git a/lib/questionlib.php b/lib/questionlib.php index f1bb8c79c50..bffcd5389c6 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -495,7 +495,7 @@ function question_delete_course_category($category, $newcategory, $notused=false * Creates a new category to save the questions in use. * * @param array $questionids of question ids - * @param object $newcontextid the context to create the saved category in. + * @param int $newcontextid the context to create the saved category in. * @param string $oldplace a textual description of the think being deleted, * e.g. from get_context_name * @param object $newcategory @@ -1506,7 +1506,7 @@ function question_require_capability_on($question, $cap): bool { * Gets the question edit url. * * @param object $context a context - * @return string|bool A URL for editing questions in this context. + * @return string|bool|void A URL for editing questions in this context. */ function question_edit_url($context) { global $CFG, $SITE; diff --git a/lib/recaptchalib_v2.php b/lib/recaptchalib_v2.php index 87f7063f34d..1de8f176b28 100644 --- a/lib/recaptchalib_v2.php +++ b/lib/recaptchalib_v2.php @@ -144,7 +144,7 @@ function recaptcha_get_challenge_html($apiurl, $pubkey, $lang = null, bool $comp * @param string $privkey The private key for reCAPTCHA * @param string $remoteip The user's IP * @param string $response The response from reCAPTCHA - * @return ReCaptchaResponse + * @return array */ function recaptcha_check_response($verifyurl, $privkey, $remoteip, $response) { global $CFG; diff --git a/lib/setuplib.php b/lib/setuplib.php index 9d3808c6050..5d7669d98ac 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -2084,10 +2084,10 @@ class bootstrap_renderer { * Returns nicely formatted error message in a div box. * @static * @param string $message error message - * @param string $moreinfourl (ignored in early errors) - * @param string $link (ignored in early errors) - * @param array $backtrace - * @param string $debuginfo + * @param ?string $moreinfourl (ignored in early errors) + * @param ?string $link (ignored in early errors) + * @param ?array $backtrace + * @param ?string $debuginfo * @return string */ public static function early_error_content($message, $moreinfourl, $link, $backtrace, $debuginfo = null) { @@ -2129,7 +2129,7 @@ class bootstrap_renderer { * @param string $link (ignored in early errors) * @param array $backtrace * @param string $debuginfo extra information for developers - * @return string + * @return ?string */ public static function early_error($message, $moreinfourl, $link, $backtrace, $debuginfo = null, $errorcode = null) { global $CFG; diff --git a/lib/statslib.php b/lib/statslib.php index b8421b586f6..f4f8421839f 100644 --- a/lib/statslib.php +++ b/lib/statslib.php @@ -1026,7 +1026,7 @@ function stats_get_base_monthly($time=0) { /** * Start of next day * @param int $time timestamp - * @return start of next day + * @return int start of next day */ function stats_get_next_day_start($time) { $next = stats_get_base_daily($time); @@ -1039,7 +1039,7 @@ function stats_get_next_day_start($time) { /** * Start of next week * @param int $time timestamp - * @return start of next week + * @return int start of next week */ function stats_get_next_week_start($time) { $next = stats_get_base_weekly($time); @@ -1052,7 +1052,7 @@ function stats_get_next_week_start($time) { /** * Start of next month * @param int $time timestamp - * @return start of next month + * @return int start of next month */ function stats_get_next_month_start($time) { $next = stats_get_base_monthly($time); @@ -1457,7 +1457,7 @@ function stats_get_report_options($courseid,$mode) { * @param string $timestr type of statistics to generate (dayly, weekly, monthly). * @param boolean $line2 * @param boolean $line3 - * @return array of fixed statistics. + * @return ?array of fixed statistics. */ function stats_fix_zeros($stats,$timeafter,$timestr,$line2=true,$line3=false) { diff --git a/lib/tablelib.php b/lib/tablelib.php index fcbab0ad5f4..d7b032ceaae 100644 --- a/lib/tablelib.php +++ b/lib/tablelib.php @@ -704,7 +704,7 @@ class flexible_table { } /** - * @return string sql to add to where statement. + * @return array sql to add to where statement. */ function get_sql_where() { global $DB; diff --git a/lib/weblib.php b/lib/weblib.php index cbaaeca17f7..ff3cf6ec8b8 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -819,7 +819,7 @@ class moodle_url { * @param int $contextid * @param string $component * @param string $area - * @param int $itemid + * @param ?int $itemid * @param string $pathname * @param string $filename * @param bool $forcedownload @@ -1446,7 +1446,7 @@ function reset_text_filters_cache($phpunitreset = false) { * @staticvar bool $strcache * @param string $string The string to be filtered. Should be plain text, expect * possibly for multilang tags. - * @param boolean $striplinks To strip any link in the result text. Moodle 1.8 default changed from false to true! MDL-8713 + * @param ?bool $striplinks To strip any link in the result text. Moodle 1.8 default changed from false to true! MDL-8713 * @param array $options options array/object or courseid * @return string */ @@ -2643,7 +2643,7 @@ function print_group_picture($group, $courseid, $large = false, $return = false, * user whose id is the value indicated. * If the group picture is included in an e-mail or some other location where the audience is a specific * user who will not be logged in when viewing, then we use a token to authenticate the user. - * @return moodle_url Returns the url for the group picture. + * @return ?moodle_url Returns the url for the group picture. */ function get_group_picture_url($group, $courseid, $large = false, $includetoken = false) { global $CFG; @@ -2678,7 +2678,7 @@ function get_group_picture_url($group, $courseid, $large = false, $includetoken * @param string $link The link to wrap around the text * @param bool $return If set to true the HTML is returned rather than echo'd * @param string $viewfullnames - * @return string If $retrun was true returns HTML for a recent activity notice. + * @return ?string If $retrun was true returns HTML for a recent activity notice. */ function print_recent_activity_note($time, $user, $text, $link, $return=false, $viewfullnames=null) { static $strftimerecent = null; @@ -2813,7 +2813,7 @@ function navmenulist($course, $sections, $modinfo, $strsection, $strjumpto, $wid * @param string $current * @param boolean $includenograde Include those with no grades * @param boolean $return If set to true returns rather than echo's - * @return string|bool Depending on value of $return + * @return string|bool|null Depending on value of $return */ function print_grade_menu($courseid, $name, $current, $includenograde=true, $return=false) { global $OUTPUT; diff --git a/lib/xmlize.php b/lib/xmlize.php index c60fa3f9dfc..dcd5e6f05a9 100644 --- a/lib/xmlize.php +++ b/lib/xmlize.php @@ -42,14 +42,14 @@ defined('MOODLE_INTERNAL') || die(); class xml_format_exception extends moodle_exception { /** @var string */ public $errorstring; - /** @var char */ + /** @var string */ public $char; /** * Constructor function * * @param string $errorstring Errorstring * @param int $line Linenumber - * @param char $char Errorcharacter + * @param string $char Errorcharacter * @param string $link Link */ public function __construct($errorstring, $line, $char, $link = '') { @@ -188,7 +188,7 @@ class core_xml_parser { * @param string $encoding Specify an OUTPUT encoding. If not specified, it defaults to UTF-8. * @param bool $reporterrors if set to true, then a {@link xml_format_exception} * exception will be thrown if the XML is not well-formed. Otherwise errors are ignored. - * @return array representation of the parsed XML. + * @return array|false representation of the parsed XML. */ public function parse($data, $whitespace = 1, $encoding = 'UTF-8', $reporterrors = false) { $data = trim($data); diff --git a/mod/data/tests/generator/lib.php b/mod/data/tests/generator/lib.php index eec22b7e017..218fa259d29 100644 --- a/mod/data/tests/generator/lib.php +++ b/mod/data/tests/generator/lib.php @@ -85,9 +85,9 @@ class mod_data_generator extends testing_module_generator { /** * Creates a field for a mod_data instance. * - * @param StdClass $record - * @param mod_data $data - * @return data_field_{type} + * @param stdClass|array $record + * @param stdClass|null $data + * @return data_field_base */ public function create_field(stdClass $record = null, $data = null) { $record = (array) $record;