diff --git a/actions/feedbacks/update.php b/actions/feedbacks/update.php index b97d4639..baf6f59c 100644 --- a/actions/feedbacks/update.php +++ b/actions/feedbacks/update.php @@ -31,7 +31,7 @@ $feedbackid = required_param('feedbackid', PARAM_INT); $finalised = (bool)optional_param('submitbutton', 0, PARAM_TEXT); $ajax = optional_param('ajax', 0, PARAM_INT); -$remove = !!optional_param('removefeedbackbutton', 0, PARAM_TEXT); +$remove = (bool)optional_param('removefeedbackbutton', 0, PARAM_TEXT); $confirm = optional_param('confirm', 0, PARAM_INT); $params = [ diff --git a/backup/moodle2/restore_coursework_stepslib.php b/backup/moodle2/restore_coursework_stepslib.php index cba2132e..4d9c6600 100644 --- a/backup/moodle2/restore_coursework_stepslib.php +++ b/backup/moodle2/restore_coursework_stepslib.php @@ -24,15 +24,6 @@ class restore_coursework_activity_structure_step extends restore_activity_structure_step { - // Just a handy way to spit out debugging info while in the bowels of restore - static function cheaplog($thing, $append = true) { - if ($append) { - $append = FILE_APPEND; - } - - file_put_contents('/tmp/cheap.log', print_r($thing, true)."\n---------------\n", $append); - } - /** * Define the structure of the restore workflow. * diff --git a/classes/controllers/controller_base.php b/classes/controllers/controller_base.php index a383c156..f494cbfa 100644 --- a/classes/controllers/controller_base.php +++ b/classes/controllers/controller_base.php @@ -253,7 +253,7 @@ public function model_name() { * @throws \coding_exception */ protected function cancel_button_was_pressed() { - return !!optional_param('cancel', false, PARAM_ALPHA); + return (bool)optional_param('cancel', false, PARAM_ALPHA); } /** diff --git a/classes/controllers/submissions_controller.php b/classes/controllers/submissions_controller.php index 2d367e75..3698a7b4 100644 --- a/classes/controllers/submissions_controller.php +++ b/classes/controllers/submissions_controller.php @@ -382,7 +382,7 @@ protected function prepare_environment() { * @throws \coding_exception */ private function terms_were_agreed_to() { - return !!optional_param('termsagreed', false, PARAM_INT); + return (bool)optional_param('termsagreed', 0, PARAM_INT); } /** diff --git a/classes/export/csv/cells/agreedgrade_cell.php b/classes/export/csv/cells/agreedgrade_cell.php index 9772e15c..efe1a8c4 100644 --- a/classes/export/csv/cells/agreedgrade_cell.php +++ b/classes/export/csv/cells/agreedgrade_cell.php @@ -72,13 +72,13 @@ public function get_header($stage) { return $strings; } - public function validate_cell($value, $submissionid, $stageidentifier='', $uploadedgradecells = []) { + public function validate_cell($value, $submissionid, $stageidentifier = '', $uploadedgradecells = []) { global $DB, $PAGE, $USER; - $stageidentifier = 'final_agreed_1'; + $stageident = 'final_agreed_1'; $agreedgradecap = ['mod/coursework:addagreedgrade', 'mod/coursework:editagreedgrade', - 'mod/coursework:addallocatedagreedgrade', 'mod/coursework:editallocatedagreedgrade']; + 'mod/coursework:addallocatedagreedgrade', 'mod/coursework:editallocatedagreedgrade']; if (empty($value)) { return true; @@ -172,7 +172,7 @@ public function validate_cell($value, $submissionid, $stageidentifier='', $uploa // Has this submission been graded if yes then check if the current user graded it (only if allocation is not enabled). $feedbackparams = [ 'submissionid' => $submission->id, - 'stage_identifier' => $stageidentifier, + 'stage_identifier' => $stageident, ]; $feedback = feedback::find($feedbackparams); @@ -185,7 +185,7 @@ public function validate_cell($value, $submissionid, $stageidentifier='', $uploa $feedbackparams = [ 'submissionid' => $submissionid, 'assessorid' => $USER->id, - 'stage_identifier' => $stageidentifier, + 'stage_identifier' => $stageident, ]; $newfeedback = feedback::build($feedbackparams); diff --git a/classes/export/csv/cells/stages_cell.php b/classes/export/csv/cells/stages_cell.php index ee7a83e2..5f9d3bdc 100644 --- a/classes/export/csv/cells/stages_cell.php +++ b/classes/export/csv/cells/stages_cell.php @@ -49,11 +49,11 @@ public function get_cell($submission, $student, $stageidentifier) { $gradedata = []; // go through each stage and get a grade, if grade not present then put a placeholder for ($i = 1; $i <= $this->stages; $i++) { - $stageidentifier = 'assessor_'.$i; - $grade = $submission->get_assessor_feedback_by_stage($stageidentifier); + $stageident = 'assessor_'.$i; + $grade = $submission->get_assessor_feedback_by_stage($stageident); if ($this->coursework->allocation_enabled()) { - $allocation = $submission->get_assessor_allocation_by_stage($stageidentifier); + $allocation = $submission->get_assessor_allocation_by_stage($stageident); if ($allocation) { $gradedata[] = $this->get_assessor_name($allocation->assessorid); $gradedata[] = $this->get_assessor_username($allocation->assessorid); diff --git a/classes/framework/table_base.php b/classes/framework/table_base.php index ae36f63f..d6ebc9b7 100644 --- a/classes/framework/table_base.php +++ b/classes/framework/table_base.php @@ -424,7 +424,7 @@ public function reload($complainifnotfound = true) { * @param bool $sneakily If true, do not update the timemodified stamp. Useful for cron. * @return void */ - public function update_attribute($name, $value, $sneakily = false) { + public function update_attribute($name, $value, $sneakily = false): void { $this->apply_column_value_to_self($name, $value); $this->save($sneakily); } diff --git a/classes/models/coursework.php b/classes/models/coursework.php index e06a8bf7..f468c88e 100644 --- a/classes/models/coursework.php +++ b/classes/models/coursework.php @@ -1041,7 +1041,8 @@ public function validate_and_set_allocation_strategy($allocationstrategy) { public function set_assessor_allocation_strategy($strategyname) { if ($this->allocation_strategy_is_valid($strategyname)) { - return $this->update_attribute('assessorallocationstrategy', $strategyname); + $this->update_attribute('assessorallocationstrategy', $strategyname); + return; } return false; } @@ -1053,7 +1054,8 @@ public function set_assessor_allocation_strategy($strategyname) { public function set_moderator_allocation_strategy($strategyname) { if ($this->allocation_strategy_is_valid($strategyname)) { - return $this->update_attribute('moderatorallocationstrategy', $strategyname); + $this->update_attribute('moderatorallocationstrategy', $strategyname); + return; } return false; } diff --git a/classes/sample_set_rule/total_sample_type.php b/classes/sample_set_rule/total_sample_type.php index ee4d1b01..0ea5ec0e 100644 --- a/classes/sample_set_rule/total_sample_type.php +++ b/classes/sample_set_rule/total_sample_type.php @@ -137,7 +137,7 @@ public function save_form_data($assessornumber = 0, &$order = 0) { } - static function compare_key($a, $b) { + private static function compare_key($a, $b) { if ($a === $b) { return 0; } diff --git a/renderers/page_renderer.php b/renderers/page_renderer.php index 71df5514..2ac96c81 100644 --- a/renderers/page_renderer.php +++ b/renderers/page_renderer.php @@ -1184,7 +1184,7 @@ protected function marking_preview_html($ownsubmission) { * @return string * @throws coding_exception */ - function csv_upload($uploadform, $csvtype) { + public function csv_upload($uploadform, $csvtype) { $html = ''; @@ -1212,7 +1212,7 @@ function csv_upload($uploadform, $csvtype) { * @return string * @throws coding_exception */ - function process_csv_upload($processingresults, $csvcontent, $csvtype) { + public function process_csv_upload($processingresults, $csvcontent, $csvtype) { $html = ''; @@ -1254,7 +1254,7 @@ function process_csv_upload($processingresults, $csvcontent, $csvtype) { } - function feedback_upload($form) { + public function feedback_upload($form) { $html = ''; @@ -1273,7 +1273,7 @@ function feedback_upload($form) { } - function process_feedback_upload($processingresults) { + public function process_feedback_upload($processingresults) { $title = get_string('feedbackuploadresults', 'mod_coursework'); $this->page->set_pagelayout('standard'); @@ -1316,7 +1316,7 @@ function process_feedback_upload($processingresults) { * * @return string */ - function view_course_index($courseid) { + public function view_course_index($courseid) { global $CFG, $DB, $USER; $o = ''; $course = $DB->get_record('course', ['id' => $courseid]); diff --git a/tests/behat/behat_mod_coursework.php b/tests/behat/behat_mod_coursework.php index 7b325770..d3bfc933 100644 --- a/tests/behat/behat_mod_coursework.php +++ b/tests/behat/behat_mod_coursework.php @@ -2496,7 +2496,7 @@ public function visit_page($pathname) { * @param bool $ignoreparams */ public function i_should_be_on_the_page($pagename, $ignoreparams = false) { - $ignoreparams = !!$ignoreparams; + $ignoreparams = (bool)$ignoreparams; if ($this->running_javascript()) { $this->wait_for_seconds(10);