Skip to content

Commit

Permalink
MDL-65292 style: Fix all function declarations white space
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stronk7 committed Feb 28, 2024
1 parent e567c21 commit ba1f804
Show file tree
Hide file tree
Showing 972 changed files with 2,098 additions and 2,094 deletions.
2 changes: 1 addition & 1 deletion admin/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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';
}
}
4 changes: 2 additions & 2 deletions admin/presets/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class provider implements
* @param collection $collection A list of information about this component
* @return collection The collection object filled out with information about this component.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
// These tables are really data about site configuration and not user data.

// The adminpresets includes information about which user performed a configuration change using the admin_presets
Expand Down Expand Up @@ -74,7 +74,7 @@ public static function get_metadata(collection $collection) : collection {
* @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 {
return new contextlist();
}

Expand Down
2 changes: 1 addition & 1 deletion admin/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ public function cron_overdue_warning($cronoverdue) {
* @param bool $croninfrequent
* @return string HTML to output.
*/
public function cron_infrequent_warning(bool $croninfrequent) : string {
public function cron_infrequent_warning(bool $croninfrequent): string {
global $CFG;

if (!$croninfrequent) {
Expand Down
4 changes: 2 additions & 2 deletions admin/roles/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class provider implements
* @param collection $collection An object for storing metadata.
* @return collection The metadata.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$rolecapabilities = [
'roleid' => 'privacy:metadata:role_capabilities:roleid',
'capability' => 'privacy:metadata:role_capabilities:capability',
Expand Down Expand Up @@ -100,7 +100,7 @@ public static function export_user_preferences(int $userid) {
* @param int $userid The user ID.
* @return contextlist The list of context IDs.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
global $DB;

$contextlist = new contextlist();
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/admin_presets/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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';
}
}
2 changes: 1 addition & 1 deletion admin/tool/analytics/classes/output/form/import_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class import_model extends \moodleform {
*
* @return null
*/
public function definition () {
public function definition() {
$mform = $this->_form;

$mform->addElement('header', 'settingsheader', get_string('importmodel', 'tool_analytics'));
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/analytics/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}
2 changes: 1 addition & 1 deletion admin/tool/behat/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}
2 changes: 1 addition & 1 deletion admin/tool/brickfield/classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function notvalidatedalert(): string {
* @throws \coding_exception
* @throws \moodle_exception
*/
public function analysisbutton(int $courseid) : string {
public function analysisbutton(int $courseid): string {
$link = new moodle_url(accessibility::get_plugin_url(), [
'action' => 'requestanalysis',
'courseid' => $courseid
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/brickfield/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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';
}
}
2 changes: 1 addition & 1 deletion admin/tool/capability/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}
4 changes: 2 additions & 2 deletions admin/tool/cohortroles/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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 {
// The tool_cohortroles plugin utilises the mdl_tool_cohortroles table.
$collection->add_database_table(
'tool_cohortroles',
Expand All @@ -77,7 +77,7 @@ public static function get_metadata(collection $collection) : collection {
* @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();

// When we process user deletions and expiries, we always delete from the user context.
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/componentlibrary/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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';
}
}
2 changes: 1 addition & 1 deletion admin/tool/customlang/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function test_fix_syntax(string $text, int $version, ?int $fromversion, s
*
* @return array
*/
public function fix_syntax_data() : array {
public function fix_syntax_data(): array {
return [
// Syntax sanity v1 strings.
[
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/customlang/tests/local/mlang/phpparser_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function test_parse(string $phpcode, array $expected, bool $exception): v
*
* @return array
*/
public function parse_provider() : array {
public function parse_provider(): array {
return [
'Invalid PHP code' => [
'No PHP code', [], false
Expand Down
8 changes: 4 additions & 4 deletions admin/tool/dataprivacy/classes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public static function get_assigned_privacy_officer_roles() {
*
* @return array An array of the DPO role shortnames
*/
public static function get_dpo_role_names() : array {
public static function get_dpo_role_names(): array {
global $DB;

$dporoleids = self::get_assigned_privacy_officer_roles();
Expand Down Expand Up @@ -524,7 +524,7 @@ public static function has_ongoing_request($userid, $type) {
* @param array $userids
* @return array
*/
public static function find_ongoing_request_types_for_users(array $userids) : array {
public static function find_ongoing_request_types_for_users(array $userids): array {
global $DB;

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

// Create the approved contextlist collection object.
$approvedcollection = new contextlist_collection($collection->get_userid());
Expand Down Expand Up @@ -1326,7 +1326,7 @@ public static function set_context_defaults($contextlevel, $categoryid, $purpose
* @param \DateInterval $interval
* @return string
*/
public static function format_retention_period(\DateInterval $interval) : string {
public static function format_retention_period(\DateInterval $interval): string {
// It is one or another.
if ($interval->y) {
$formattedtime = get_string('numyears', 'moodle', $interval->format('%y'));
Expand Down
6 changes: 3 additions & 3 deletions admin/tool/dataprivacy/classes/data_request.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public static function expire($expiredrequests) {
*
* @return bool
*/
public function is_resettable() : bool {
public function is_resettable(): bool {
if (api::DATAREQUEST_TYPE_OTHERS == $this->get('type')) {
// It is not possible to reset 'other' reqeusts.
return false;
Expand All @@ -260,7 +260,7 @@ public function is_resettable() : bool {
*
* @return bool
*/
public function is_active() : bool {
public function is_active(): bool {
$active = [
api::DATAREQUEST_STATUS_APPROVED => true,
];
Expand All @@ -275,7 +275,7 @@ public function is_active() : bool {
*
* @return self
*/
public function resubmit_request() : data_request {
public function resubmit_request(): data_request {
if ($this->is_active()) {
$this->set('status', api::DATAREQUEST_STATUS_REJECTED)->save();
}
Expand Down
20 changes: 10 additions & 10 deletions admin/tool/dataprivacy/classes/expired_context.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public static function get_record_count_by_contextlevel($contextlevel = null, $s
* @param int[] $roleids
* @return expired_context
*/
protected function set_roleids_for(string $field, array $roleids) : expired_context {
protected function set_roleids_for(string $field, array $roleids): expired_context {
$roledata = json_encode($roleids);

$this->raw_set($field, $roledata);
Expand Down Expand Up @@ -211,7 +211,7 @@ protected function get_roleids_for(string $field) {
* @param int[] $roleids
* @return expired_context
*/
protected function set_unexpiredroles(array $roleids) : expired_context {
protected function set_unexpiredroles(array $roleids): expired_context {
$this->set_roleids_for('unexpiredroles', $roleids);

return $this;
Expand All @@ -223,7 +223,7 @@ protected function set_unexpiredroles(array $roleids) : expired_context {
* @param int[] $roleids
* @return expired_context
*/
public function add_expiredroles(array $roleids) : expired_context {
public function add_expiredroles(array $roleids): expired_context {
$existing = $this->get('expiredroles');
$newvalue = array_merge($existing, $roleids);

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

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

return $this;
Expand Down Expand Up @@ -285,7 +285,7 @@ protected function get_unexpiredroles() {
* @param boolean $save
* @return expired_context
*/
public static function create_from_expiry_info(\context $context, expiry_info $info, bool $save = true) : expired_context {
public static function create_from_expiry_info(\context $context, expiry_info $info, bool $save = true): expired_context {
$record = (object) [
'contextid' => $context->id,
'status' => self::STATUS_EXPIRED,
Expand All @@ -309,7 +309,7 @@ public static function create_from_expiry_info(\context $context, expiry_info $i
* @param expiry_info $info
* @return $this
*/
public function update_from_expiry_info(expiry_info $info) : expired_context {
public function update_from_expiry_info(expiry_info $info): expired_context {
$save = false;

// Compare the expiredroles.
Expand Down Expand Up @@ -353,7 +353,7 @@ public function update_from_expiry_info(expiry_info $info) : expired_context {
*
* @return bool
*/
public function can_process_deletion() : bool {
public function can_process_deletion(): bool {
return ($this->get('status') == self::STATUS_APPROVED);
}

Expand All @@ -362,7 +362,7 @@ public function can_process_deletion() : bool {
*
* @return bool
*/
public function is_complete() : bool {
public function is_complete(): bool {
return ($this->get('status') == self::STATUS_CLEANED);
}

Expand All @@ -372,7 +372,7 @@ public function is_complete() : bool {
*
* @return bool
*/
public function is_fully_expired() : bool {
public function is_fully_expired(): bool {
return $this->get('defaultexpired') && empty($this->get('unexpiredroles'));
}
}
Loading

0 comments on commit ba1f804

Please sign in to comment.