MDL-76899 quiz: Fix PHPdocs issues

This commit is contained in:
Tim Hunt 2023-01-16 18:48:27 +00:00
parent 28f090d975
commit ec0a2dd85b
10 changed files with 38 additions and 16 deletions

View File

@ -120,6 +120,7 @@ function quiz_add_instance($quiz) {
* will update an existing instance with new data.
*
* @param stdClass $quiz the data that came from the form.
* @param stdClass $mform no longer used.
* @return mixed true on success, false or a string error message on failure.
*/
function quiz_update_instance($quiz, $mform) {
@ -1251,9 +1252,8 @@ function quiz_after_add_or_update($quiz) {
* If $override is non-zero, then it updates only the events
* associated with the specified override.
*
* @uses QUIZ_MAX_EVENT_LENGTH
* @param stdClass $quiz the quiz object.
* @param stdClass optional $override limit to a specific override
* @param stdClass|null $override limit to a specific override
*/
function quiz_update_events($quiz, $override = null) {
global $DB;

View File

@ -79,13 +79,13 @@ define('QUIZ_SHOWIMAGE_LARGE', 2);
* user starting at the current time. The ->id field is not set. The object is
* NOT written to the database.
*
* @param stdClass $quizobj the quiz object to create an attempt for.
* @param quiz_settings $quizobj the quiz object to create an attempt for.
* @param int $attemptnumber the sequence number for the attempt.
* @param stdClass|false $lastattempt the previous attempt by this user, if any. Only needed
* if $attemptnumber > 1 and $quiz->attemptonlast is true.
* @param int $timenow the time the attempt was started at.
* @param bool $ispreview whether this new attempt is a preview.
* @param int $userid the id of the user attempting this quiz.
* @param int|null $userid the id of the user attempting this quiz.
*
* @return stdClass the newly created attempt object.
*/
@ -1379,7 +1379,6 @@ function quiz_attempt_state_name($state) {
* @param stdClass $question the question.
* @param string $returnurl url to return to after action is done.
* @param int $variant which question variant to preview (optional).
* @param bool $random if question is random, true.
* @return string html for a number of icons linked to action pages for a
* question - preview and edit / view icons depending on user capabilities.
*/
@ -1610,6 +1609,7 @@ function quiz_get_combined_reviewoptions($quiz, $attempts) {
/**
* Sends a confirmation message to the student confirming that the attempt was processed.
*
* @param stdClass $recipient user object for the recipient.
* @param stdClass $a lots of useful information that can be used in the message
* subject and body.
* @param bool $studentisonline is the student currently interacting with Moodle?
@ -1660,6 +1660,7 @@ function quiz_send_confirmation($recipient, $a, $studentisonline) {
* Sends notification messages to the interested parties that assign the role capability
*
* @param stdClass $recipient user object of the intended recipient
* @param stdClass $submitter user object for the user who submitted the attempt.
* @param stdClass $a associative array of replaceable fields for the templates
*
* @return int|false as for {@link message_send()}.

View File

@ -41,8 +41,11 @@ class mod_quiz_mod_form extends moodleform_mod {
/** @var array options to be used with date_time_selector fields in the quiz. */
public static $datefieldoptions = ['optional' => true];
/** @var array caches the quiz overall feedback, for convenience. */
protected $_feedbacks;
protected static $reviewfields = []; // Initialised in the constructor.
/** @var array for convenience stores the list of types of review option. Initialised in the constructor. */
protected static $reviewfields = [];
/** @var int the max number of attempts allowed in any user or group override on this quiz. */
protected $maxattemptsanyoverride = null;
@ -61,7 +64,7 @@ class mod_quiz_mod_form extends moodleform_mod {
}
protected function definition() {
global $COURSE, $CFG, $DB, $PAGE;
global $CFG, $DB, $PAGE;
$quizconfig = get_config('quiz');
$mform = $this->_form;

View File

@ -35,9 +35,16 @@ require_once($CFG->libdir . '/formslib.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class quiz_grading_settings_form extends moodleform {
/** @var bool whether the user has asked to include automatically graded attempts. */
protected $includeauto;
/** @var array extra hidden fields to add to the form. Things like cm id. */
protected $hidden = [];
/** @var stdClass data about how many attempts of each type their are. */
protected $counts;
/** @var bool Whether the user has permission to see user names. */
protected $shownames;
/** @var bool $showcustomfields whether custom field values should be shown. */

View File

@ -25,6 +25,7 @@ use mod_quiz\quiz_attempt;
*/
class quiz_overview_table extends attempts_report_table {
/** @var array used to store information about which questoins have been regraded. */
protected $regradedqs = [];
/**

View File

@ -452,15 +452,16 @@ class quiz_overview_report extends attempts_report {
/**
* Regrade attempts for this quiz, exactly which attempts are regraded is
* controlled by the parameters.
*
* @param stdClass $quiz the quiz settings.
* @param bool $dryrun if true, do a pretend regrade, otherwise do it for real.
* @param \core\dml\sql_join|array $groupstudentsjoins empty for all attempts, otherwise regrade attempts
* @param \core\dml\sql_join|null $groupstudentsjoins empty for all attempts, otherwise regrade attempts
* for these users.
* @param array $attemptids blank for all attempts, otherwise only regrade
* attempts whose id is in this list.
*/
protected function regrade_attempts($quiz, $dryrun = false,
\core\dml\sql_join$groupstudentsjoins = null, $attemptids = []) {
core\dml\sql_join $groupstudentsjoins = null, $attemptids = []) {
global $DB;
$this->unlock_session();
@ -679,11 +680,9 @@ class quiz_overview_report extends attempts_report {
}
/**
* Update the final grades for all attempts. This method is used following
* a regrade.
* Update the final grades for all attempts. This method is used following a regrade.
*
* @param stdClass $quiz the quiz settings.
* @param array $userids only update scores for these userids.
* @param array $attemptids attemptids only update scores for these attempt ids.
*/
protected function update_overall_grades($quiz) {
quiz_update_all_attempt_sumgrades($quiz);

View File

@ -41,6 +41,9 @@ class responses_from_steps_walkthrough_test extends \mod_quiz\attempt_walkthroug
return __DIR__."/fixtures/{$setname}{$test}.csv";
}
/**
* @var string[] names of the files which contain the test data.
*/
protected $files = ['questions', 'steps', 'responses'];
/**

View File

@ -57,6 +57,9 @@ class stats_from_steps_walkthrough_test extends \mod_quiz\attempt_walkthrough_fr
return __DIR__."/fixtures/{$setname}{$test}.csv";
}
/**
* @var string[] names of the files which contain the test data.
*/
protected $files = ['questions', 'steps', 'results', 'qstats', 'responsecounts'];
/**

View File

@ -35,6 +35,9 @@ require_once($CFG->dirroot . '/mod/quiz/locallib.php');
*/
class attempt_walkthrough_from_csv_test extends \advanced_testcase {
/**
* @var string[] names of the files which contain the test data.
*/
protected $files = ['questions', 'steps', 'results'];
/**

View File

@ -25,6 +25,7 @@ use grade_item;
use mod_quiz\completion\custom_completion;
use question_engine;
use mod_quiz\quiz_settings;
use stdClass;
defined('MOODLE_INTERNAL') || die();
@ -462,14 +463,15 @@ class custom_completion_test extends advanced_testcase {
/**
* Set up moduleinfo object sample data for quiz instance.
*
* @param stdClass $cm course-module instance
* @param cm_info $cm course-module instance
* @param stdClass $quiz quiz instance data.
* @param stdClass $course Course related data.
* @param int $gradepass Grade to pass and completed completion.
* @param string $grademethod grade attempt method.
* @return \stdClass
* @return stdClass
*/
private function prepare_module_info(object $cm, object $quiz, object $course, int $gradepass, string $grademethod): \stdClass {
private function prepare_module_info(cm_info $cm, stdClass $quiz, stdClass $course,
int $gradepass, string $grademethod): \stdClass {
$grouping = $this->getDataGenerator()->create_grouping(['courseid' => $course->id]);
// Module test values.
$moduleinfo = new \stdClass();