This commit is contained in:
Jun Pataleta 2024-03-08 08:00:41 +08:00
commit 3278ce7aba
No known key found for this signature in database
GPG key ID: F83510526D99E2C7
1147 changed files with 2621 additions and 2617 deletions

View file

@ -119,7 +119,7 @@ class column_manager extends column_manager_base {
* @param ?array $columns Column order to set. Null value clears the setting.
* @param bool $global save this as a global default, rather than a user preference?
*/
public static function set_column_order(?array $columns, bool $global = false) : void {
public static function set_column_order(?array $columns, bool $global = false): void {
if (!is_null($columns)) {
$columns = implode(',', $columns);
}
@ -132,7 +132,7 @@ class column_manager extends column_manager_base {
* @param ?array $columns List of hidden columns. Null value clears the setting.
* @param bool $global save this as a global default, rather than a user preference?
*/
public static function set_hidden_columns(?array $columns, bool $global = false) : void {
public static function set_hidden_columns(?array $columns, bool $global = false): void {
if (!is_null($columns)) {
$columns = implode(',', $columns);
}
@ -145,7 +145,7 @@ class column_manager extends column_manager_base {
* @param ?string $sizes columns with width. Null value clears the setting.
* @param bool $global save this as a global default, rather than a user preference?
*/
public static function set_column_size(?string $sizes, bool $global = false) : void {
public static function set_column_size(?string $sizes, bool $global = false): void {
self::save_preference('colsize', $sizes, $global);
}

View file

@ -55,7 +55,7 @@ class question_handler extends \core_customfield\handler {
* @param int $itemid Always zero.
* @return \qbank_customfields\customfield\question_handler
*/
public static function create(int $itemid = 0) : \core_customfield\handler {
public static function create(int $itemid = 0): \core_customfield\handler {
if (static::$singleton === null) {
self::$singleton = new static(0);
}
@ -78,7 +78,7 @@ class question_handler extends \core_customfield\handler {
*
* @return bool true if the current can configure custom fields, false otherwise
*/
public function can_configure() : bool {
public function can_configure(): bool {
return has_capability('qbank/customfields:configurecustomfields', $this->get_configuration_context());
}
@ -89,7 +89,7 @@ class question_handler extends \core_customfield\handler {
* @param int $instanceid id of the question to test edit permission
* @return bool true if the current can edit custom fields, false otherwise
*/
public function can_edit(field_controller $field, int $instanceid = 0) : bool {
public function can_edit(field_controller $field, int $instanceid = 0): bool {
if ($instanceid) {
$context = $this->get_instance_context($instanceid);
} else {
@ -107,7 +107,7 @@ class question_handler extends \core_customfield\handler {
* @param int $instanceid id of the question to test edit permission
* @return bool true if the current can edit custom fields, false otherwise
*/
public function can_view(field_controller $field, int $instanceid) : bool {
public function can_view(field_controller $field, int $instanceid): bool {
$visibility = $field->get_configdata_property('visibility');
if ($visibility == self::NOTVISIBLE) {
return false;
@ -128,7 +128,7 @@ class question_handler extends \core_customfield\handler {
* @param \context $context The context the field is being displayed in.
* @return bool true if the current can edit custom fields, false otherwise.
*/
public function can_view_type(field_controller $field, \context $context) : bool {
public function can_view_type(field_controller $field, \context $context): bool {
$visibility = $field->get_configdata_property('visibility');
if ($visibility == self::NOTVISIBLE) {
return false;
@ -155,7 +155,7 @@ class question_handler extends \core_customfield\handler {
*
* @return \context
*/
protected function get_parent_context() : \context {
protected function get_parent_context(): \context {
if ($this->parentcontext) {
return $this->parentcontext;
} else {
@ -168,7 +168,7 @@ class question_handler extends \core_customfield\handler {
*
* @return \context the context for configuration
*/
public function get_configuration_context() : \context {
public function get_configuration_context(): \context {
return \context_system::instance();
}
@ -177,7 +177,7 @@ class question_handler extends \core_customfield\handler {
*
* @return \moodle_url The URL to configure custom fields for this component
*/
public function get_configuration_url() : \moodle_url {
public function get_configuration_url(): \moodle_url {
return new \moodle_url('/question/customfield.php');
}
@ -188,7 +188,7 @@ class question_handler extends \core_customfield\handler {
* @return \context the context for the given record
* @throws \coding_exception
*/
public function get_instance_context(int $instanceid = 0) : \context {
public function get_instance_context(int $instanceid = 0): \context {
if ($instanceid > 0) {
$questiondata = \question_bank::load_question_data($instanceid);
$contextid = $questiondata->contextid;
@ -248,7 +248,7 @@ class question_handler extends \core_customfield\handler {
* @param object $fielddata The field data used for display.
* @return string The HTML to display in the table column.
*/
public function display_custom_field_table(object $fielddata) : string {
public function display_custom_field_table(object $fielddata): string {
global $PAGE;
$output = $PAGE->get_renderer('qbank_customfields');
@ -263,7 +263,7 @@ class question_handler extends \core_customfield\handler {
* @param array $catfielddata Array of categories and field names and values.
* @return string The HTML to display.
*/
public function display_custom_categories_fields(array $catfielddata) : string {
public function display_custom_categories_fields(array $catfielddata): string {
global $PAGE;
$output = $PAGE->get_renderer('qbank_customfields');

View file

@ -104,7 +104,7 @@ class update_question_version_status extends external_api {
/**
* Returns description of method result value.
*/
public static function execute_returns() {
public static function execute_returns() {
return new external_single_structure([
'status' => new external_value(PARAM_BOOL, 'status: true if success'),
'statusname' => new external_value(PARAM_RAW, 'statusname: name of the status'),

View file

@ -43,7 +43,7 @@ class renderer extends \plugin_renderer_base {
* @param \renderable $qbankchooser The chooser.
* @return string
*/
public function render_qbank_chooser (\renderable $qbankchooser) {
public function render_qbank_chooser(\renderable $qbankchooser) {
return $this->render_from_template('qbank_editquestion/qbank_chooser', $qbankchooser->export_for_template($this));
}
@ -55,7 +55,7 @@ class renderer extends \plugin_renderer_base {
* @deprecated since Moodle 4.3. Use {@see add_new_question} renderable instead
* @todo Final deprecation in Moodle 4.7
*/
public function render_create_new_question_button ($addquestiondata) {
public function render_create_new_question_button($addquestiondata) {
debugging('render_create_new_question_button() is deprecated. '
. 'Pass the add_new_question renderable to render() instead.');
return $this->render_from_template('qbank_editquestion/add_new_question', $addquestiondata);

View file

@ -91,7 +91,7 @@ class question_category_list extends moodle_list {
/**
* Set the array of records of list items.
*/
public function get_records() : void {
public function get_records(): void {
$this->records = helper::get_categories_for_contexts($this->context->id, $this->sortby);
}
@ -102,7 +102,7 @@ class question_category_list extends moodle_list {
* @param \list_item $item The item which its top level parent is going to be returned.
* @return int
*/
public function get_top_level_parent_id($item) : int {
public function get_top_level_parent_id($item): int {
// Put the item at the highest level it can go.
$topcategory = question_get_top_category($item->item->contextid, true);
return $topcategory->id;
@ -117,7 +117,7 @@ class question_category_list extends moodle_list {
* @param integer $movedown id of item to move down
* @return void
*/
public function process_actions($left, $right, $moveup, $movedown) : void {
public function process_actions($left, $right, $moveup, $movedown): void {
$category = new stdClass();
if (!empty($left)) {
// Moved Left (In to another category).

View file

@ -34,7 +34,7 @@ class question_category_list_item extends \list_item {
* @param bool $last Is the last on the list.
* @param \list_item $lastitem Last item.
*/
public function set_icon_html($first, $last, $lastitem) : void {
public function set_icon_html($first, $last, $lastitem): void {
global $CFG;
$category = $this->item;
$url = new moodle_url('/question/bank/managecategories/category.php',
@ -75,7 +75,7 @@ class question_category_list_item extends \list_item {
* @return string Item html.
* @throws \moodle_exception
*/
public function item_html($extraargs = []) : string {
public function item_html($extraargs = []): string {
global $PAGE, $OUTPUT;
$str = $extraargs['str'];
$category = $this->item;

View file

@ -284,7 +284,7 @@ class helper {
* @param string $questionbankentryid Entry to check against
* @return bool
*/
public static function is_latest(string $version, string $questionbankentryid) : bool {
public static function is_latest(string $version, string $questionbankentryid): bool {
global $DB;
$sql = 'SELECT MAX(version) AS max
@ -304,7 +304,7 @@ class helper {
* @param string $questionbankentryid Question bank entry id
* @return array $questionids Array containing question id as key and version as value.
*/
public static function load_versions(string $questionbankentryid) : array {
public static function load_versions(string $questionbankentryid): array {
global $DB;
$questionids = [];

View file

@ -322,8 +322,8 @@ class helper_test extends \advanced_testcase {
array $expectedquiz1facilities,
array $quiz2attempts,
array $expectedquiz2facilities,
array $expectedaveragefacilities)
: void {
array $expectedaveragefacilities
): void {
$this->resetAfterTest();
list($quiz1, $quiz2, $questions) = $this->prepare_and_submit_quizzes($quiz1attempts, $quiz2attempts);

View file

@ -127,7 +127,7 @@ class submit_tags extends external_api {
/**
* Returns description of method result value.
*/
public static function execute_returns() {
public static function execute_returns() {
return new external_single_structure([
'status' => new external_value(PARAM_BOOL, 'status: true if success')
]);

View file

@ -45,7 +45,7 @@ use core_external\util as external_util;
* @param string $newvalue the changed question title
* @return \core\output\inplace_editable
*/
function qbank_viewquestionname_inplace_editable ($itemtype, $itemid, $newvalue) : \core\output\inplace_editable {
function qbank_viewquestionname_inplace_editable ($itemtype, $itemid, $newvalue): \core\output\inplace_editable {
if ($itemtype === 'questionname') {
global $CFG, $DB;
require_once($CFG->libdir . '/questionlib.php');

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -74,7 +74,7 @@ abstract class question_behaviour {
*
* @param question_definition $question the question.
*/
public abstract function is_compatible_question(question_definition $question);
abstract public function is_compatible_question(question_definition $question);
/**
* @return string the name of this behaviour. For example the name of
@ -347,7 +347,7 @@ abstract class question_behaviour {
return $this->qa->get_state()->default_string($showcorrectness);
}
public abstract function summarise_action(question_attempt_step $step);
abstract public function summarise_action(question_attempt_step $step);
/**
* Initialise the first step in a question attempt when a new
@ -467,7 +467,7 @@ abstract class question_behaviour {
* information can be accessed using {@link question_attempt_step::get_behaviour_var()}.
* @return bool either {@link question_attempt::KEEP} or {@link question_attempt::DISCARD}
*/
public abstract function process_action(question_attempt_pending_step $pendingstep);
abstract public function process_action(question_attempt_pending_step $pendingstep);
/**
* Auto-saved data. By default this does nothing. interesting processing is

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -608,7 +608,7 @@ class walkthrough_test extends \qbehaviour_walkthrough_test_base {
$this->manual_grade('Comment', '10.1', FORMAT_HTML);
}
public function test_manual_graded_displays_proper_comment_format () {
public function test_manual_graded_displays_proper_comment_format() {
global $PAGE;

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -223,7 +223,7 @@ class core_question_external extends external_api {
* @see \qbank_tagquestion\external\qbank_tagquestion_external
* @todo Final deprecation on Moodle 4.4 MDL-72438
*/
public static function submit_tags_form_returns() {
public static function submit_tags_form_returns() {
return new external_single_structure([
'status' => new external_value(PARAM_BOOL, 'status: true if success')
]);
@ -346,7 +346,7 @@ class core_question_external extends external_api {
/**
* Returns description of method result value.
*/
public static function get_random_question_summaries_returns() {
public static function get_random_question_summaries_returns() {
return new external_single_structure([
'totalcount' => new external_value(PARAM_INT, 'total number of questions in result set'),
'questions' => new external_multiple_structure(

View file

@ -69,7 +69,7 @@ class edit_menu_column extends column_base {
echo $OUTPUT->render($menu);
}
public function get_required_fields():array {
public function get_required_fields(): array {
return ['q.qtype'];
}

View file

@ -73,7 +73,7 @@ class provider implements
* @param collection $items The collection to add metadata to.
* @return collection The array of metadata
*/
public static function get_metadata(collection $items) : collection {
public static function get_metadata(collection $items): collection {
// Other tables link against it.
// The 'question_usages' table does not contain any user data.
@ -335,7 +335,7 @@ class provider implements
* @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
$contextlist = new contextlist();
// A user may have created or updated a question.
@ -390,7 +390,7 @@ class provider implements
* @param int $userid The user to search.
* @return \qubaid_join
*/
public static function get_related_question_usages_for_user(string $prefix, string $component, string $joinfield, int $userid) : \qubaid_join {
public static function get_related_question_usages_for_user(string $prefix, string $component, string $joinfield, int $userid): \qubaid_join {
return new \qubaid_join("
JOIN {question_usages} {$prefix}_qu ON {$prefix}_qu.id = {$joinfield}
AND {$prefix}_qu.component = :{$prefix}_usagecomponent

View file

@ -1900,27 +1900,27 @@ abstract class qubaid_condition {
* @param string $alias
* @return string SQL fragment.
*/
public abstract function from_question_attempts($alias);
abstract public function from_question_attempts($alias);
/** @return string the SQL that needs to go in the where clause. */
public abstract function where();
abstract public function where();
/**
* @return array the params needed by a query that uses
* {@link from_question_attempts()} and {@link where()}.
*/
public abstract function from_where_params();
abstract public function from_where_params();
/**
* @return string SQL that can use used in a WHERE qubaid IN (...) query.
* This method returns the "IN (...)" part.
*/
public abstract function usage_id_in();
abstract public function usage_id_in();
/**
* @return array the params needed by a query that uses {@link usage_id_in()}.
*/
public abstract function usage_id_in_params();
abstract public function usage_id_in_params();
/**
* @return string 40-character hash code that uniquely identifies the combination of properties and class name of this qubaid

View file

@ -282,7 +282,7 @@ abstract class question_state {
* @return string the name of a string that can be looked up in the 'question'
* lang pack, or used as a CSS class name, etc.
*/
public abstract function get_state_class($showcorrectness);
abstract public function get_state_class($showcorrectness);
/**
* The result of doing get_string on the result of {@link get_state_class()}.

View file

@ -101,7 +101,7 @@ abstract class question_behaviour_attempt_updater {
$this->qeupdater = null;
}
protected abstract function behaviour_name();
abstract protected function behaviour_name();
public function get_converted_qa() {
$this->initialise_qa();
@ -231,8 +231,8 @@ abstract class question_behaviour_attempt_updater {
$this->unexpected_event($state);
}
protected abstract function process6($step, $state);
protected abstract function process7($step, $state);
abstract protected function process6($step, $state);
abstract protected function process7($step, $state);
protected function process8($step, $state) {
return $this->process6($step, $state);

View file

@ -417,12 +417,12 @@ abstract class question_qtype_attempt_updater {
return $state->answer == '';
}
public abstract function right_answer();
public abstract function response_summary($state);
public abstract function was_answered($state);
public abstract function set_first_step_data_elements($state, &$data);
public abstract function set_data_elements_for_step($state, &$data);
public abstract function supply_missing_first_step_data(&$data);
abstract public function right_answer();
abstract public function response_summary($state);
abstract public function was_answered($state);
abstract public function set_first_step_data_elements($state, &$data);
abstract public function set_data_elements_for_step($state, &$data);
abstract public function supply_missing_first_step_data(&$data);
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -341,8 +341,8 @@ class statistics_bulk_loader_test extends advanced_testcase {
array $expectedquiz1facilities,
array $quiz2attempts,
array $expectedquiz2facilities,
array $expectedaveragefacilities)
: void {
array $expectedaveragefacilities
): void {
$this->resetAfterTest();
list($quiz1, $quiz2, $questions) = $this->prepare_and_submit_quizzes($quiz1attempts, $quiz2attempts);

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -49,7 +49,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_user_preference('qtype_ddimageortext_defaultmark', 'privacy:preference:defaultmark');
$collection->add_user_preference('qtype_ddimageortext_penalty', 'privacy:preference:penalty');
$collection->add_user_preference('qtype_ddimageortext_shuffleanswers', 'privacy:preference:shuffleanswers');

View file

@ -49,7 +49,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_user_preference('qtype_ddmarker_defaultmark', 'privacy:preference:defaultmark');
$collection->add_user_preference('qtype_ddmarker_penalty', 'privacy:preference:penalty');
$collection->add_user_preference('qtype_ddmarker_shuffleanswers', 'privacy:preference:shuffleanswers');

View file

@ -49,7 +49,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_user_preference('qtype_ddwtos_defaultmark', 'privacy:preference:defaultmark');
$collection->add_user_preference('qtype_ddwtos_penalty', 'privacy:preference:penalty');
$collection->add_user_preference('qtype_ddwtos_shuffleanswers', 'privacy:preference:shuffleanswers');

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -906,7 +906,7 @@ abstract class question_edit_form extends question_wizard_form {
* @return the question type name, should be the same as the name() method
* in the question type class.
*/
public abstract function qtype();
abstract public function qtype();
/**
* Returns an array of editor options with collapsed options turned off.

View file

@ -49,7 +49,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_user_preference('qtype_essay_defaultmark', 'privacy:preference:defaultmark');
$collection->add_user_preference('qtype_essay_responseformat', 'privacy:preference:responseformat');
$collection->add_user_preference('qtype_essay_responserequired', 'privacy:preference:responserequired');

View file

@ -243,7 +243,7 @@ abstract class qtype_essay_format_renderer_base extends plugin_renderer_base {
* @param object $context the context teh output belongs to.
* @return string html to display the response.
*/
public abstract function response_area_read_only($name, question_attempt $qa,
abstract public function response_area_read_only($name, question_attempt $qa,
question_attempt_step $step, $lines, $context);
/**
@ -255,13 +255,13 @@ abstract class qtype_essay_format_renderer_base extends plugin_renderer_base {
* @param object $context the context teh output belongs to.
* @return string html to display the response for editing.
*/
public abstract function response_area_input($name, question_attempt $qa,
abstract public function response_area_input($name, question_attempt $qa,
question_attempt_step $step, $lines, $context);
/**
* @return string specific class name to add to the input element.
*/
protected abstract function class_name();
abstract protected function class_name();
}
/**

View file

@ -49,7 +49,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_user_preference('qtype_gapselect_defaultmark', 'privacy:preference:defaultmark');
$collection->add_user_preference('qtype_gapselect_penalty', 'privacy:preference:penalty');
$collection->add_user_preference('qtype_gapselect_shuffleanswers', 'privacy:preference:shuffleanswers');

View file

@ -44,7 +44,7 @@ abstract class qtype_gapselect_base extends question_type {
* @param array $choice the form data relating to this choice.
* @return string ready to store in the database.
*/
protected abstract function choice_options_to_feedback($choice);
abstract protected function choice_options_to_feedback($choice);
public function save_question_options($question) {
global $DB;
@ -147,7 +147,7 @@ abstract class qtype_gapselect_base extends question_type {
* @param object $choicedata as loaded from the question_answers table.
* @return object an appropriate object for representing the choice.
*/
protected abstract function make_choice($choicedata);
abstract protected function make_choice($choicedata);
protected function initialise_question_instance(question_definition $question, $questiondata) {
parent::initialise_question_instance($question, $questiondata);
@ -212,7 +212,7 @@ abstract class qtype_gapselect_base extends question_type {
* @param string $feedback the data loaded from the database.
* @return array the choice options.
*/
protected abstract function feedback_to_choice_options($feedback);
abstract protected function feedback_to_choice_options($feedback);
/**
* This method gets the choices (answers)

View file

@ -106,7 +106,7 @@ abstract class qtype_elements_embedded_in_question_text_renderer
return str_replace(':', '_', $qa->get_qt_field_name(''));
}
protected abstract function embedded_element(question_attempt $qa, $place,
abstract protected function embedded_element(question_attempt $qa, $place,
question_display_options $options);
protected function post_qtext_elements(question_attempt $qa,

View file

@ -49,7 +49,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_user_preference('qtype_match_defaultmark', 'privacy:preference:defaultmark');
$collection->add_user_preference('qtype_match_penalty', 'privacy:preference:penalty');
$collection->add_user_preference('qtype_match_shuffleanswers', 'privacy:preference:shuffleanswers');

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -609,7 +609,7 @@ function qtype_multianswer_extract_question($text) {
* @param object $question The multianswer question to validate as returned by qtype_multianswer_extract_question
* @return array Array of error messages with questions field names as keys.
*/
function qtype_multianswer_validate_question(stdClass $question) : array {
function qtype_multianswer_validate_question(stdClass $question): array {
$errors = array();
if (!isset($question->options->questions)) {
$errors['questiontext'] = get_string('questionsmissing', 'qtype_multianswer');

View file

@ -50,7 +50,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_user_preference('qtype_multichoice_defaultmark', 'privacy:preference:defaultmark');
$collection->add_user_preference('qtype_multichoice_penalty', 'privacy:preference:penalty');
$collection->add_user_preference('qtype_multichoice_single', 'privacy:preference:single');

View file

@ -139,9 +139,9 @@ abstract class qtype_multichoice_base extends question_graded_automatically {
}
}
public abstract function get_response(question_attempt $qa);
abstract public function get_response(question_attempt $qa);
public abstract function is_choice_selected($response, $value);
abstract public function is_choice_selected($response, $value);
public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload) {
if ($component == 'question' && in_array($filearea,

View file

@ -44,24 +44,24 @@ abstract class qtype_multichoice_renderer_base extends qtype_with_combined_feedb
*
* @return string HTML output.
*/
protected abstract function after_choices(question_attempt $qa, question_display_options $options);
abstract protected function after_choices(question_attempt $qa, question_display_options $options);
protected abstract function get_input_type();
abstract protected function get_input_type();
protected abstract function get_input_name(question_attempt $qa, $value);
abstract protected function get_input_name(question_attempt $qa, $value);
protected abstract function get_input_value($value);
abstract protected function get_input_value($value);
protected abstract function get_input_id(question_attempt $qa, $value);
abstract protected function get_input_id(question_attempt $qa, $value);
/**
* Whether a choice should be considered right, wrong or partially right.
* @param question_answer $ans representing one of the choices.
* @return fload 1.0, 0.0 or something in between, respectively.
*/
protected abstract function is_right(question_answer $ans);
abstract protected function is_right(question_answer $ans);
protected abstract function prompt();
abstract protected function prompt();
public function formulation_and_controls(question_attempt $qa,
question_display_options $options) {

View file

@ -1921,7 +1921,7 @@ public function test_multichoice_deferredfeedback_qsession140() {
$this->compare_qas($expectedqa, $qa);
}
public function test_multichoice_deferredfeedback_qsession4307870 () {
public function test_multichoice_deferredfeedback_qsession4307870() {
$quiz = (object) array(
'id' => '4070',
'course' => '5139',

View file

@ -50,7 +50,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_user_preference('qtype_numerical_defaultmark', 'privacy:preference:defaultmark');
$collection->add_user_preference('qtype_numerical_penalty', 'privacy:preference:penalty');
$collection->add_user_preference('qtype_numerical_unitrole', 'privacy:preference:unitrole');

View file

@ -57,7 +57,7 @@ class qtype_numerical extends question_type {
* @param string $x a string
* @return bool whether $x is a number that the numerical question type can interpret.
*/
public static function is_valid_number(string $x) : bool {
public static function is_valid_number(string $x): bool {
$ap = new qtype_numerical_answer_processor(array());
list($value, $unit) = $ap->apply_units($x);
return !is_null($value) && !$unit;

View file

@ -369,7 +369,7 @@ abstract class question_definition {
* that should only be used in unavoidable, the constant question_attempt::USE_RAW_DATA
* meaning take all the raw submitted data belonging to this question.
*/
public abstract function get_expected_data();
abstract public function get_expected_data();
/**
* What data would need to be submitted to get this question correct.
@ -379,7 +379,7 @@ abstract class question_definition {
*
* @return array|null parameter name => value.
*/
public abstract function get_correct_response();
abstract public function get_correct_response();
/**

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -49,7 +49,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_user_preference('qtype_shortanswer_defaultmark', 'privacy:preference:defaultmark');
$collection->add_user_preference('qtype_shortanswer_penalty', 'privacy:preference:penalty');
$collection->add_user_preference('qtype_shortanswer_usecase', 'privacy:preference:usecase');