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

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

View file

@ -41,7 +41,7 @@ class provider implements
* @param collection $collection A list of information about this component * @param collection $collection A list of information about this component
* @return collection The collection object filled out with 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. // 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 // The adminpresets includes information about which user performed a configuration change using the admin_presets
@ -74,7 +74,7 @@ class provider implements
* @param int $userid The user to search. * @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin. * @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(); return new contextlist();
} }

View file

@ -617,7 +617,7 @@ class core_admin_renderer extends plugin_renderer_base {
* @param bool $croninfrequent * @param bool $croninfrequent
* @return string HTML to output. * @return string HTML to output.
*/ */
public function cron_infrequent_warning(bool $croninfrequent) : string { public function cron_infrequent_warning(bool $croninfrequent): string {
global $CFG; global $CFG;
if (!$croninfrequent) { if (!$croninfrequent) {

View file

@ -99,7 +99,7 @@ abstract class core_role_allow_role_page {
* @param int $fromroleid * @param int $fromroleid
* @param int $targetroleid * @param int $targetroleid
*/ */
protected abstract function set_allow($fromroleid, $targetroleid); abstract protected function set_allow($fromroleid, $targetroleid);
/** /**
* Load the current allows from the database. * Load the current allows from the database.
@ -183,11 +183,11 @@ abstract class core_role_allow_role_page {
* Snippet of text displayed above the table, telling the admin what to do. * Snippet of text displayed above the table, telling the admin what to do.
* @return string * @return string
*/ */
public abstract function get_intro_text(); abstract public function get_intro_text();
/** /**
* Returns the allow class respective event class name. * Returns the allow class respective event class name.
* @return string * @return string
*/ */
protected abstract function get_eventclass(); abstract protected function get_eventclass();
} }

View file

@ -142,12 +142,12 @@ abstract class core_role_capability_table_base {
/** /**
* For subclasses to override, output header cells, after the initial capability one. * For subclasses to override, output header cells, after the initial capability one.
*/ */
protected abstract function add_header_cells(); abstract protected function add_header_cells();
/** /**
* For subclasses to override, return the number of cells that add_header_cells/add_row_cells output. * For subclasses to override, return the number of cells that add_header_cells/add_row_cells output.
*/ */
protected abstract function num_extra_columns(); abstract protected function num_extra_columns();
/** /**
* For subclasses to override. Allows certain capabilties * For subclasses to override. Allows certain capabilties
@ -191,5 +191,5 @@ abstract class core_role_capability_table_base {
* @param stdClass $capability the capability this row relates to. * @param stdClass $capability the capability this row relates to.
* @return string html of row cells * @return string html of row cells
*/ */
protected abstract function add_row_cells($capability); abstract protected function add_row_cells($capability);
} }

View file

@ -84,7 +84,7 @@ abstract class core_role_capability_table_with_risks extends core_role_capabilit
} }
} }
protected abstract function load_parent_permissions(); abstract protected function load_parent_permissions();
/** /**
* Update $this->permissions based on submitted data, while making a list of * Update $this->permissions based on submitted data, while making a list of
@ -156,7 +156,7 @@ abstract class core_role_capability_table_with_risks extends core_role_capabilit
return $rowclasses; return $rowclasses;
} }
protected abstract function add_permission_cells($capability); abstract protected function add_permission_cells($capability);
protected function add_row_cells($capability) { protected function add_row_cells($capability) {
$cells = $this->add_permission_cells($capability); $cells = $this->add_permission_cells($capability);

View file

@ -53,7 +53,7 @@ class provider implements
* @param collection $collection An object for storing metadata. * @param collection $collection An object for storing metadata.
* @return collection The metadata. * @return collection The metadata.
*/ */
public static function get_metadata(collection $collection) : collection { public static function get_metadata(collection $collection): collection {
$rolecapabilities = [ $rolecapabilities = [
'roleid' => 'privacy:metadata:role_capabilities:roleid', 'roleid' => 'privacy:metadata:role_capabilities:roleid',
'capability' => 'privacy:metadata:role_capabilities:capability', 'capability' => 'privacy:metadata:role_capabilities:capability',
@ -100,7 +100,7 @@ class provider implements
* @param int $userid The user ID. * @param int $userid The user ID.
* @return contextlist The list of context IDs. * @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; global $DB;
$contextlist = new contextlist(); $contextlist = new contextlist();

View file

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

View file

@ -42,7 +42,7 @@ class import_model extends \moodleform {
* *
* @return null * @return null
*/ */
public function definition () { public function definition() {
$mform = $this->_form; $mform = $this->_form;
$mform->addElement('header', 'settingsheader', get_string('importmodel', 'tool_analytics')); $mform->addElement('header', 'settingsheader', get_string('importmodel', 'tool_analytics'));

View file

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

View file

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

View file

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

View file

@ -157,7 +157,7 @@ class renderer extends plugin_renderer_base {
* @throws \coding_exception * @throws \coding_exception
* @throws \moodle_exception * @throws \moodle_exception
*/ */
public function analysisbutton(int $courseid) : string { public function analysisbutton(int $courseid): string {
$link = new moodle_url(accessibility::get_plugin_url(), [ $link = new moodle_url(accessibility::get_plugin_url(), [
'action' => 'requestanalysis', 'action' => 'requestanalysis',
'courseid' => $courseid 'courseid' => $courseid

View file

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

View file

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

View file

@ -52,7 +52,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to. * @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system. * @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. // The tool_cohortroles plugin utilises the mdl_tool_cohortroles table.
$collection->add_database_table( $collection->add_database_table(
'tool_cohortroles', 'tool_cohortroles',
@ -77,7 +77,7 @@ class provider implements
* @param int $userid The user to search. * @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin. * @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(); $contextlist = new contextlist();
// When we process user deletions and expiries, we always delete from the user context. // When we process user deletions and expiries, we always delete from the user context.

View file

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

View file

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

View file

@ -60,7 +60,7 @@ class langstring_test extends advanced_testcase {
* *
* @return array * @return array
*/ */
public function fix_syntax_data() : array { public function fix_syntax_data(): array {
return [ return [
// Syntax sanity v1 strings. // Syntax sanity v1 strings.
[ [

View file

@ -79,7 +79,7 @@ class phpparser_test extends advanced_testcase {
* *
* @return array * @return array
*/ */
public function parse_provider() : array { public function parse_provider(): array {
return [ return [
'Invalid PHP code' => [ 'Invalid PHP code' => [
'No PHP code', [], false 'No PHP code', [], false

View file

@ -168,7 +168,7 @@ class api {
* *
* @return array An array of the DPO role shortnames * @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; global $DB;
$dporoleids = self::get_assigned_privacy_officer_roles(); $dporoleids = self::get_assigned_privacy_officer_roles();
@ -524,7 +524,7 @@ class api {
* @param array $userids * @param array $userids
* @return array * @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; global $DB;
if (empty($userids)) { if (empty($userids)) {
@ -1201,7 +1201,7 @@ class api {
* @return contextlist_collection The collection of approved_contextlist objects. * @return contextlist_collection The collection of approved_contextlist objects.
*/ */
public static function get_approved_contextlist_collection_for_collection(contextlist_collection $collection, 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. // Create the approved contextlist collection object.
$approvedcollection = new contextlist_collection($collection->get_userid()); $approvedcollection = new contextlist_collection($collection->get_userid());
@ -1326,7 +1326,7 @@ class api {
* @param \DateInterval $interval * @param \DateInterval $interval
* @return string * @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. // It is one or another.
if ($interval->y) { if ($interval->y) {
$formattedtime = get_string('numyears', 'moodle', $interval->format('%y')); $formattedtime = get_string('numyears', 'moodle', $interval->format('%y'));

View file

@ -241,7 +241,7 @@ class data_request extends persistent {
* *
* @return bool * @return bool
*/ */
public function is_resettable() : bool { public function is_resettable(): bool {
if (api::DATAREQUEST_TYPE_OTHERS == $this->get('type')) { if (api::DATAREQUEST_TYPE_OTHERS == $this->get('type')) {
// It is not possible to reset 'other' reqeusts. // It is not possible to reset 'other' reqeusts.
return false; return false;
@ -260,7 +260,7 @@ class data_request extends persistent {
* *
* @return bool * @return bool
*/ */
public function is_active() : bool { public function is_active(): bool {
$active = [ $active = [
api::DATAREQUEST_STATUS_APPROVED => true, api::DATAREQUEST_STATUS_APPROVED => true,
]; ];
@ -275,7 +275,7 @@ class data_request extends persistent {
* *
* @return self * @return self
*/ */
public function resubmit_request() : data_request { public function resubmit_request(): data_request {
if ($this->is_active()) { if ($this->is_active()) {
$this->set('status', api::DATAREQUEST_STATUS_REJECTED)->save(); $this->set('status', api::DATAREQUEST_STATUS_REJECTED)->save();
} }

View file

@ -182,7 +182,7 @@ class expired_context extends \core\persistent {
* @param int[] $roleids * @param int[] $roleids
* @return expired_context * @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); $roledata = json_encode($roleids);
$this->raw_set($field, $roledata); $this->raw_set($field, $roledata);
@ -211,7 +211,7 @@ class expired_context extends \core\persistent {
* @param int[] $roleids * @param int[] $roleids
* @return expired_context * @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); $this->set_roleids_for('unexpiredroles', $roleids);
return $this; return $this;
@ -223,7 +223,7 @@ class expired_context extends \core\persistent {
* @param int[] $roleids * @param int[] $roleids
* @return expired_context * @return expired_context
*/ */
public function add_expiredroles(array $roleids) : expired_context { public function add_expiredroles(array $roleids): expired_context {
$existing = $this->get('expiredroles'); $existing = $this->get('expiredroles');
$newvalue = array_merge($existing, $roleids); $newvalue = array_merge($existing, $roleids);
@ -238,7 +238,7 @@ class expired_context extends \core\persistent {
* @param int[] $roleids * @param int[] $roleids
* @return unexpired_context * @return unexpired_context
*/ */
public function add_unexpiredroles(array $roleids) : expired_context { public function add_unexpiredroles(array $roleids): expired_context {
$existing = $this->get('unexpiredroles'); $existing = $this->get('unexpiredroles');
$newvalue = array_merge($existing, $roleids); $newvalue = array_merge($existing, $roleids);
@ -253,7 +253,7 @@ class expired_context extends \core\persistent {
* @param int[] $roleids * @param int[] $roleids
* @return expired_context * @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); $this->set_roleids_for('expiredroles', $roleids);
return $this; return $this;
@ -285,7 +285,7 @@ class expired_context extends \core\persistent {
* @param boolean $save * @param boolean $save
* @return expired_context * @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) [ $record = (object) [
'contextid' => $context->id, 'contextid' => $context->id,
'status' => self::STATUS_EXPIRED, 'status' => self::STATUS_EXPIRED,
@ -309,7 +309,7 @@ class expired_context extends \core\persistent {
* @param expiry_info $info * @param expiry_info $info
* @return $this * @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; $save = false;
// Compare the expiredroles. // Compare the expiredroles.
@ -353,7 +353,7 @@ class expired_context extends \core\persistent {
* *
* @return bool * @return bool
*/ */
public function can_process_deletion() : bool { public function can_process_deletion(): bool {
return ($this->get('status') == self::STATUS_APPROVED); return ($this->get('status') == self::STATUS_APPROVED);
} }
@ -362,7 +362,7 @@ class expired_context extends \core\persistent {
* *
* @return bool * @return bool
*/ */
public function is_complete() : bool { public function is_complete(): bool {
return ($this->get('status') == self::STATUS_CLEANED); return ($this->get('status') == self::STATUS_CLEANED);
} }
@ -372,7 +372,7 @@ class expired_context extends \core\persistent {
* *
* @return bool * @return bool
*/ */
public function is_fully_expired() : bool { public function is_fully_expired(): bool {
return $this->get('defaultexpired') && empty($this->get('unexpiredroles')); return $this->get('defaultexpired') && empty($this->get('unexpiredroles'));
} }
} }

View file

@ -68,7 +68,7 @@ class expired_contexts_manager {
* *
* @return int[] The number of contexts flagged as expired for courses, and users. * @return int[] The number of contexts flagged as expired for courses, and users.
*/ */
public function flag_expired_contexts() : array { public function flag_expired_contexts(): array {
$this->trace->output('Checking requirements'); $this->trace->output('Checking requirements');
if (!$this->check_requirements()) { if (!$this->check_requirements()) {
$this->trace->output('Requirements not met. Cannot process expired retentions.', 1); $this->trace->output('Requirements not met. Cannot process expired retentions.', 1);
@ -151,7 +151,7 @@ class expired_contexts_manager {
* @param string $contextpath A contexpath to restrict results to * @param string $contextpath A contexpath to restrict results to
* @return \stdClass[] * @return \stdClass[]
*/ */
protected static function get_nested_expiry_info($contextpath = '') : array { protected static function get_nested_expiry_info($contextpath = ''): array {
$coursepaths = self::get_nested_expiry_info_for_courses($contextpath); $coursepaths = self::get_nested_expiry_info_for_courses($contextpath);
$userpaths = self::get_nested_expiry_info_for_user($contextpath); $userpaths = self::get_nested_expiry_info_for_user($contextpath);
@ -164,7 +164,7 @@ class expired_contexts_manager {
* @param string $contextpath A contexpath to restrict results to * @param string $contextpath A contexpath to restrict results to
* @return \stdClass[] * @return \stdClass[]
*/ */
protected static function get_nested_expiry_info_for_courses($contextpath = '') : array { protected static function get_nested_expiry_info_for_courses($contextpath = ''): array {
global $DB; global $DB;
$contextfields = \context_helper::get_preload_record_columns_sql('ctx'); $contextfields = \context_helper::get_preload_record_columns_sql('ctx');
@ -217,7 +217,7 @@ class expired_contexts_manager {
* @param string $contextpath A contexpath to restrict results to * @param string $contextpath A contexpath to restrict results to
* @return \stdClass[] * @return \stdClass[]
*/ */
protected static function get_nested_expiry_info_for_user($contextpath = '') : array { protected static function get_nested_expiry_info_for_user($contextpath = ''): array {
global $DB; global $DB;
$contextfields = \context_helper::get_preload_record_columns_sql('ctx'); $contextfields = \context_helper::get_preload_record_columns_sql('ctx');
@ -262,7 +262,7 @@ class expired_contexts_manager {
* @param array $params The params required by the SQL. * @param array $params The params required by the SQL.
* @return \stdClass[] * @return \stdClass[]
*/ */
protected static function get_nested_expiry_info_from_sql(string $sql, array $params) : array { protected static function get_nested_expiry_info_from_sql(string $sql, array $params): array {
global $DB; global $DB;
$fulllist = $DB->get_recordset_sql($sql, $params); $fulllist = $DB->get_recordset_sql($sql, $params);
@ -334,7 +334,7 @@ class expired_contexts_manager {
* @param \context $context * @param \context $context
* @return bool * @return bool
*/ */
protected static function is_eligible_for_deletion(array &$pathstoskip, \context $context) : bool { protected static function is_eligible_for_deletion(array &$pathstoskip, \context $context): bool {
$shouldskip = false; $shouldskip = false;
// Check whether any of the child contexts are ineligble. // Check whether any of the child contexts are ineligble.
$shouldskip = !empty(array_filter($pathstoskip, function($path) use ($context) { $shouldskip = !empty(array_filter($pathstoskip, function($path) use ($context) {
@ -361,7 +361,7 @@ class expired_contexts_manager {
* *
* @return int[] The number of deleted contexts. * @return int[] The number of deleted contexts.
*/ */
public function process_approved_deletions() : array { public function process_approved_deletions(): array {
$this->trace->output('Checking requirements'); $this->trace->output('Checking requirements');
if (!$this->check_requirements()) { if (!$this->check_requirements()) {
$this->trace->output('Requirements not met. Cannot process expired retentions.', 1); $this->trace->output('Requirements not met. Cannot process expired retentions.', 1);
@ -538,7 +538,7 @@ class expired_contexts_manager {
* *
* @return bool * @return bool
*/ */
protected static function require_all_end_dates_for_user_deletion() : bool { protected static function require_all_end_dates_for_user_deletion(): bool {
$requireenddate = get_config('tool_dataprivacy', 'requireallenddatesforuserdeletion'); $requireenddate = get_config('tool_dataprivacy', 'requireallenddatesforuserdeletion');
return !empty($requireenddate); return !empty($requireenddate);
@ -563,7 +563,7 @@ class expired_contexts_manager {
* @param int $comparisondate The date for comparison * @param int $comparisondate The date for comparison
* @return bool * @return bool
*/ */
protected static function has_expired(string $period, int $comparisondate) : bool { protected static function has_expired(string $period, int $comparisondate): bool {
$dt = new \DateTime(); $dt = new \DateTime();
$dt->setTimestamp($comparisondate); $dt->setTimestamp($comparisondate);
$dt->add(new \DateInterval($period)); $dt->add(new \DateInterval($period));
@ -578,7 +578,7 @@ class expired_contexts_manager {
* @param int $comparisondate The date for comparison * @param int $comparisondate The date for comparison
* @return expiry_info * @return expiry_info
*/ */
protected static function get_expiry_info(purpose $purpose, int $comparisondate = 0) : expiry_info { protected static function get_expiry_info(purpose $purpose, int $comparisondate = 0): expiry_info {
$overrides = $purpose->get_purpose_overrides(); $overrides = $purpose->get_purpose_overrides();
$expiredroles = $unexpiredroles = []; $expiredroles = $unexpiredroles = [];
if (empty($overrides)) { if (empty($overrides)) {
@ -730,7 +730,7 @@ class expired_contexts_manager {
* @param \context $context * @param \context $context
* @return \stdClass * @return \stdClass
*/ */
protected function get_role_users_for_expired_context(expired_context $expiredctx, \context $context) : \stdClass { protected function get_role_users_for_expired_context(expired_context $expiredctx, \context $context): \stdClass {
$expiredroles = $expiredctx->get('expiredroles'); $expiredroles = $expiredctx->get('expiredroles');
$expiredroleusers = []; $expiredroleusers = [];
if (!empty($expiredroles)) { if (!empty($expiredroles)) {
@ -782,7 +782,7 @@ class expired_contexts_manager {
* @param \context $context * @param \context $context
* @return bool * @return bool
*/ */
public static function is_context_expired(\context $context) : bool { public static function is_context_expired(\context $context): bool {
$parents = $context->get_parent_contexts(true); $parents = $context->get_parent_contexts(true);
foreach ($parents as $parent) { foreach ($parents as $parent) {
if ($parent instanceof \context_course) { if ($parent instanceof \context_course) {
@ -805,7 +805,7 @@ class expired_contexts_manager {
* @param \stdClass $course * @param \stdClass $course
* @return bool * @return bool
*/ */
protected static function is_course_expired(\stdClass $course) : bool { protected static function is_course_expired(\stdClass $course): bool {
$context = \context_course::instance($course->id); $context = \context_course::instance($course->id);
return self::is_course_context_expired($context); return self::is_course_context_expired($context);
@ -818,7 +818,7 @@ class expired_contexts_manager {
* @param \context $context * @param \context $context
* @return bool * @return bool
*/ */
protected static function is_course_context_expired(\context $context) : bool { protected static function is_course_context_expired(\context $context): bool {
$expiryrecords = self::get_nested_expiry_info_for_courses($context->path); $expiryrecords = self::get_nested_expiry_info_for_courses($context->path);
return !empty($expiryrecords[$context->path]) && $expiryrecords[$context->path]->info->is_fully_expired(); return !empty($expiryrecords[$context->path]) && $expiryrecords[$context->path]->info->is_fully_expired();
@ -839,7 +839,7 @@ class expired_contexts_manager {
* @param \context_user $context * @param \context_user $context
* @return bool * @return bool
*/ */
protected static function are_user_context_dependencies_expired(\context_user $context) : bool { protected static function are_user_context_dependencies_expired(\context_user $context): bool {
// The context instanceid is the user's ID. // The context instanceid is the user's ID.
if (isguestuser($context->instanceid) || is_siteadmin($context->instanceid)) { if (isguestuser($context->instanceid) || is_siteadmin($context->instanceid)) {
// This is an admin, or the guest and cannot expire. // This is an admin, or the guest and cannot expire.
@ -889,7 +889,7 @@ class expired_contexts_manager {
* @param \stdClass $user * @param \stdClass $user
* @return bool * @return bool
*/ */
public static function is_context_expired_or_unprotected_for_user(\context $context, \stdClass $user) : bool { public static function is_context_expired_or_unprotected_for_user(\context $context, \stdClass $user): bool {
// User/course contexts can't expire if no purpose is set in the system context. // User/course contexts can't expire if no purpose is set in the system context.
if (!data_registry::defaults_set()) { if (!data_registry::defaults_set()) {
return false; return false;
@ -972,7 +972,7 @@ class expired_contexts_manager {
* *
* @return manager * @return manager
*/ */
protected function get_privacy_manager() : manager { protected function get_privacy_manager(): manager {
if (null === $this->manager) { if (null === $this->manager) {
$this->manager = new manager(); $this->manager = new manager();
$this->manager->set_observer(new \tool_dataprivacy\manager_observer()); $this->manager->set_observer(new \tool_dataprivacy\manager_observer());
@ -986,7 +986,7 @@ class expired_contexts_manager {
* *
* @return int * @return int
*/ */
protected function get_delete_limit() : int { protected function get_delete_limit(): int {
return self::DELETE_LIMIT; return self::DELETE_LIMIT;
} }
@ -995,7 +995,7 @@ class expired_contexts_manager {
* *
* @return \progress_trace * @return \progress_trace
*/ */
protected function get_progress() : \progress_trace { protected function get_progress(): \progress_trace {
if (null === $this->progresstracer) { if (null === $this->progresstracer) {
$this->set_progress(new \text_progress_trace()); $this->set_progress(new \text_progress_trace());
} }
@ -1009,7 +1009,7 @@ class expired_contexts_manager {
* @param \progress_trace $trace * @param \progress_trace $trace
* @return $this * @return $this
*/ */
public function set_progress(\progress_trace $trace) : expired_contexts_manager { public function set_progress(\progress_trace $trace): expired_contexts_manager {
$this->progresstracer = $trace; $this->progresstracer = $trace;
return $this; return $this;

View file

@ -76,7 +76,7 @@ class expiry_info {
* *
* @return bool * @return bool
*/ */
public function is_fully_expired() : bool { public function is_fully_expired(): bool {
return $this->defaultexpiryreached && empty($this->unexpired); return $this->defaultexpiryreached && empty($this->unexpired);
} }
@ -85,7 +85,7 @@ class expiry_info {
* *
* @return bool * @return bool
*/ */
public function is_any_expired() : bool { public function is_any_expired(): bool {
if ($this->is_fully_expired()) { if ($this->is_fully_expired()) {
return true; return true;
} }
@ -107,7 +107,7 @@ class expiry_info {
* *
* @return int[] * @return int[]
*/ */
public function get_expired_roles() : array { public function get_expired_roles(): array {
if ($this->is_default_expired()) { if ($this->is_default_expired()) {
return []; return [];
} }
@ -121,7 +121,7 @@ class expiry_info {
* @param int $roleid * @param int $roleid
* @return bool * @return bool
*/ */
public function is_role_expired(int $roleid) : bool { public function is_role_expired(int $roleid): bool {
return false !== array_search($roleid, $this->expired); return false !== array_search($roleid, $this->expired);
} }
@ -130,7 +130,7 @@ class expiry_info {
* *
* @return bool * @return bool
*/ */
public function is_default_expired() : bool { public function is_default_expired(): bool {
return $this->defaultexpiryreached; return $this->defaultexpiryreached;
} }
@ -139,7 +139,7 @@ class expiry_info {
* *
* @return bool * @return bool
*/ */
public function is_default_protected() : bool { public function is_default_protected(): bool {
return $this->defaultprotected; return $this->defaultprotected;
} }
@ -148,7 +148,7 @@ class expiry_info {
* *
* @return int[] * @return int[]
*/ */
public function get_unexpired_roles() : array { public function get_unexpired_roles(): array {
return $this->unexpired; return $this->unexpired;
} }
@ -157,7 +157,7 @@ class expiry_info {
* *
* @return int[] * @return int[]
*/ */
public function get_unexpired_protected_roles() : array { public function get_unexpired_protected_roles(): array {
return array_keys(array_filter($this->protectedroles)); return array_keys(array_filter($this->protectedroles));
} }
@ -165,7 +165,7 @@ class expiry_info {
* Get a list of all overridden roles which are unprotected. * Get a list of all overridden roles which are unprotected.
* @return int[] * @return int[]
*/ */
public function get_unprotected_overridden_roles() : array { public function get_unprotected_overridden_roles(): array {
$allroles = array_merge($this->expired, $this->unexpired); $allroles = array_merge($this->expired, $this->unexpired);
return array_diff($allroles, $this->protectedroles); return array_diff($allroles, $this->protectedroles);
@ -181,7 +181,7 @@ class expiry_info {
* @param expiry_info $child The child record to merge with. * @param expiry_info $child The child record to merge with.
* @return $this * @return $this
*/ */
public function merge_with_child(expiry_info $child) : expiry_info { public function merge_with_child(expiry_info $child): expiry_info {
if ($child->is_fully_expired()) { if ($child->is_fully_expired()) {
return $this; return $this;
} }

View file

@ -42,7 +42,7 @@ class filtered_userlist extends \core_privacy\local\request\approved_userlist {
* @param int[] $unexpireduserids The list of userids for those users who should not be expired. * @param int[] $unexpireduserids The list of userids for those users who should not be expired.
* @return $this * @return $this
*/ */
public function apply_expired_context_filters(array $expireduserids, array $unexpireduserids) : filtered_userlist { public function apply_expired_context_filters(array $expireduserids, array $unexpireduserids): filtered_userlist {
// The current userlist content. // The current userlist content.
$userids = $this->get_userids(); $userids = $this->get_userids();

View file

@ -245,7 +245,7 @@ class purpose extends persistent {
* @param string $prefix The prefix to apply to the field * @param string $prefix The prefix to apply to the field
* @return \stdClass * @return \stdClass
*/ */
protected function get_role_override_id(string $prefix = '') : \stdClass { protected function get_role_override_id(string $prefix = ''): \stdClass {
$fieldname = "{$prefix}id"; $fieldname = "{$prefix}id";
$fielddata = (object) [ $fielddata = (object) [
@ -264,7 +264,7 @@ class purpose extends persistent {
* @param string $prefix The prefix to apply to the field * @param string $prefix The prefix to apply to the field
* @return \stdClass * @return \stdClass
*/ */
protected function get_role_field(string $prefix = '') : \stdClass { protected function get_role_field(string $prefix = ''): \stdClass {
$fieldname = "{$prefix}roleid"; $fieldname = "{$prefix}roleid";
$fielddata = (object) [ $fielddata = (object) [
@ -297,7 +297,7 @@ class purpose extends persistent {
* @param string $prefix The prefix to apply to the field * @param string $prefix The prefix to apply to the field
* @return \stdClass * @return \stdClass
*/ */
protected function get_lawful_base_field(string $prefix = '') : \stdClass { protected function get_lawful_base_field(string $prefix = ''): \stdClass {
$fieldname = "{$prefix}lawfulbases"; $fieldname = "{$prefix}lawfulbases";
$data = (object) [ $data = (object) [
@ -334,7 +334,7 @@ class purpose extends persistent {
* @param string $prefix The prefix to apply to the field * @param string $prefix The prefix to apply to the field
* @return \stdClass * @return \stdClass
*/ */
protected function get_sensitive_base_field(string $prefix = '') : \stdClass { protected function get_sensitive_base_field(string $prefix = ''): \stdClass {
$fieldname = "{$prefix}sensitivedatareasons"; $fieldname = "{$prefix}sensitivedatareasons";
$data = (object) [ $data = (object) [
@ -373,7 +373,7 @@ class purpose extends persistent {
* @param string $prefix The name of the main field, and prefix for the subfields. * @param string $prefix The name of the main field, and prefix for the subfields.
* @return \stdClass * @return \stdClass
*/ */
protected function get_retention_period_fields(string $prefix = '') : \stdClass { protected function get_retention_period_fields(string $prefix = ''): \stdClass {
$prefix = "{$prefix}retentionperiod"; $prefix = "{$prefix}retentionperiod";
$data = (object) [ $data = (object) [
'fields' => [], 'fields' => [],
@ -411,7 +411,7 @@ class purpose extends persistent {
* @param string $prefix The prefix to apply to the field * @param string $prefix The prefix to apply to the field
* @return \stdClass * @return \stdClass
*/ */
protected function get_protected_field(string $prefix = '') : \stdClass { protected function get_protected_field(string $prefix = ''): \stdClass {
$fieldname = "{$prefix}protected"; $fieldname = "{$prefix}protected";
return (object) [ return (object) [
@ -470,7 +470,7 @@ class purpose extends persistent {
* @param \stdClass $data * @param \stdClass $data
* @return \stdClass * @return \stdClass
*/ */
protected function convert_existing_data_to_values(\stdClass $data) : \stdClass { protected function convert_existing_data_to_values(\stdClass $data): \stdClass {
$data->lawfulbases = explode(',', $data->lawfulbases); $data->lawfulbases = explode(',', $data->lawfulbases);
if (!empty($data->sensitivedatareasons)) { if (!empty($data->sensitivedatareasons)) {
$data->sensitivedatareasons = explode(',', $data->sensitivedatareasons); $data->sensitivedatareasons = explode(',', $data->sensitivedatareasons);

View file

@ -44,7 +44,7 @@ abstract class crud_element {
* *
* @return \action_link[] * @return \action_link[]
*/ */
protected final function get_navigation() { final protected function get_navigation() {
$back = new \action_link( $back = new \action_link(
new \moodle_url('/admin/tool/dataprivacy/dataregistry.php'), new \moodle_url('/admin/tool/dataprivacy/dataregistry.php'),
get_string('back'), get_string('back'),
@ -62,7 +62,7 @@ abstract class crud_element {
* @param \core\persistent $persistent * @param \core\persistent $persistent
* @return \action_menu * @return \action_menu
*/ */
protected final function action_menu($elementname, $exported, $persistent) { final protected function action_menu($elementname, $exported, $persistent) {
// Just in case, we are doing funny stuff below. // Just in case, we are doing funny stuff below.
$elementname = clean_param($elementname, PARAM_ALPHA); $elementname = clean_param($elementname, PARAM_ALPHA);

View file

@ -429,7 +429,7 @@ class data_requests_table extends table_sql {
* *
* @return int The number of data request records. * @return int The number of data request records.
*/ */
public function get_requests_per_page() : int { public function get_requests_per_page(): int {
return $this->perpage; return $this->perpage;
} }
@ -447,7 +447,7 @@ class data_requests_table extends table_sql {
* *
* @return array The available options for the number of data request to be displayed per page. * @return array The available options for the number of data request to be displayed per page.
*/ */
public function get_requests_per_page_options() : array { public function get_requests_per_page_options(): array {
return $this->perpageoptions; return $this->perpageoptions;
} }
} }

View file

@ -370,7 +370,7 @@ class expired_contexts_table extends table_sql {
* @param expired_context $expiredcontext * @param expired_context $expiredcontext
* @return purpose * @return purpose
*/ */
protected function get_purpose_for_expiry(expired_context $expiredcontext) : purpose { protected function get_purpose_for_expiry(expired_context $expiredcontext): purpose {
$context = context_helper::instance_by_id($expiredcontext->get('contextid')); $context = context_helper::instance_by_id($expiredcontext->get('contextid'));
if (empty($this->purposemap[$context->id])) { if (empty($this->purposemap[$context->id])) {

View file

@ -66,7 +66,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to. * @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system. * @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_database_table( $collection->add_database_table(
'tool_dataprivacy_request', 'tool_dataprivacy_request',
[ [
@ -103,7 +103,7 @@ class provider implements
* @param int $userid The user to search. * @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin. * @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 {
$sql = "SELECT id $sql = "SELECT id
FROM {context} FROM {context}
WHERE instanceid = :userid WHERE instanceid = :userid

View file

@ -185,7 +185,7 @@ class purpose extends \core\persistent {
* *
* @return array * @return array
*/ */
public function get_purpose_overrides() : array { public function get_purpose_overrides(): array {
return purpose_override::get_overrides_for_purpose($this); return purpose_override::get_overrides_for_purpose($this);
} }
} }

View file

@ -88,7 +88,7 @@ class purpose_override extends \core\persistent {
* @param purpose $purpose * @param purpose $purpose
* @return array * @return array
*/ */
public static function get_overrides_for_purpose(purpose $purpose) : array { public static function get_overrides_for_purpose(purpose $purpose): array {
$cache = \cache::make('tool_dataprivacy', 'purpose_overrides'); $cache = \cache::make('tool_dataprivacy', 'purpose_overrides');
$overrides = []; $overrides = [];

View file

@ -2165,7 +2165,7 @@ class api_test extends \advanced_testcase {
* @param string $course Retention policy for courses. * @param string $course Retention policy for courses.
* @param string $activity Retention policy for activities. * @param string $activity Retention policy for activities.
*/ */
protected function setup_basics(string $system, string $user, string $course = null, string $activity = null) : \stdClass { protected function setup_basics(string $system, string $user, string $course = null, string $activity = null): \stdClass {
$this->resetAfterTest(); $this->resetAfterTest();
$purposes = (object) [ $purposes = (object) [
@ -2321,7 +2321,7 @@ class api_test extends \advanced_testcase {
* @param int $status * @param int $status
* @return \tool_dataprivacy\data_request * @return \tool_dataprivacy\data_request
*/ */
protected function create_request_with_type_and_status(int $userid, int $type, int $status) : \tool_dataprivacy\data_request { protected function create_request_with_type_and_status(int $userid, int $type, int $status): \tool_dataprivacy\data_request {
$request = new \tool_dataprivacy\data_request(0, (object) [ $request = new \tool_dataprivacy\data_request(0, (object) [
'userid' => $userid, 'userid' => $userid,
'type' => $type, 'type' => $type,

View file

@ -35,7 +35,7 @@ class data_request_test extends data_privacy_testcase {
* *
* @return array * @return array
*/ */
public function status_state_provider() : array { public function status_state_provider(): array {
return [ return [
[ [
'state' => api::DATAREQUEST_STATUS_PENDING, 'state' => api::DATAREQUEST_STATUS_PENDING,
@ -138,7 +138,7 @@ class data_request_test extends data_privacy_testcase {
* *
* @return array * @return array
*/ */
public function non_resettable_provider() : array { public function non_resettable_provider(): array {
$states = []; $states = [];
foreach ($this->status_state_provider() as $thisstatus) { foreach ($this->status_state_provider() as $thisstatus) {
if (!$thisstatus['resettable']) { if (!$thisstatus['resettable']) {
@ -221,7 +221,7 @@ class data_request_test extends data_privacy_testcase {
* @param int $status * @param int $status
* @return data_request * @return data_request
*/ */
public function create_request_for_user_with_status(int $userid, int $type, int $status) : data_request { public function create_request_for_user_with_status(int $userid, int $type, int $status): data_request {
$request = new data_request(0, (object) [ $request = new data_request(0, (object) [
'userid' => $userid, 'userid' => $userid,
'type' => $type, 'type' => $type,

View file

@ -33,7 +33,7 @@ class expired_contexts_test extends \advanced_testcase {
* @param string $course Retention policy for courses. * @param string $course Retention policy for courses.
* @param string $activity Retention policy for activities. * @param string $activity Retention policy for activities.
*/ */
protected function setup_basics(string $system, string $user, string $course = null, string $activity = null) : \stdClass { protected function setup_basics(string $system, string $user, string $course = null, string $activity = null): \stdClass {
$this->resetAfterTest(); $this->resetAfterTest();
$purposes = (object) [ $purposes = (object) [
@ -59,7 +59,7 @@ class expired_contexts_test extends \advanced_testcase {
* @param int $contextlevel * @param int $contextlevel
* @return purpose * @return purpose
*/ */
protected function create_and_set_purpose_for_contextlevel(string $retention, int $contextlevel) : purpose { protected function create_and_set_purpose_for_contextlevel(string $retention, int $contextlevel): purpose {
$purpose = new purpose(0, (object) [ $purpose = new purpose(0, (object) [
'name' => 'Test purpose ' . rand(1, 1000), 'name' => 'Test purpose ' . rand(1, 1000),
'retentionperiod' => $retention, 'retentionperiod' => $retention,
@ -1918,7 +1918,7 @@ class expired_contexts_test extends \advanced_testcase {
* *
* @return array * @return array
*/ */
public function can_process_deletion_provider() : array { public function can_process_deletion_provider(): array {
return [ return [
'Pending' => [ 'Pending' => [
expired_context::STATUS_EXPIRED, expired_context::STATUS_EXPIRED,
@ -1956,7 +1956,7 @@ class expired_contexts_test extends \advanced_testcase {
* *
* @return array * @return array
*/ */
public function is_complete_provider() : array { public function is_complete_provider(): array {
return [ return [
'Pending' => [ 'Pending' => [
expired_context::STATUS_EXPIRED, expired_context::STATUS_EXPIRED,
@ -1991,7 +1991,7 @@ class expired_contexts_test extends \advanced_testcase {
* *
* @return array * @return array
*/ */
public function is_fully_expired_provider() : array { public function is_fully_expired_provider(): array {
return [ return [
'Fully expired' => [ 'Fully expired' => [
[ [

View file

@ -58,7 +58,7 @@ class filtered_userlist_test extends \advanced_testcase {
* *
* @return array * @return array
*/ */
public function apply_expired_contexts_filters_provider() : array { public function apply_expired_contexts_filters_provider(): array {
return [ return [
// Entire list should be preserved. // Entire list should be preserved.
'No overrides' => [ 'No overrides' => [

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -42,7 +42,7 @@ class locale {
* @return bool TRUE if the locale is available on OS. * @return bool TRUE if the locale is available on OS.
* @throws coding_exception when $langpackcode parameter is a non-empty string. * @throws coding_exception when $langpackcode parameter is a non-empty string.
*/ */
public function check_locale_availability(string $langpackcode) : bool { public function check_locale_availability(string $langpackcode): bool {
global $CFG; global $CFG;
if (empty($langpackcode)) { if (empty($langpackcode)) {

View file

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

View file

@ -39,7 +39,7 @@ class helper {
* *
* @return \moodle_url * @return \moodle_url
*/ */
public static function get_licensemanager_url() : moodle_url { public static function get_licensemanager_url(): moodle_url {
return new moodle_url(self::MANAGER_PATH); return new moodle_url(self::MANAGER_PATH);
} }
@ -50,7 +50,7 @@ class helper {
* *
* @return \moodle_url * @return \moodle_url
*/ */
public static function get_enable_license_url(string $licenseshortname) : moodle_url { public static function get_enable_license_url(string $licenseshortname): moodle_url {
$url = new moodle_url(self::MANAGER_PATH, $url = new moodle_url(self::MANAGER_PATH,
['action' => manager::ACTION_ENABLE, 'license' => $licenseshortname, 'sesskey' => sesskey()]); ['action' => manager::ACTION_ENABLE, 'license' => $licenseshortname, 'sesskey' => sesskey()]);
@ -64,7 +64,7 @@ class helper {
* *
* @return \moodle_url * @return \moodle_url
*/ */
public static function get_disable_license_url(string $licenseshortname) : moodle_url { public static function get_disable_license_url(string $licenseshortname): moodle_url {
$url = new moodle_url(self::MANAGER_PATH, $url = new moodle_url(self::MANAGER_PATH,
['action' => manager::ACTION_DISABLE, 'license' => $licenseshortname, 'sesskey' => sesskey()]); ['action' => manager::ACTION_DISABLE, 'license' => $licenseshortname, 'sesskey' => sesskey()]);
@ -76,7 +76,7 @@ class helper {
* *
* @return \moodle_url * @return \moodle_url
*/ */
public static function get_create_license_url() : moodle_url { public static function get_create_license_url(): moodle_url {
$url = self::get_licensemanager_url(); $url = self::get_licensemanager_url();
$url->params(['action' => manager::ACTION_CREATE]); $url->params(['action' => manager::ACTION_CREATE]);
return $url; return $url;
@ -89,7 +89,7 @@ class helper {
* *
* @return \moodle_url * @return \moodle_url
*/ */
public static function get_update_license_url(string $licenseshortname) : moodle_url { public static function get_update_license_url(string $licenseshortname): moodle_url {
$url = self::get_licensemanager_url(); $url = self::get_licensemanager_url();
$url->params(['action' => manager::ACTION_UPDATE, 'license' => $licenseshortname]); $url->params(['action' => manager::ACTION_UPDATE, 'license' => $licenseshortname]);
return $url; return $url;
@ -102,7 +102,7 @@ class helper {
* *
* @return \moodle_url * @return \moodle_url
*/ */
public static function get_moveup_license_url(string $licenseshortname) : moodle_url { public static function get_moveup_license_url(string $licenseshortname): moodle_url {
$url = new moodle_url(self::MANAGER_PATH, $url = new moodle_url(self::MANAGER_PATH,
['action' => manager::ACTION_MOVE_UP, 'license' => $licenseshortname, 'sesskey' => sesskey()]); ['action' => manager::ACTION_MOVE_UP, 'license' => $licenseshortname, 'sesskey' => sesskey()]);
@ -116,7 +116,7 @@ class helper {
* *
* @return \moodle_url * @return \moodle_url
*/ */
public static function get_movedown_license_url(string $licenseshortname) : moodle_url { public static function get_movedown_license_url(string $licenseshortname): moodle_url {
$url = new moodle_url(self::MANAGER_PATH, $url = new moodle_url(self::MANAGER_PATH,
['action' => manager::ACTION_MOVE_DOWN, 'license' => $licenseshortname, 'sesskey' => sesskey()]); ['action' => manager::ACTION_MOVE_DOWN, 'license' => $licenseshortname, 'sesskey' => sesskey()]);
@ -130,7 +130,7 @@ class helper {
* *
* @return int $epoch * @return int $epoch
*/ */
public static function convert_version_to_epoch(string $version) : int { public static function convert_version_to_epoch(string $version): int {
$date = substr($version, 0, 8); $date = substr($version, 0, 8);
$epoch = strtotime($date); $epoch = strtotime($date);

View file

@ -75,7 +75,7 @@ class manager {
* @param string $action the api action to carry out. * @param string $action the api action to carry out.
* @param string|object $license the license object or shortname of license to carry action out on. * @param string|object $license the license object or shortname of license to carry action out on.
*/ */
public function execute(string $action, $license) : void { public function execute(string $action, $license): void {
admin_externalpage_setup('licensemanager'); admin_externalpage_setup('licensemanager');
@ -140,7 +140,7 @@ class manager {
* *
* @return bool true if license editing complete, false otherwise. * @return bool true if license editing complete, false otherwise.
*/ */
private function edit(string $action, string $licenseshortname) : bool { private function edit(string $action, string $licenseshortname): bool {
if ($action != self::ACTION_CREATE && $action != self::ACTION_UPDATE) { if ($action != self::ACTION_CREATE && $action != self::ACTION_UPDATE) {
throw new \coding_exception('license edit actions are limited to create and update'); throw new \coding_exception('license edit actions are limited to create and update');
@ -190,7 +190,7 @@ class manager {
* @param string $direction which direction to move, up or down. * @param string $direction which direction to move, up or down.
* @param string $licenseshortname the shortname of the license to move up or down order. * @param string $licenseshortname the shortname of the license to move up or down order.
*/ */
private function change_license_order(string $direction, string $licenseshortname) : void { private function change_license_order(string $direction, string $licenseshortname): void {
if (!empty($licenseshortname)) { if (!empty($licenseshortname)) {
if ($direction == self::ACTION_MOVE_UP) { if ($direction == self::ACTION_MOVE_UP) {
@ -208,7 +208,7 @@ class manager {
* @param string $licenseshortname the shortname of the license to create/edit. * @param string $licenseshortname the shortname of the license to create/edit.
* @param \tool_licensemanager\form\edit_license $form the form for submitting edit data. * @param \tool_licensemanager\form\edit_license $form the form for submitting edit data.
*/ */
private function view_license_editor(string $action, string $licenseshortname, edit_license $form) : void { private function view_license_editor(string $action, string $licenseshortname, edit_license $form): void {
global $PAGE; global $PAGE;
$renderer = $PAGE->get_renderer('tool_licensemanager'); $renderer = $PAGE->get_renderer('tool_licensemanager');
@ -233,7 +233,7 @@ class manager {
/** /**
* View the license manager. * View the license manager.
*/ */
private function view_license_manager(string $message = null) : void { private function view_license_manager(string $message = null): void {
global $PAGE, $OUTPUT; global $PAGE, $OUTPUT;
$renderer = $PAGE->get_renderer('tool_licensemanager'); $renderer = $PAGE->get_renderer('tool_licensemanager');

View file

@ -44,7 +44,7 @@ class renderer extends plugin_renderer_base {
* *
* @return string html fragment for display. * @return string html fragment for display.
*/ */
public function render_create_licence_headers() : string { public function render_create_licence_headers(): string {
$this->page->navbar->add(get_string('createlicense', 'tool_licensemanager'), $this->page->navbar->add(get_string('createlicense', 'tool_licensemanager'),
helper::get_create_license_url()); helper::get_create_license_url());
@ -62,7 +62,7 @@ class renderer extends plugin_renderer_base {
* *
* @return string html fragment for display. * @return string html fragment for display.
*/ */
public function render_edit_licence_headers(string $licenseshortname) : string { public function render_edit_licence_headers(string $licenseshortname): string {
$this->page->navbar->add(get_string('editlicense', 'tool_licensemanager'), $this->page->navbar->add(get_string('editlicense', 'tool_licensemanager'),
helper::get_update_license_url($licenseshortname)); helper::get_update_license_url($licenseshortname));

View file

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

View file

@ -52,7 +52,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to. * @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system. * @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_plugintype_link('logstore', [], 'privacy:metadata:logstore'); $collection->add_plugintype_link('logstore', [], 'privacy:metadata:logstore');
return $collection; return $collection;
} }
@ -63,7 +63,7 @@ class provider implements
* @param int $userid The user to search. * @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin. * @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/ */
public static function get_contexts_for_userid(int $userid) : \core_privacy\local\request\contextlist { public static function get_contexts_for_userid(int $userid): \core_privacy\local\request\contextlist {
$contextlist = new \core_privacy\local\request\contextlist(); $contextlist = new \core_privacy\local\request\contextlist();
static::call_subplugins_method_with_args('add_contexts_for_userid', [$contextlist, $userid]); static::call_subplugins_method_with_args('add_contexts_for_userid', [$contextlist, $userid]);
return $contextlist; return $contextlist;

View file

@ -51,7 +51,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to. * @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system. * @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_external_location_link('log', [ $collection->add_external_location_link('log', [
'eventname' => 'privacy:metadata:log:eventname', 'eventname' => 'privacy:metadata:log:eventname',
'userid' => 'privacy:metadata:log:userid', 'userid' => 'privacy:metadata:log:userid',

View file

@ -51,7 +51,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to. * @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system. * @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_database_table('logstore_standard_log', [ $collection->add_database_table('logstore_standard_log', [
'eventname' => 'privacy:metadata:log:eventname', 'eventname' => 'privacy:metadata:log:eventname',
'userid' => 'privacy:metadata:log:userid', 'userid' => 'privacy:metadata:log:userid',

View file

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

View file

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

View file

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

View file

@ -54,7 +54,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to. * @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system. * @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_database_table('messageinbound_messagelist', [ $collection->add_database_table('messageinbound_messagelist', [
'messageid' => 'privacy:metadata:messagelist:messageid', 'messageid' => 'privacy:metadata:messagelist:messageid',
@ -75,7 +75,7 @@ class provider implements
* @param int $userid The user to search. * @param int $userid The user to search.
* @return \contextlist $contextlist The contextlist containing the list of contexts used in this plugin. * @return \contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/ */
public static function get_contexts_for_userid(int $userid) : \core_privacy\local\request\contextlist { public static function get_contexts_for_userid(int $userid): \core_privacy\local\request\contextlist {
$contextlist = new \core_privacy\local\request\contextlist(); $contextlist = new \core_privacy\local\request\contextlist();
// Always add the user context so we're sure we're not dodging user keys, besides it's not costly to do so. // Always add the user context so we're sure we're not dodging user keys, besides it's not costly to do so.

View file

@ -60,7 +60,7 @@ class helper {
* @param string $phonenumber from the given user input * @param string $phonenumber from the given user input
* @return bool * @return bool
*/ */
public static function is_valid_phonenumber(string $phonenumber) : bool { public static function is_valid_phonenumber(string $phonenumber): bool {
$phonenumber = self::format_number($phonenumber); $phonenumber = self::format_number($phonenumber);
return (preg_match("/^\+[1-9]\d{1,14}$/", $phonenumber)) ? true : false; return (preg_match("/^\+[1-9]\d{1,14}$/", $phonenumber)) ? true : false;
} }

View file

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

View file

@ -789,7 +789,7 @@ class api {
* *
* @return array Subscription information * @return array Subscription information
*/ */
public static function get_subscription_information() : ?array { public static function get_subscription_information(): ?array {
global $CFG; global $CFG;
// Use session cache to prevent multiple requests. // Use session cache to prevent multiple requests.

View file

@ -47,7 +47,7 @@ class provider implements
* @param collection $collection The initialised item collection to add items to. * @param collection $collection The initialised item collection to add items to.
* @return collection A listing of user data stored through this system. * @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 {
// There is a one user preference. // There is a one user preference.
$collection->add_user_preference('tool_mobile_autologin_request_last', $collection->add_user_preference('tool_mobile_autologin_request_last',
'privacy:metadata:preference:tool_mobile_autologin_request_last'); 'privacy:metadata:preference:tool_mobile_autologin_request_last');
@ -61,7 +61,7 @@ class provider implements
* @param int $userid The user to search. * @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin. * @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 {
$sql = "SELECT ctx.id $sql = "SELECT ctx.id
FROM {user_private_key} k FROM {user_private_key} k
JOIN {user} u ON k.userid = u.id JOIN {user} u ON k.userid = u.id

View file

@ -52,7 +52,7 @@ class provider implements
* @param collection $collection An object for storing metadata. * @param collection $collection An object for storing metadata.
* @return collection The metadata. * @return collection The metadata.
*/ */
public static function get_metadata(collection $collection) : collection { public static function get_metadata(collection $collection): collection {
$toolmonitorrules = [ $toolmonitorrules = [
'description' => 'privacy:metadata:description', 'description' => 'privacy:metadata:description',
'name' => 'privacy:metadata:name', 'name' => 'privacy:metadata:name',
@ -90,7 +90,7 @@ class provider implements
* @param int $userid The user ID. * @param int $userid The user ID.
* @return contextlist The list of context IDs. * @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 {
$params = ['useridrules' => $userid, 'useridsubscriptions' => $userid, 'contextuserrule' => CONTEXT_USER, $params = ['useridrules' => $userid, 'useridsubscriptions' => $userid, 'contextuserrule' => CONTEXT_USER,
'contextusersub' => CONTEXT_USER]; 'contextusersub' => CONTEXT_USER];
$sql = "SELECT DISTINCT ctx.id $sql = "SELECT DISTINCT ctx.id

View file

@ -40,7 +40,7 @@ class rule_form extends \moodleform {
* Mform class definition * Mform class definition
* *
*/ */
public function definition () { public function definition() {
global $PAGE; global $PAGE;
$mform = $this->_form; $mform = $this->_form;

View file

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

View file

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

View file

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

View file

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

View file

@ -57,7 +57,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to. * @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system. * @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_database_table( $collection->add_database_table(
'tool_policy_acceptances', 'tool_policy_acceptances',
[ [
@ -104,7 +104,7 @@ class provider implements
* @param int $userid The userid. * @param int $userid The userid.
* @return contextlist The list of contexts containing user info for the user. * @return contextlist The list of contexts containing user info for the user.
*/ */
public static function get_contexts_for_userid(int $userid) : contextlist { public static function get_contexts_for_userid(int $userid): contextlist {
$contextlist = new contextlist(); $contextlist = new contextlist();
// Policies a user has modified. // Policies a user has modified.

View file

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

View file

@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/formslib.php'); require_once($CFG->libdir . '/formslib.php');
class profiling_import_form extends moodleform { class profiling_import_form extends moodleform {
public function definition () { public function definition() {
global $CFG; global $CFG;
$mform = $this->_form; $mform = $this->_form;

View file

@ -47,33 +47,33 @@ abstract class base_bin {
* *
* @param int $itemid Item ID to retrieve. * @param int $itemid Item ID to retrieve.
*/ */
public abstract function get_item($itemid); abstract public function get_item($itemid);
/** /**
* Returns a list of items in the recycle bin. * Returns a list of items in the recycle bin.
*/ */
public abstract function get_items(); abstract public function get_items();
/** /**
* Store an item in this recycle bin. * Store an item in this recycle bin.
* *
* @param \stdClass $item Item to store. * @param \stdClass $item Item to store.
*/ */
public abstract function store_item($item); abstract public function store_item($item);
/** /**
* Restore an item from the recycle bin. * Restore an item from the recycle bin.
* *
* @param \stdClass $item The item database record * @param \stdClass $item The item database record
*/ */
public abstract function restore_item($item); abstract public function restore_item($item);
/** /**
* Delete an item from the recycle bin. * Delete an item from the recycle bin.
* *
* @param \stdClass $item The item database record * @param \stdClass $item The item database record
*/ */
public abstract function delete_item($item); abstract public function delete_item($item);
/** /**
* Empty the recycle bin. * Empty the recycle bin.
@ -91,15 +91,15 @@ abstract class base_bin {
/** /**
* Can we view items in this recycle bin? * Can we view items in this recycle bin?
*/ */
public abstract function can_view(); abstract public function can_view();
/** /**
* Can we restore items in this recycle bin? * Can we restore items in this recycle bin?
*/ */
public abstract function can_restore(); abstract public function can_restore();
/** /**
* Can we delete this? * Can we delete this?
*/ */
public abstract function can_delete(); abstract public function can_delete();
} }

View file

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

View file

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

View file

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

View file

@ -34,7 +34,7 @@ class adhocqueue extends check {
* Return result * Return result
* @return result * @return result
*/ */
public function get_result() : result { public function get_result(): result {
global $DB, $CFG; global $DB, $CFG;
$stats = $DB->get_record_sql(' $stats = $DB->get_record_sql('

View file

@ -52,7 +52,7 @@ class cronrunning extends check {
* Return result * Return result
* @return result * @return result
*/ */
public function get_result() : result { public function get_result(): result {
global $CFG; global $CFG;
// Eventually this should replace cron_overdue_warning and // Eventually this should replace cron_overdue_warning and

View file

@ -52,7 +52,7 @@ class maxfaildelay extends check {
* Return result * Return result
* @return result * @return result
*/ */
public function get_result() : result { public function get_result(): result {
global $CFG; global $CFG;
$status = result::OK; $status = result::OK;

View file

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

View file

@ -85,7 +85,7 @@ class running_tasks_table extends \table_sql {
* @param \stdClass $row * @param \stdClass $row
* @return string * @return string
*/ */
public function col_classname($row) : string { public function col_classname($row): string {
$output = $row->classname; $output = $row->classname;
if ($row->type == 'scheduled') { if ($row->type == 'scheduled') {
if (class_exists($row->classname)) { if (class_exists($row->classname)) {
@ -108,7 +108,7 @@ class running_tasks_table extends \table_sql {
* @return string * @return string
* @throws \coding_exception * @throws \coding_exception
*/ */
public function col_type($row) : string { public function col_type($row): string {
if ($row->type == 'scheduled') { if ($row->type == 'scheduled') {
$output = \html_writer::span(get_string('scheduled', 'tool_task'), 'badge bg-primary text-white'); $output = \html_writer::span(get_string('scheduled', 'tool_task'), 'badge bg-primary text-white');
} else if ($row->type == 'adhoc') { } else if ($row->type == 'adhoc') {
@ -126,7 +126,7 @@ class running_tasks_table extends \table_sql {
* @param \stdClass $row * @param \stdClass $row
* @return string * @return string
*/ */
public function col_time($row) : string { public function col_time($row): string {
global $OUTPUT; global $OUTPUT;
$taskmethod = "{$row->type}_task_from_record"; $taskmethod = "{$row->type}_task_from_record";
@ -150,7 +150,7 @@ class running_tasks_table extends \table_sql {
* @param \stdClass $row * @param \stdClass $row
* @return string * @return string
*/ */
public function col_timestarted($row) : string { public function col_timestarted($row): string {
return userdate($row->timestarted); return userdate($row->timestarted);
} }
} }

View file

@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die();
* *
* @return array of check objects * @return array of check objects
*/ */
function tool_task_status_checks() : array { function tool_task_status_checks(): array {
return [ return [
new \tool_task\check\cronrunning(), new \tool_task\check\cronrunning(),
new \tool_task\check\maxfaildelay(), new \tool_task\check\maxfaildelay(),

View file

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

View file

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

View file

@ -1199,7 +1199,7 @@ class tool_uploadcourse_course {
* @param int $roleid Role ID. * @param int $roleid Role ID.
* @return bool * @return bool
*/ */
protected function validate_role_context(int $courseid, int $roleid) : bool { protected function validate_role_context(int $courseid, int $roleid): bool {
if (empty($this->assignableroles[$courseid])) { if (empty($this->assignableroles[$courseid])) {
$coursecontext = \context_course::instance($courseid); $coursecontext = \context_course::instance($courseid);
$this->assignableroles[$courseid] = get_assignable_roles($coursecontext, ROLENAME_SHORT); $this->assignableroles[$courseid] = get_assignable_roles($coursecontext, ROLENAME_SHORT);
@ -1216,7 +1216,7 @@ class tool_uploadcourse_course {
* @param int $roleid Role ID. * @param int $roleid Role ID.
* @return bool * @return bool
*/ */
protected function validate_role_context_level(int $roleid) : bool { protected function validate_role_context_level(int $roleid): bool {
if (empty($this->contextlevels[$roleid])) { if (empty($this->contextlevels[$roleid])) {
$this->contextlevels[$roleid] = get_role_contextlevels($roleid); $this->contextlevels[$roleid] = get_role_contextlevels($roleid);
} }

View file

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

View file

@ -39,7 +39,7 @@ class tool_uploadcourse_step1_form extends tool_uploadcourse_base_form {
* The standard form definiton. * The standard form definiton.
* @return void * @return void
*/ */
public function definition () { public function definition() {
$mform = $this->_form; $mform = $this->_form;
$mform->addElement('header', 'generalhdr', get_string('general')); $mform->addElement('header', 'generalhdr', get_string('general'));

View file

@ -39,7 +39,7 @@ class tool_uploadcourse_step2_form extends tool_uploadcourse_base_form {
* The standard form definiton. * The standard form definiton.
* @return void. * @return void.
*/ */
public function definition () { public function definition() {
global $CFG; global $CFG;
$mform = $this->_form; $mform = $this->_form;

View file

@ -1739,7 +1739,7 @@ class course_test extends \advanced_testcase {
* *
* @return core_customfield_generator * @return core_customfield_generator
*/ */
protected function get_customfield_generator() : \core_customfield_generator { protected function get_customfield_generator(): \core_customfield_generator {
return $this->getDataGenerator()->get_plugin_generator('core_customfield'); return $this->getDataGenerator()->get_plugin_generator('core_customfield');
} }
@ -1753,7 +1753,7 @@ class course_test extends \advanced_testcase {
* @return \core_customfield\field_controller * @return \core_customfield\field_controller
*/ */
protected function create_custom_field(\core_customfield\category_controller $category, string $type, string $shortname, protected function create_custom_field(\core_customfield\category_controller $category, string $type, string $shortname,
array $configdata = []) : \core_customfield\field_controller { array $configdata = []): \core_customfield\field_controller {
return $this->get_customfield_generator()->create_field([ return $this->get_customfield_generator()->create_field([
'categoryid' => $category->get('id'), 'categoryid' => $category->get('id'),

View file

@ -470,7 +470,7 @@ class helper_test extends \advanced_testcase {
* *
* @return core_customfield_generator * @return core_customfield_generator
*/ */
protected function get_customfield_generator() : \core_customfield_generator { protected function get_customfield_generator(): \core_customfield_generator {
return $this->getDataGenerator()->get_plugin_generator('core_customfield'); return $this->getDataGenerator()->get_plugin_generator('core_customfield');
} }
@ -484,7 +484,7 @@ class helper_test extends \advanced_testcase {
* @return \core_customfield\field_controller * @return \core_customfield\field_controller
*/ */
protected function create_custom_field(\core_customfield\category_controller $category, string $type, string $shortname, protected function create_custom_field(\core_customfield\category_controller $category, string $type, string $shortname,
array $configdata = []) : \core_customfield\field_controller { array $configdata = []): \core_customfield\field_controller {
return $this->get_customfield_generator()->create_field([ return $this->get_customfield_generator()->create_field([
'categoryid' => $category->get('id'), 'categoryid' => $category->get('id'),

View file

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

View file

@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die();
require_once $CFG->libdir.'/formslib.php'; require_once $CFG->libdir.'/formslib.php';
class admin_uploadpicture_form extends moodleform { class admin_uploadpicture_form extends moodleform {
function definition (){ function definition(){
global $CFG, $USER; global $CFG, $USER;
$mform =& $this->_form; $mform =& $this->_form;

View file

@ -35,7 +35,7 @@ require_once($CFG->dirroot . '/user/editlib.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
class admin_uploaduser_form1 extends moodleform { class admin_uploaduser_form1 extends moodleform {
function definition () { function definition() {
$mform = $this->_form; $mform = $this->_form;
$mform->addElement('header', 'settingsheader', get_string('upload')); $mform->addElement('header', 'settingsheader', get_string('upload'));
@ -90,7 +90,7 @@ class admin_uploaduser_form1 extends moodleform {
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
class admin_uploaduser_form2 extends moodleform { class admin_uploaduser_form2 extends moodleform {
function definition () { function definition() {
global $CFG, $USER; global $CFG, $USER;
$mform = $this->_form; $mform = $this->_form;

View file

@ -46,7 +46,7 @@ class tour implements \renderable {
* *
* @param toursource $tour The tour being output. * @param toursource $tour The tour being output.
*/ */
public function __construct (toursource $tour) { public function __construct(toursource $tour) {
$this->tour = $tour; $this->tour = $tour;
} }

View file

@ -50,7 +50,7 @@ class provider implements
* @param collection $items The initialised item collection to add items to. * @param collection $items The initialised item collection to add items to.
* @return collection A listing of user data stored through this system. * @return collection A listing of user data stored through this system.
*/ */
public static function get_metadata(collection $items) : collection { public static function get_metadata(collection $items): collection {
// There are several user preferences. // There are several user preferences.
$items->add_user_preference(\tool_usertours\tour::TOUR_REQUESTED_BY_USER, 'privacy:metadata:preference:requested'); $items->add_user_preference(\tool_usertours\tour::TOUR_REQUESTED_BY_USER, 'privacy:metadata:preference:requested');
$items->add_user_preference(\tool_usertours\tour::TOUR_LAST_COMPLETED_BY_USER, 'privacy:metadata:preference:completed'); $items->add_user_preference(\tool_usertours\tour::TOUR_LAST_COMPLETED_BY_USER, 'privacy:metadata:preference:completed');

View file

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

View file

@ -40,7 +40,7 @@ abstract class webservice_test_client_base_form extends moodleform {
/** /**
* Definition of the parameters used by this WS function * Definition of the parameters used by this WS function
*/ */
protected abstract function test_client_definition(); abstract protected function test_client_definition();
/** /**
* The form definition. * The form definition.

View file

@ -79,7 +79,7 @@ abstract class calculable {
* *
* @return \lang_string * @return \lang_string
*/ */
public static abstract function get_name() : \lang_string; abstract public static function get_name(): \lang_string;
/** /**
* The class id is the calculable class full qualified class name. * The class id is the calculable class full qualified class name.
@ -160,7 +160,7 @@ abstract class calculable {
* @param array $info The data. Indexed by an id unique across the site. E.g. an activity id. * @param array $info The data. Indexed by an id unique across the site. E.g. an activity id.
* @return null * @return null
*/ */
protected final function add_shared_calculation_info(int $sampleid, array $info) { final protected function add_shared_calculation_info(int $sampleid, array $info) {
if (is_null($this->calculationinfo)) { if (is_null($this->calculationinfo)) {
// Lazy loading. // Lazy loading.
$this->calculationinfo = new \core_analytics\calculation_info(); $this->calculationinfo = new \core_analytics\calculation_info();
@ -178,7 +178,7 @@ abstract class calculable {
* @param int $rangeindex * @param int $rangeindex
* @return null * @return null
*/ */
public final function save_calculation_info(\core_analytics\local\time_splitting\base $timesplitting, int $rangeindex) { final public function save_calculation_info(\core_analytics\local\time_splitting\base $timesplitting, int $rangeindex) {
if (!is_null($this->calculationinfo)) { if (!is_null($this->calculationinfo)) {
$this->calculationinfo->save($this, $timesplitting, $rangeindex); $this->calculationinfo->save($this, $timesplitting, $rangeindex);
} }

View file

@ -40,7 +40,7 @@ abstract class binary extends discrete {
* *
* @return array * @return array
*/ */
public static final function get_classes() { final public static function get_classes() {
return [-1, 1]; return [-1, 1];
} }

View file

@ -146,7 +146,7 @@ abstract class community_of_inquiry_activity extends linear {
* *
* @var string The activity name (e.g. assign or quiz) * @var string The activity name (e.g. assign or quiz)
*/ */
public final function get_activity_type() { final public function get_activity_type() {
$class = get_class($this); $class = get_class($this);
$package = stristr($class, "\\", true); $package = stristr($class, "\\", true);
$type = str_replace("mod_", "", $package); $type = str_replace("mod_", "", $package);
@ -197,7 +197,7 @@ abstract class community_of_inquiry_activity extends linear {
* @param \stdClass|false $user * @param \stdClass|false $user
* @return bool * @return bool
*/ */
protected final function any_log($contextid, $user) { final protected function any_log($contextid, $user) {
if (empty($this->activitylogs[$contextid])) { if (empty($this->activitylogs[$contextid])) {
return false; return false;
} }
@ -221,7 +221,7 @@ abstract class community_of_inquiry_activity extends linear {
* @param \stdClass|false $user * @param \stdClass|false $user
* @return bool * @return bool
*/ */
protected final function any_write_log($contextid, $user) { final protected function any_write_log($contextid, $user) {
if (empty($this->activitylogs[$contextid])) { if (empty($this->activitylogs[$contextid])) {
return false; return false;
} }

View file

@ -51,7 +51,7 @@ abstract class binary extends discrete {
* *
* @return array * @return array
*/ */
public static final function get_classes() { final public static function get_classes() {
return array(0, 1); return array(0, 1);
} }

View file

@ -77,7 +77,7 @@ abstract class base {
* *
* @return \lang_string * @return \lang_string
*/ */
public static abstract function get_name() : \lang_string; abstract public static function get_name(): \lang_string;
/** /**
* Returns the time splitting method id. * Returns the time splitting method id.
@ -231,7 +231,7 @@ abstract class base {
* @param int $rangeindex * @param int $rangeindex
* @return string * @return string
*/ */
public final function append_rangeindex($sampleid, $rangeindex) { final public function append_rangeindex($sampleid, $rangeindex) {
return $sampleid . '-' . $rangeindex; return $sampleid . '-' . $rangeindex;
} }
@ -241,7 +241,7 @@ abstract class base {
* @param string $uniquesampleid * @param string $uniquesampleid
* @return array array($sampleid, $rangeindex) * @return array array($sampleid, $rangeindex)
*/ */
public final function infer_sample_info($uniquesampleid) { final public function infer_sample_info($uniquesampleid) {
return explode('-', $uniquesampleid); return explode('-', $uniquesampleid);
} }

View file

@ -357,7 +357,7 @@ class manager {
* *
* @return \core_analytics\local\target\base[] * @return \core_analytics\local\target\base[]
*/ */
public static function get_all_targets() : array { public static function get_all_targets(): array {
if (self::$alltargets !== null) { if (self::$alltargets !== null) {
return self::$alltargets; return self::$alltargets;
} }
@ -909,7 +909,7 @@ class manager {
* @param array $model Model declaration * @param array $model Model declaration
* @return string complying with PARAM_ALPHANUM rules and starting with an 'id' prefix * @return string complying with PARAM_ALPHANUM rules and starting with an 'id' prefix
*/ */
public static function model_declaration_identifier(array $model) : string { public static function model_declaration_identifier(array $model): string {
return 'id'.sha1(serialize($model)); return 'id'.sha1(serialize($model));
} }

Some files were not shown because too many files have changed in this diff Show more