Skip to content

Commit 3fb5bfb

Browse files
committed
fixup: codechecker and phpdoc fixes
1 parent 44fcd35 commit 3fb5bfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+176
-175
lines changed

assignstudents.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
'invalidqueryparam',
4141
'error',
4242
null,
43-
$a = array('expected' => 'mode to be \'randomassign\'', 'actual' => $mode));
43+
$a = ['expected' => 'mode to be \'randomassign\'', 'actual' => $mode]);
4444
}
4545

4646
require_login($course, true, $cm);

backup/moodle2/backup_observation_stepslib.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ protected function define_structure() {
4343
'observee_ins',
4444
'observee_ins_f',
4545
'students_self_unregister',
46-
'marking_type'
46+
'marking_type',
4747
]);
4848

4949
$notifications = new backup_nested_element('notifications');
5050

5151
$notification = new backup_nested_element('notification', ['id'], [
5252
'timeslot_id',
53-
'time_before'
53+
'time_before',
5454
]);
5555

5656
$points = new backup_nested_element('points');
@@ -63,7 +63,7 @@ protected function define_structure() {
6363
'ins_f',
6464
'max_grade',
6565
'res_type',
66-
'file_size'
66+
'file_size',
6767
]);
6868

6969
$responses = new backup_nested_element('responses');
@@ -75,7 +75,7 @@ protected function define_structure() {
7575
'response',
7676
'ex_comment',
7777
'timecreated',
78-
'timemodified'
78+
'timemodified',
7979
]);
8080

8181
$sessions = new backup_nested_element('sessions');
@@ -87,7 +87,7 @@ protected function define_structure() {
8787
'state',
8888
'start_time',
8989
'finish_time',
90-
'ex_comment'
90+
'ex_comment',
9191
]);
9292

9393
$timeslots = new backup_nested_element('timeslots');
@@ -99,7 +99,7 @@ protected function define_structure() {
9999
'observer_id',
100100
'observee_id',
101101
'observer_event_id',
102-
'observee_event_id'
102+
'observee_event_id',
103103
]);
104104

105105
// Timeslots tree.

classes/calendar_signup.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static function calendar_signup_view(int $observationid, string $title, i
6666

6767
return (object) [
6868
"daynum" => $daynum,
69-
"events" => []
69+
"events" => [],
7070
];
7171
}, $monthdays, array_keys($monthdays));
7272

@@ -117,7 +117,7 @@ public static function calendar_signup_view(int $observationid, string $title, i
117117
'monthname' => date('F', mktime(0, 0, 0, $month, 10)),
118118
'nextbtn' => $nextmonthbtn,
119119
'prevbtn' => $prevmonthbtn,
120-
'entries' => $weeks
120+
'entries' => $weeks,
121121
];
122122

123123
return $OUTPUT->render_from_template('mod_observation/calendar_signup', $templatedata);

