Skip to content

Commit

Permalink
MDL-79863 question: Update docblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocolate-lightning committed Apr 5, 2024
1 parent 7dda680 commit 460e3b5
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 34 deletions.
7 changes: 5 additions & 2 deletions question/type/edit_question_form.php
Expand Up @@ -802,8 +802,11 @@ protected function data_preprocessing_combined_feedback($question,

/**
* Perform the necessary preprocessing for the hint fields.
* @param object $question the data being passed to the form.
* @return object $question the modified data.
*
* @param object $question The data being passed to the form.
* @param bool $withclearwrong Clear wrong hints.
* @param bool $withshownumpartscorrect Show number correct.
* @return stdClass The modified data.
*/
protected function data_preprocessing_hints($question, $withclearwrong = false,
$withshownumpartscorrect = false) {
Expand Down
2 changes: 1 addition & 1 deletion question/type/ordering/classes/question_hint_ordering.php
Expand Up @@ -31,7 +31,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class question_hint_ordering extends question_hint_with_parts {
/** @var bool $highlightresponse Highlight response in the hint options. */
/** @var bool Highlight response in the hint options. */
public bool $highlightresponse;

/**
Expand Down
2 changes: 1 addition & 1 deletion question/type/ordering/tests/output/feedback_test.php
Expand Up @@ -37,7 +37,7 @@
* @covers \qtype_ordering\output\feedback
*/
final class feedback_test extends qbehaviour_walkthrough_test_base {
/** @var array $CORRECTANSWERS The correct answers for the question, added to quickly reference. */
/** @var array The correct answers for the question, added to quickly reference. */
const CORRECTANSWERS = [
0 => [
'answertext' => 'Modular',
Expand Down
26 changes: 1 addition & 25 deletions question/type/ordering/tests/question_test.php
Expand Up @@ -51,7 +51,6 @@ final class question_test extends \advanced_testcase {

public function test_grading_all_or_nothing(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
// Zero grade on any error (no partial score at all, it is either 1 or 0).
$question->gradingtype = qtype_ordering_question::GRADING_ALL_OR_NOTHING;
Expand Down Expand Up @@ -88,7 +87,6 @@ public function test_grading_all_or_nothing(): void {

public function test_grading_absolute_position(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
// Counts items, placed into right absolute place.
$question->gradingtype = qtype_ordering_question::GRADING_ABSOLUTE_POSITION;
Expand Down Expand Up @@ -155,7 +153,6 @@ public function test_grading_absolute_position(): void {

public function test_grading_relative_next_exclude_last(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
// Every sequential pair in right order is graded (last pair is excluded).
$question->gradingtype = qtype_ordering_question::GRADING_RELATIVE_NEXT_EXCLUDE_LAST;
Expand Down Expand Up @@ -205,7 +202,6 @@ public function test_grading_relative_next_exclude_last(): void {

public function test_grading_relative_next_include_last(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
// Every sequential pair in right order is graded (last pair is included).
$question->gradingtype = qtype_ordering_question::GRADING_RELATIVE_NEXT_INCLUDE_LAST;
Expand Down Expand Up @@ -244,7 +240,6 @@ public function test_grading_relative_next_include_last(): void {

public function test_grading_relative_one_previous_and_next(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
// Single answers that are placed before and after each answer is graded if in right order.
$question->gradingtype = qtype_ordering_question::GRADING_RELATIVE_ONE_PREVIOUS_AND_NEXT;
Expand Down Expand Up @@ -292,7 +287,6 @@ public function test_grading_relative_one_previous_and_next(): void {

public function test_grading_relative_all_previous_and_next(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
// All answers that are placed before and after each answer is graded if in right order.
$question->gradingtype = qtype_ordering_question::GRADING_RELATIVE_ALL_PREVIOUS_AND_NEXT;
Expand Down Expand Up @@ -349,7 +343,6 @@ public function test_grading_relative_all_previous_and_next(): void {

public function test_grading_longest_ordered_subset(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
// Only longest ordered subset is graded.
$question->gradingtype = qtype_ordering_question::GRADING_LONGEST_ORDERED_SUBSET;
Expand Down Expand Up @@ -397,7 +390,6 @@ public function test_grading_longest_ordered_subset(): void {

public function test_grading_longest_contiguous_subset(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
// Only longest ordered and contiguous subset is graded.
$question->gradingtype = qtype_ordering_question::GRADING_LONGEST_CONTIGUOUS_SUBSET;
Expand Down Expand Up @@ -445,7 +437,6 @@ public function test_grading_longest_contiguous_subset(): void {

public function test_grading_relative_to_correct(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
// Items are graded relative to their position in the correct answer.
$question->gradingtype = qtype_ordering_question::GRADING_RELATIVE_TO_CORRECT;
Expand Down Expand Up @@ -494,14 +485,12 @@ public function test_grading_relative_to_correct(): void {

public function test_get_expected_data(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
$this->assertArrayHasKey('response_' . $question->id, $question->get_expected_data());
}

public function test_get_correct_response(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
$question->start_attempt(new question_attempt_pending_step(), 1);

Expand All @@ -516,7 +505,6 @@ public function test_get_correct_response(): void {

public function test_is_same_response(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
$question->start_attempt(new question_attempt_pending_step(), 1);

Expand All @@ -536,7 +524,6 @@ public function test_is_same_response(): void {

public function test_summarise_response(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
$question->start_attempt(new question_attempt_pending_step(), 1);

Expand Down Expand Up @@ -571,14 +558,12 @@ public function test_summarise_response(): void {
public function test_initialise_question_instance(): void {
// Create an Ordering question.
$questiondata = test_question_maker::get_question_data('ordering');
/** @var qtype_ordering_question $question */
$question = \question_bank::make_question($questiondata);
$this->assertStringContainsString('ordering_item_', reset($question->answers)->md5key);
}

public function test_get_ordering_layoutclass(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');

$question->layouttype = 0;
Expand All @@ -595,7 +580,6 @@ public function test_get_ordering_layoutclass(): void {

public function test_get_next_answerids(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
$answerids = array_keys($question->answers);

Expand Down Expand Up @@ -624,7 +608,6 @@ public function test_get_next_answerids(): void {

public function test_get_previous_and_next_answerids(): void {
// Create an Ordering question.
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
$answerids = array_keys($question->answers);

Expand All @@ -647,7 +630,6 @@ public function test_get_previous_and_next_answerids(): void {
}

public function test_classify_response_correct(): void {
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
$question->start_attempt(new question_attempt_step(), 1);

Expand All @@ -670,7 +652,6 @@ public function test_classify_response_correct(): void {
}

public function test_classify_response_partially_correct(): void {
/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');
$question->start_attempt(new question_attempt_step(), 1);

Expand All @@ -696,8 +677,7 @@ public function test_classify_response_partially_correct(): void {
* Test get number of correct|partial|incorrect on response.
*/
public function test_get_num_parts_right(): void {
// Create a Ordering question.
/** @var qtype_ordering_question $question */
// Create an Ordering question.
$question = test_question_maker::make_question('ordering');

$question->gradingtype = qtype_ordering_question::GRADING_RELATIVE_TO_CORRECT;
Expand All @@ -717,7 +697,6 @@ public function test_validate_can_regrade_with_other_version_bad(): void {
$this->markTestSkipped('This test only applies to Moodle 4.x');
}

/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');

$newq = clone($question);
Expand All @@ -741,7 +720,6 @@ public function test_validate_can_regrade_with_other_version_ok(): void {
$this->markTestSkipped('This test only applies to Moodle 4.x');
}

/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');

$newq = clone($question);
Expand All @@ -763,7 +741,6 @@ public function test_update_attempt_state_date_from_old_version_bad(): void {
$this->markTestSkipped('This test only applies to Moodle 4.x');
}

/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');

$newq = clone($question);
Expand All @@ -788,7 +765,6 @@ public function test_update_attempt_state_date_from_old_version_ok(): void {
$this->markTestSkipped('This test only applies to Moodle 4.x');
}

/** @var qtype_ordering_question $question */
$question = test_question_maker::make_question('ordering');

$newq = clone($question);
Expand Down
2 changes: 1 addition & 1 deletion question/type/ordering/tests/questionhint_test.php
Expand Up @@ -35,7 +35,7 @@
* @covers \qtype_ordering
*/
final class questionhint_test extends advanced_testcase {
/** @var qtype_ordering instance of the question type class to test. */
/** @var qtype_ordering Instance of the question type class to test. */
protected $qtype;

protected function setUp(): void {
Expand Down
1 change: 0 additions & 1 deletion question/type/ordering/tests/questiontype_test.php
Expand Up @@ -100,7 +100,6 @@ public function test_question_saving(): void {
$questiondata = test_question_maker::get_question_data('ordering');
$formdata = test_question_maker::get_question_form_data('ordering');

/** @var core_question_generator $generator */
$generator = $this->getDataGenerator()->get_plugin_generator('core_question');
$cat = $generator->create_question_category([]);

Expand Down
7 changes: 4 additions & 3 deletions question/type/questiontypebase.php
Expand Up @@ -562,10 +562,11 @@ public function save_question($question, $form) {
/**
* Saves question-type specific options
*
* This is called by {@link save_question()} to save the question-type specific data
* @return object $result->error or $result->notice
* @param object $question This holds the information from the editing form,
* This is called by {@see save_question()} to save the question-type specific data
*
* @param object $question This holds the information from the editing form,
* it is not a standard question object.
* @return bool|stdClass $result->error or $result->notice
*/
public function save_question_options($question) {
global $DB;
Expand Down

0 comments on commit 460e3b5

Please sign in to comment.