Skip to content

Commit ba1f804

Browse files
committed
MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all them part of the Moodle's CodeSniffer standard: - PSR12.Functions.ReturnTypeDeclaration - PSR12.Functions.NullableTypeDeclaration - moodle.Methods.MethodDeclarationSpacing - Squiz.Whitespace.ScopeKeywordSpacing All them are, exclusively, about correct spacing, so the changes are, all them, only white space changes. Only exceptions to the above are 3 changes what were setting the return type in a new line, and, when that happens, the closing parenthesis (bracket) has to go to the same line than the colon.
1 parent e567c21 commit ba1f804

File tree

972 files changed

+2098
-2094
lines changed

Some content is hidden

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

972 files changed

+2098
-2094
lines changed

admin/classes/privacy/provider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
3535
*
3636
* @return string
3737
*/
38-
public static function get_reason() : string {
38+
public static function get_reason(): string {
3939
return 'privacy:metadata';
4040
}
4141
}

admin/presets/classes/privacy/provider.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class provider implements
4141
* @param collection $collection A list of information about this component
4242
* @return collection The collection object filled out with information about this component.
4343
*/
44-
public static function get_metadata(collection $collection) : collection {
44+
public static function get_metadata(collection $collection): collection {
4545
// These tables are really data about site configuration and not user data.
4646

4747
// The adminpresets includes information about which user performed a configuration change using the admin_presets
@@ -74,7 +74,7 @@ public static function get_metadata(collection $collection) : collection {
7474
* @param int $userid The user to search.
7575
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
7676
*/
77-
public static function get_contexts_for_userid(int $userid) : contextlist {
77+
public static function get_contexts_for_userid(int $userid): contextlist {
7878
return new contextlist();
7979
}
8080

admin/renderer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ public function cron_overdue_warning($cronoverdue) {
617617
* @param bool $croninfrequent
618618
* @return string HTML to output.
619619
*/
620-
public function cron_infrequent_warning(bool $croninfrequent) : string {
620+
public function cron_infrequent_warning(bool $croninfrequent): string {
621621
global $CFG;
622622

623623
if (!$croninfrequent) {

admin/roles/classes/privacy/provider.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class provider implements
5353
* @param collection $collection An object for storing metadata.
5454
* @return collection The metadata.
5555
*/
56-
public static function get_metadata(collection $collection) : collection {
56+
public static function get_metadata(collection $collection): collection {
5757
$rolecapabilities = [
5858
'roleid' => 'privacy:metadata:role_capabilities:roleid',
5959
'capability' => 'privacy:metadata:role_capabilities:capability',
@@ -100,7 +100,7 @@ public static function export_user_preferences(int $userid) {
100100
* @param int $userid The user ID.
101101
* @return contextlist The list of context IDs.
102102
*/
103-
public static function get_contexts_for_userid(int $userid) : contextlist {
103+
public static function get_contexts_for_userid(int $userid): contextlist {
104104
global $DB;
105105

106106
$contextlist = new contextlist();

admin/tool/admin_presets/classes/privacy/provider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
3131
*
3232
* @return string
3333
*/
34-
public static function get_reason() : string {
34+
public static function get_reason(): string {
3535
return 'privacy:metadata';
3636
}
3737
}

admin/tool/analytics/classes/output/form/import_model.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class import_model extends \moodleform {
4242
*
4343
* @return null
4444
*/
45-
public function definition () {
45+
public function definition() {
4646
$mform = $this->_form;
4747

4848
$mform->addElement('header', 'settingsheader', get_string('importmodel', 'tool_analytics'));

admin/tool/analytics/classes/privacy/provider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
4040
*
4141
* @return string
4242
*/
43-
public static function get_reason() : string {
43+
public static function get_reason(): string {
4444
return 'privacy:metadata';
4545
}
4646
}

admin/tool/availabilityconditions/classes/privacy/provider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
4040
*
4141
* @return string
4242
*/
43-
public static function get_reason() : string {
43+
public static function get_reason(): string {
4444
return 'privacy:metadata';
4545
}
4646
}

admin/tool/behat/classes/privacy/provider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
4040
*
4141
* @return string
4242
*/
43-
public static function get_reason() : string {
43+
public static function get_reason(): string {
4444
return 'privacy:metadata';
4545
}
4646
}

admin/tool/brickfield/classes/output/renderer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function notvalidatedalert(): string {
157157
* @throws \coding_exception
158158
* @throws \moodle_exception
159159
*/
160-
public function analysisbutton(int $courseid) : string {
160+
public function analysisbutton(int $courseid): string {
161161
$link = new moodle_url(accessibility::get_plugin_url(), [
162162
'action' => 'requestanalysis',
163163
'courseid' => $courseid

admin/tool/brickfield/classes/privacy/provider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
3030
*
3131
* @return string
3232
*/
33-
public static function get_reason() : string {
33+
public static function get_reason(): string {
3434
return 'privacy:metadata';
3535
}
3636
}

admin/tool/capability/classes/privacy/provider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
4040
*
4141
* @return string
4242
*/
43-
public static function get_reason() : string {
43+
public static function get_reason(): string {
4444
return 'privacy:metadata';
4545
}
4646
}

admin/tool/cohortroles/classes/privacy/provider.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class provider implements
5252
* @param collection $collection The initialised collection to add items to.
5353
* @return collection A listing of user data stored through this system.
5454
*/
55-
public static function get_metadata(collection $collection) : collection {
55+
public static function get_metadata(collection $collection): collection {
5656
// The tool_cohortroles plugin utilises the mdl_tool_cohortroles table.
5757
$collection->add_database_table(
5858
'tool_cohortroles',
@@ -77,7 +77,7 @@ public static function get_metadata(collection $collection) : collection {
7777
* @param int $userid The user to search.
7878
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
7979
*/
80-
public static function get_contexts_for_userid(int $userid) : contextlist {
80+
public static function get_contexts_for_userid(int $userid): contextlist {
8181
$contextlist = new contextlist();
8282

8383
// When we process user deletions and expiries, we always delete from the user context.

admin/tool/componentlibrary/classes/privacy/provider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
3030
*
3131
* @return string
3232
*/
33-
public static function get_reason() : string {
33+
public static function get_reason(): string {
3434
return 'privacy:metadata';
3535
}
3636
}

admin/tool/customlang/classes/privacy/provider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
4040
*
4141
* @return string
4242
*/
43-
public static function get_reason() : string {
43+
public static function get_reason(): string {
4444
return 'privacy:metadata';
4545
}
4646
}

admin/tool/customlang/tests/local/mlang/langstring_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function test_fix_syntax(string $text, int $version, ?int $fromversion, s
6060
*
6161
* @return array
6262
*/
63-
public function fix_syntax_data() : array {
63+
public function fix_syntax_data(): array {
6464
return [
6565
// Syntax sanity v1 strings.
6666
[

admin/tool/customlang/tests/local/mlang/phpparser_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function test_parse(string $phpcode, array $expected, bool $exception): v
7979
*
8080
* @return array
8181
*/
82-
public function parse_provider() : array {
82+
public function parse_provider(): array {
8383
return [
8484
'Invalid PHP code' => [
8585
'No PHP code', [], false

admin/tool/dataprivacy/classes/api.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public static function get_assigned_privacy_officer_roles() {
168168
*
169169
* @return array An array of the DPO role shortnames
170170
*/
171-
public static function get_dpo_role_names() : array {
171+
public static function get_dpo_role_names(): array {
172172
global $DB;
173173

174174
$dporoleids = self::get_assigned_privacy_officer_roles();
@@ -524,7 +524,7 @@ public static function has_ongoing_request($userid, $type) {
524524
* @param array $userids
525525
* @return array
526526
*/
527-
public static function find_ongoing_request_types_for_users(array $userids) : array {
527+
public static function find_ongoing_request_types_for_users(array $userids): array {
528528
global $DB;
529529

530530
if (empty($userids)) {
@@ -1201,7 +1201,7 @@ public static function set_expired_context_status(expired_context $expiredctx, $
12011201
* @return contextlist_collection The collection of approved_contextlist objects.
12021202
*/
12031203
public static function get_approved_contextlist_collection_for_collection(contextlist_collection $collection,
1204-
\stdClass $foruser, int $type) : contextlist_collection {
1204+
\stdClass $foruser, int $type): contextlist_collection {
12051205

12061206
// Create the approved contextlist collection object.
12071207
$approvedcollection = new contextlist_collection($collection->get_userid());
@@ -1326,7 +1326,7 @@ public static function set_context_defaults($contextlevel, $categoryid, $purpose
13261326
* @param \DateInterval $interval
13271327
* @return string
13281328
*/
1329-
public static function format_retention_period(\DateInterval $interval) : string {
1329+
public static function format_retention_period(\DateInterval $interval): string {
13301330
// It is one or another.
13311331
if ($interval->y) {
13321332
$formattedtime = get_string('numyears', 'moodle', $interval->format('%y'));

admin/tool/dataprivacy/classes/data_request.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public static function expire($expiredrequests) {
241241
*
242242
* @return bool
243243
*/
244-
public function is_resettable() : bool {
244+
public function is_resettable(): bool {
245245
if (api::DATAREQUEST_TYPE_OTHERS == $this->get('type')) {
246246
// It is not possible to reset 'other' reqeusts.
247247
return false;
@@ -260,7 +260,7 @@ public function is_resettable() : bool {
260260
*
261261
* @return bool
262262
*/
263-
public function is_active() : bool {
263+
public function is_active(): bool {
264264
$active = [
265265
api::DATAREQUEST_STATUS_APPROVED => true,
266266
];
@@ -275,7 +275,7 @@ public function is_active() : bool {
275275
*
276276
* @return self
277277
*/
278-
public function resubmit_request() : data_request {
278+
public function resubmit_request(): data_request {
279279
if ($this->is_active()) {
280280
$this->set('status', api::DATAREQUEST_STATUS_REJECTED)->save();
281281
}

admin/tool/dataprivacy/classes/expired_context.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public static function get_record_count_by_contextlevel($contextlevel = null, $s
182182
* @param int[] $roleids
183183
* @return expired_context
184184
*/
185-
protected function set_roleids_for(string $field, array $roleids) : expired_context {
185+
protected function set_roleids_for(string $field, array $roleids): expired_context {
186186
$roledata = json_encode($roleids);
187187

188188
$this->raw_set($field, $roledata);
@@ -211,7 +211,7 @@ protected function get_roleids_for(string $field) {
211211
* @param int[] $roleids
212212
* @return expired_context
213213
*/
214-
protected function set_unexpiredroles(array $roleids) : expired_context {
214+
protected function set_unexpiredroles(array $roleids): expired_context {
215215
$this->set_roleids_for('unexpiredroles', $roleids);
216216

217217
return $this;
@@ -223,7 +223,7 @@ protected function set_unexpiredroles(array $roleids) : expired_context {
223223
* @param int[] $roleids
224224
* @return expired_context
225225
*/
226-
public function add_expiredroles(array $roleids) : expired_context {
226+
public function add_expiredroles(array $roleids): expired_context {
227227
$existing = $this->get('expiredroles');
228228
$newvalue = array_merge($existing, $roleids);
229229

@@ -238,7 +238,7 @@ public function add_expiredroles(array $roleids) : expired_context {
238238
* @param int[] $roleids
239239
* @return unexpired_context
240240
*/
241-
public function add_unexpiredroles(array $roleids) : expired_context {
241+
public function add_unexpiredroles(array $roleids): expired_context {
242242
$existing = $this->get('unexpiredroles');
243243
$newvalue = array_merge($existing, $roleids);
244244

@@ -253,7 +253,7 @@ public function add_unexpiredroles(array $roleids) : expired_context {
253253
* @param int[] $roleids
254254
* @return expired_context
255255
*/
256-
protected function set_expiredroles(array $roleids) : expired_context {
256+
protected function set_expiredroles(array $roleids): expired_context {
257257
$this->set_roleids_for('expiredroles', $roleids);
258258

259259
return $this;
@@ -285,7 +285,7 @@ protected function get_unexpiredroles() {
285285
* @param boolean $save
286286
* @return expired_context
287287
*/
288-
public static function create_from_expiry_info(\context $context, expiry_info $info, bool $save = true) : expired_context {
288+
public static function create_from_expiry_info(\context $context, expiry_info $info, bool $save = true): expired_context {
289289
$record = (object) [
290290
'contextid' => $context->id,
291291
'status' => self::STATUS_EXPIRED,
@@ -309,7 +309,7 @@ public static function create_from_expiry_info(\context $context, expiry_info $i
309309
* @param expiry_info $info
310310
* @return $this
311311
*/
312-
public function update_from_expiry_info(expiry_info $info) : expired_context {
312+
public function update_from_expiry_info(expiry_info $info): expired_context {
313313
$save = false;
314314

315315
// Compare the expiredroles.
@@ -353,7 +353,7 @@ public function update_from_expiry_info(expiry_info $info) : expired_context {
353353
*
354354
* @return bool
355355
*/
356-
public function can_process_deletion() : bool {
356+
public function can_process_deletion(): bool {
357357
return ($this->get('status') == self::STATUS_APPROVED);
358358
}
359359

@@ -362,7 +362,7 @@ public function can_process_deletion() : bool {
362362
*
363363
* @return bool
364364
*/
365-
public function is_complete() : bool {
365+
public function is_complete(): bool {
366366
return ($this->get('status') == self::STATUS_CLEANED);
367367
}
368368

@@ -372,7 +372,7 @@ public function is_complete() : bool {
372372
*
373373
* @return bool
374374
*/
375-
public function is_fully_expired() : bool {
375+
public function is_fully_expired(): bool {
376376
return $this->get('defaultexpired') && empty($this->get('unexpiredroles'));
377377
}
378378
}

0 commit comments

Comments
 (0)