classes/form/notificationeditor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function definition() {
5757
$intervalselector = [
5858
$mform->createElement('text', 'interval_amount'),
5959
$mform->createElement('select', 'interval_multiplier', '', $options),
60-
$mform->createElement('submit', 'submit_btn', get_string('create', 'observation'))
60+
$mform->createElement('submit', 'submit_btn', get_string('create', 'observation')),
6161
];
6262

6363
$mform->addGroup($intervalselector, 'select_group', get_string('receivenotification', 'observation'), null, false);

classes/form/pointeditor.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ public function definition() {
4848
$mform->addElement('header', 'gradingsettings', get_string('grading', 'observation'));
4949

5050
// Point type selection.
51-
$radioarray = array();
51+
$radioarray = [];
5252
$radioarray[] = $mform->createElement('radio', 'res_type', '', get_string('textinputtype', 'observation'), 0);
5353
$radioarray[] = $mform->createElement('radio', 'res_type', '', get_string('passfailtype', 'observation'), 1);
5454
$radioarray[] = $mform->createElement('radio', 'res_type', '', get_string('evidencetype', 'observation'), 2);
5555

56-
$mform->addGroup($radioarray, 'radioar', get_string('obpointtype', 'observation'), array(' '), false);
56+
$mform->addGroup($radioarray, 'radioar', get_string('obpointtype', 'observation'), [' '], false);
5757
$mform->setDefault('type', 0);
5858

5959
// Evidence file size.

classes/form/pointmarking.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ public function definition() {
6868
break;
6969
// Pass/Fail type.
7070
case \mod_observation\observation_manager::INPUT_PASSFAIL:
71-
$radioarray = array();
71+
$radioarray = [];
7272
$radioarray[] = $mform->createElement('radio', 'response', '', get_string('pass', 'observation'), 'Pass');
7373
$radioarray[] = $mform->createElement('radio', 'response', '', get_string('fail', 'observation'), 'Fail');
74-
$mform->addGroup($radioarray, 'radioar', get_string('passfailtype', 'observation'), array(' '), false);
74+
$mform->addGroup($radioarray, 'radioar', get_string('passfailtype', 'observation'), [' '], false);
7575
$mform->setType('response', PARAM_TEXT);
7676
$mform->addRule('radioar', get_string('required', 'observation'), 'required', null, 'client');
7777
break;
7878
case \mod_observation\observation_manager::INPUT_EVIDENCE:
7979
// Image upload here.
8080
$maxbytes = $prefill['file_size'];
8181
$mform->addElement('filemanager', 'response', get_string('evidenceupload', 'observation'), null,
82-
array('subdirs' => 0, 'maxbytes' => $maxbytes, 'areamaxbytes' => $maxbytes, 'maxfiles' => 1,
83-
'accepted_types' => 'audio,video,image,document'));
82+
['subdirs' => 0, 'maxbytes' => $maxbytes, 'areamaxbytes' => $maxbytes, 'maxfiles' => 1,
83+
'accepted_types' => 'audio,video,image,document']);
8484
$mform->setType('response', PARAM_INT);
8585
$mform->addRule('response', get_string('required', 'observation'), 'required', null, 'client');
8686
break;

classes/form/startsession.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public function definition() {
6060
$finalusers[$u->id] = fullname($u);
6161
}
6262

63-
$options = array(
63+
$options = [
6464
'multiple' => false,
65-
);
65+
];
6666

6767
$mform->addElement('text', 'observername', get_string('observer', 'observation'));
6868
$mform->setDefault('observername', fullname($USER));

classes/form/timesloteditor.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function definition() {
7575

7676
$intervalselector = [
7777
$mform->createElement('text', 'interval_amount'),
78-
$mform->createElement('select', 'interval_multiplier', '', $options)
78+
$mform->createElement('select', 'interval_multiplier', '', $options),
7979
];
8080
$mform->addGroup($intervalselector, 'interval_select_group', get_string('repeatevery', 'observation'), null, false);
8181
$mform->disabledIf('interval_select_group', 'enable_interval');
@@ -97,10 +97,10 @@ public function definition() {
9797
foreach ($users as $user) {
9898
$finalusers[$user->id] = fullname($user);
9999
}
100-
$options = array(
100+
$options = [
101101
'multiple' => false,
102102
'noselectionstring' => get_string('allareas', 'search'),
103-
);
103+
];
104104
$mform->addElement('header', 'selecting_observer', get_string('selecting_observer', 'observation'));
105105
$mform->addElement('autocomplete', 'observer_id', get_string('teacher', 'observation'), $finalusers, $options);
106106

classes/form/upcomingfilter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function definition() {
5858
$intervalselector = [
5959
$mform->createElement('text', 'interval_amount'),
6060
$mform->createElement('select', 'interval_multiplier', '', $options),
61-
$mform->createElement('submit', 'submit_btn', $buttontext)
61+
$mform->createElement('submit', 'submit_btn', $buttontext),
6262
];
6363

6464
// Interval selector block.

classes/instructions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class instructions {
4646
* @return string formatted html to be displays encoded as a string
4747
**/
4848
public static function observation_instructions(?string $heading, ?string $bodytext, ?int $bodyformat, int $headinglevel = 3,
49-
string $defaultmessage = null): string {
49+
?string $defaultmessage = null): string {
5050

5151
global $OUTPUT;
5252
// Can't set function values as default parameters, so do it here.

classes/observation_manager.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public static function delete_observation_point(int $observationid, int $obpoint
210210
"obs_id = :obsid AND list_order > :listorder",
211211
[
212212
'obsid' => $observationid,
213-
'listorder' => $currentpoint->list_order
213+
'listorder' => $currentpoint->list_order,
214214
]
215215
);
216216

@@ -225,7 +225,7 @@ public static function delete_observation_point(int $observationid, int $obpoint
225225
'observation_points',
226226
[
227227
'id' => $pointabove->id,
228-
'list_order' => $pointabove->list_order - 1
228+
'list_order' => $pointabove->list_order - 1,
229229
]
230230
);
231231
}
@@ -290,7 +290,7 @@ public static function reorder_observation_point(int $observationid, int $obpoin
290290
$DB->update_record('observation_points',
291291
[
292292
'id' => $targetpoint->id,
293-
'list_order' => $newordering
293+
'list_order' => $newordering,
294294
]);
295295

296296
// Reduce the direction to a unit vector (e.g. 5 -> 1 and -5 -> -1).
@@ -301,7 +301,7 @@ public static function reorder_observation_point(int $observationid, int $obpoin
301301
$DB->update_record('observation_points',
302302
[
303303
'id' => $e->id,
304-
'list_order' => $e->list_order - $reductionamount
304+
'list_order' => $e->list_order - $reductionamount,
305305
]);
306306
}, $affectedpoints);
307307

@@ -368,7 +368,7 @@ public static function submit_point_response(int $sessionid, int $pointid, $data
368368
'grade_given' => $data->grade_given,
369369
'response' => $data->response,
370370
'ex_comment' => $data->ex_comment,
371-
'timemodified' => time()
371+
'timemodified' => time(),
372372
];
373373

374374
if ($existingresponse === false) {
@@ -447,7 +447,7 @@ public static function format_points_and_responses($observationid, $sessionid) {
447447
$item->title,
448448
$item->response,
449449
$item->grade_given,
450-
$item->ex_comment
450+
$item->ex_comment,
451451
];
452452
}, $pointsandresponses);
453453

classes/privacy/provider.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class provider implements
4848
* @param collection $collection The initialised collection to add items to.
4949
* @return collection A listing of user data stored through this system.
5050
*/
51-
public static function get_metadata(collection $collection) : collection {
51+
public static function get_metadata(collection $collection): collection {
5252

5353
$collection->add_subsystem_link(
5454
'core_files',
@@ -75,7 +75,7 @@ public static function get_metadata(collection $collection) : collection {
7575
'response' => 'privacy:metadata:observation_point_responses:response',
7676
'ex_comment' => 'privacy:metadata:observation_point_responses:ex_comment',
7777
'timecreated' => 'privacy:metadata:observation_point_responses:timecreated',
78-
'timemodified' => 'privacy:metadata:observation_point_responses:timemodified'
78+
'timemodified' => 'privacy:metadata:observation_point_responses:timemodified',
7979
],
8080
'privacy:metadata:observation_point_responses'
8181
);
@@ -113,7 +113,7 @@ public static function get_metadata(collection $collection) : collection {
113113
* @param int $userid The user to search.
114114
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
115115
*/
116-
public static function get_contexts_for_userid(int $userid) : contextlist {
116+
public static function get_contexts_for_userid(int $userid): contextlist {
117117
$contextlist = new contextlist();
118118

119119
$params = [
@@ -208,7 +208,7 @@ public static function export_user_data(approved_contextlist $contextlist) {
208208
// Get all timeslot records where the user is a part of them.
209209
$timeslots = $DB->get_records_select('observation_timeslots', 'observer_id = :userid1 OR observee_id = :userid2', [
210210
'userid1' => $userid,
211-
'userid2' => $userid
211+
'userid2' => $userid,
212212
]);
213213

214214
$data->timeslots = $timeslots;
@@ -249,7 +249,7 @@ public static function delete_data_for_user(approved_contextlist $contextlist) {
249249
// Delete all timeslot records where the user is a part of them.
250250
$DB->delete_records_select('observation_timeslots', 'observer_id = :userid1 OR observee_id = :userid2', [
251251
'userid1' => $userid,
252-
'userid2' => $userid
252+
'userid2' => $userid,
253253
]);
254254
}
255255
}
@@ -291,7 +291,7 @@ public static function delete_data_for_users(approved_userlist $userlist) {
291291
// Delete all timeslot records where the user is a part of them.
292292
$DB->delete_records_select('observation_timeslots', 'observer_id = :userid1 OR observee_id = :userid2', [
293293
'userid1' => $userid,
294-
'userid2' => $userid
294+
'userid2' => $userid,
295295
]);
296296
}
297297
}
@@ -301,7 +301,7 @@ public static function delete_data_for_users(approved_userlist $userlist) {
301301
*
302302
* @param context $context The specific context to delete data for.
303303
*/
304-
public static function delete_data_for_all_users_in_context (\context $context) {
304+
public static function delete_data_for_all_users_in_context(\context $context) {
305305
global $DB;
306306

307307
if ($context->contextlevel != CONTEXT_MODULE) {

classes/session_manager.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static function start_session(int $obsid, int $observerid, int $observeei
9393
'observee_id' => $observeeid,
9494
'observer_id' => $observerid,
9595
'state' => self::SESSION_INPROGRESS,
96-
'start_time' => time()
96+
'start_time' => time(),
9797
];
9898

9999
return $DB->insert_record('observation_sessions', $data, true);
@@ -116,7 +116,7 @@ public static function get_session_info(int $sessionid) {
116116
'ex_comment' => $sessiondata->ex_comment,
117117
'state' => $sessiondata->state,
118118
'observee' => $sessiondata->observee_id,
119-
'observer' => $sessiondata->observer_id
119+
'observer' => $sessiondata->observer_id,
120120
];
121121
}
122122

@@ -174,7 +174,7 @@ public static function calculate_grade(int $sessionid) {
174174

175175
return [
176176
'total' => array_sum($givengrades),
177-
'max' => array_sum($maxgrades)
177+
'max' => array_sum($maxgrades),
178178
];
179179
}
180180

@@ -275,7 +275,7 @@ public static function update_session_grade(int $sessionid, int $gradegiven, int
275275
'gradetype' => 1,
276276
'grademax' => $maxgrade,
277277
'grademin' => $mingrade,
278-
'itemname' => $cm->name . ' - ' . get_string('gradeitemname', 'observation')
278+
'itemname' => $cm->name . ' - ' . get_string('gradeitemname', 'observation'),
279279
];
280280

281281
$grade = [
@@ -285,7 +285,7 @@ public static function update_session_grade(int $sessionid, int $gradegiven, int
285285
'datesubmitted' => time(),
286286
'dategraded' => time(),
287287
'feedbackformat' => FORMAT_PLAIN,
288-
'feedback' => $sessioninfo['ex_comment']
288+
'feedback' => $sessioninfo['ex_comment'],
289289
];
290290

291291
return \grade_update('mod/observation', $course->id, 'mod', 'observation', $obid, 0, $grade, $params);

classes/table/notifications/notifications_display.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function notifications_table(int $observationid, int $userid, \moo
4848
'fields' => 'obn.id AS id, time_before, start_time',
4949
'from' => '{observation_notifications} obn LEFT JOIN {observation_timeslots} ot ON obn.timeslot_id = ot.id',
5050
'where' => 'ot.observee_id = :userid AND ot.obs_id = :obsid',
51-
'params' => ['userid' => $userid, 'obsid' => $observationid]
51+
'params' => ['userid' => $userid, 'obsid' => $observationid],
5252
];
5353

5454
return $table->out($table->pagesize, true);

classes/table/notifications/notifications_table.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ public function __construct(string $uniqueid, \moodle_url $callbackurl, int $per
5050
$columns = [
5151
'id',
5252
'time_before',
53-
'actions'
53+
'actions',
5454
];
5555

5656
$headers = [
5757
get_string('id', 'observation'),
5858
get_string('notifyon', 'observation'),
59-
get_string('actions', 'observation')
59+
get_string('actions', 'observation'),
6060
];
6161

6262
$this->define_columns($columns);

classes/table/timeslots/timeslots_display.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class timeslots_display {
7878
'from' => '{observation_timeslots} ot
7979
LEFT JOIN {user} u ON ot.observer_id = u.id
8080
LEFT JOIN {user} o on ot.observee_id = o.id',
81-
'where' => 'obs_id = :obsid'
81+
'where' => 'obs_id = :obsid',
8282
];
8383

8484
/**

classes/table/viewpoints/viewpoints_display.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function ob_point_table(int $observationid, \moodle_url $callbacku
4848
'fields' => 'op.*, ortm.lang_string',
4949
'from' => '{observation_points} op LEFT JOIN {observation_res_type_map} ortm ON op.res_type = ortm.res_type',
5050
'where' => 'obs_id = :obsid',
51-
'params' => ['obsid' => $observationid]
51+
'params' => ['obsid' => $observationid],
5252
];
5353
$table->sql = $sql;
5454
return $table->out($table->pagesize, true);

classes/table/viewpoints/viewpoints_table.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ class viewpoints_table extends \table_sql implements \renderable {
4242
* Constructs the table and defines how the data from the SQL query is displayed
4343
* @param string $uniqueid ID that uniquely identifies this element on the HTML page
4444
* @param \moodle_url $callbackurl URL used for callback for action buttons in the table
45-
* @param int $displaymode display mode for table
45+
* @param int|null $displaymode display mode for table
4646
* @param int $perpage number of entries per page for the table
4747
*/
48-
public function __construct(string $uniqueid, \moodle_url $callbackurl, int $displaymode = null, int $perpage = 50) {
48+
public function __construct(string $uniqueid, \moodle_url $callbackurl, ?int $displaymode = null, int $perpage = 50) {
4949
parent::__construct($uniqueid);
5050

5151
$this->define_columns([

0 commit comments

Comments
 (0)