MDL-65292 style: Fix all function declarations white space

This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing

All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.

Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
This commit is contained in:
Eloy Lafuente (stronk7)
2024-02-28 23:33:26 +01:00
parent e567c21d6e
commit ba1f804ffa
972 changed files with 2098 additions and 2094 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+2 -2
View File
@@ -41,7 +41,7 @@ class provider implements
* @param collection $collection A list of information about this component
* @return collection The collection object filled out with information about this component.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
// These tables are really data about site configuration and not user data.
// The adminpresets includes information about which user performed a configuration change using the admin_presets
@@ -74,7 +74,7 @@ class provider implements
* @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
return new contextlist();
}
+1 -1
View File
@@ -617,7 +617,7 @@ class core_admin_renderer extends plugin_renderer_base {
* @param bool $croninfrequent
* @return string HTML to output.
*/
public function cron_infrequent_warning(bool $croninfrequent) : string {
public function cron_infrequent_warning(bool $croninfrequent): string {
global $CFG;
if (!$croninfrequent) {
+2 -2
View File
@@ -53,7 +53,7 @@ class provider implements
* @param collection $collection An object for storing metadata.
* @return collection The metadata.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$rolecapabilities = [
'roleid' => 'privacy:metadata:role_capabilities:roleid',
'capability' => 'privacy:metadata:role_capabilities:capability',
@@ -100,7 +100,7 @@ class provider implements
* @param int $userid The user ID.
* @return contextlist The list of context IDs.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
global $DB;
$contextlist = new contextlist();
@@ -31,7 +31,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -42,7 +42,7 @@ class import_model extends \moodleform {
*
* @return null
*/
public function definition () {
public function definition() {
$mform = $this->_form;
$mform->addElement('header', 'settingsheader', get_string('importmodel', 'tool_analytics'));
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -157,7 +157,7 @@ class renderer extends plugin_renderer_base {
* @throws \coding_exception
* @throws \moodle_exception
*/
public function analysisbutton(int $courseid) : string {
public function analysisbutton(int $courseid): string {
$link = new moodle_url(accessibility::get_plugin_url(), [
'action' => 'requestanalysis',
'courseid' => $courseid
@@ -30,7 +30,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -52,7 +52,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
// The tool_cohortroles plugin utilises the mdl_tool_cohortroles table.
$collection->add_database_table(
'tool_cohortroles',
@@ -77,7 +77,7 @@ class provider implements
* @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
$contextlist = new contextlist();
// When we process user deletions and expiries, we always delete from the user context.
@@ -30,7 +30,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -60,7 +60,7 @@ class langstring_test extends advanced_testcase {
*
* @return array
*/
public function fix_syntax_data() : array {
public function fix_syntax_data(): array {
return [
// Syntax sanity v1 strings.
[
@@ -79,7 +79,7 @@ class phpparser_test extends advanced_testcase {
*
* @return array
*/
public function parse_provider() : array {
public function parse_provider(): array {
return [
'Invalid PHP code' => [
'No PHP code', [], false
+4 -4
View File
@@ -168,7 +168,7 @@ class api {
*
* @return array An array of the DPO role shortnames
*/
public static function get_dpo_role_names() : array {
public static function get_dpo_role_names(): array {
global $DB;
$dporoleids = self::get_assigned_privacy_officer_roles();
@@ -524,7 +524,7 @@ class api {
* @param array $userids
* @return array
*/
public static function find_ongoing_request_types_for_users(array $userids) : array {
public static function find_ongoing_request_types_for_users(array $userids): array {
global $DB;
if (empty($userids)) {
@@ -1201,7 +1201,7 @@ class api {
* @return contextlist_collection The collection of approved_contextlist objects.
*/
public static function get_approved_contextlist_collection_for_collection(contextlist_collection $collection,
\stdClass $foruser, int $type) : contextlist_collection {
\stdClass $foruser, int $type): contextlist_collection {
// Create the approved contextlist collection object.
$approvedcollection = new contextlist_collection($collection->get_userid());
@@ -1326,7 +1326,7 @@ class api {
* @param \DateInterval $interval
* @return string
*/
public static function format_retention_period(\DateInterval $interval) : string {
public static function format_retention_period(\DateInterval $interval): string {
// It is one or another.
if ($interval->y) {
$formattedtime = get_string('numyears', 'moodle', $interval->format('%y'));
@@ -241,7 +241,7 @@ class data_request extends persistent {
*
* @return bool
*/
public function is_resettable() : bool {
public function is_resettable(): bool {
if (api::DATAREQUEST_TYPE_OTHERS == $this->get('type')) {
// It is not possible to reset 'other' reqeusts.
return false;
@@ -260,7 +260,7 @@ class data_request extends persistent {
*
* @return bool
*/
public function is_active() : bool {
public function is_active(): bool {
$active = [
api::DATAREQUEST_STATUS_APPROVED => true,
];
@@ -275,7 +275,7 @@ class data_request extends persistent {
*
* @return self
*/
public function resubmit_request() : data_request {
public function resubmit_request(): data_request {
if ($this->is_active()) {
$this->set('status', api::DATAREQUEST_STATUS_REJECTED)->save();
}
@@ -182,7 +182,7 @@ class expired_context extends \core\persistent {
* @param int[] $roleids
* @return expired_context
*/
protected function set_roleids_for(string $field, array $roleids) : expired_context {
protected function set_roleids_for(string $field, array $roleids): expired_context {
$roledata = json_encode($roleids);
$this->raw_set($field, $roledata);
@@ -211,7 +211,7 @@ class expired_context extends \core\persistent {
* @param int[] $roleids
* @return expired_context
*/
protected function set_unexpiredroles(array $roleids) : expired_context {
protected function set_unexpiredroles(array $roleids): expired_context {
$this->set_roleids_for('unexpiredroles', $roleids);
return $this;
@@ -223,7 +223,7 @@ class expired_context extends \core\persistent {
* @param int[] $roleids
* @return expired_context
*/
public function add_expiredroles(array $roleids) : expired_context {
public function add_expiredroles(array $roleids): expired_context {
$existing = $this->get('expiredroles');
$newvalue = array_merge($existing, $roleids);
@@ -238,7 +238,7 @@ class expired_context extends \core\persistent {
* @param int[] $roleids
* @return unexpired_context
*/
public function add_unexpiredroles(array $roleids) : expired_context {
public function add_unexpiredroles(array $roleids): expired_context {
$existing = $this->get('unexpiredroles');
$newvalue = array_merge($existing, $roleids);
@@ -253,7 +253,7 @@ class expired_context extends \core\persistent {
* @param int[] $roleids
* @return expired_context
*/
protected function set_expiredroles(array $roleids) : expired_context {
protected function set_expiredroles(array $roleids): expired_context {
$this->set_roleids_for('expiredroles', $roleids);
return $this;
@@ -285,7 +285,7 @@ class expired_context extends \core\persistent {
* @param boolean $save
* @return expired_context
*/
public static function create_from_expiry_info(\context $context, expiry_info $info, bool $save = true) : expired_context {
public static function create_from_expiry_info(\context $context, expiry_info $info, bool $save = true): expired_context {
$record = (object) [
'contextid' => $context->id,
'status' => self::STATUS_EXPIRED,
@@ -309,7 +309,7 @@ class expired_context extends \core\persistent {
* @param expiry_info $info
* @return $this
*/
public function update_from_expiry_info(expiry_info $info) : expired_context {
public function update_from_expiry_info(expiry_info $info): expired_context {
$save = false;
// Compare the expiredroles.
@@ -353,7 +353,7 @@ class expired_context extends \core\persistent {
*
* @return bool
*/
public function can_process_deletion() : bool {
public function can_process_deletion(): bool {
return ($this->get('status') == self::STATUS_APPROVED);
}
@@ -362,7 +362,7 @@ class expired_context extends \core\persistent {
*
* @return bool
*/
public function is_complete() : bool {
public function is_complete(): bool {
return ($this->get('status') == self::STATUS_CLEANED);
}
@@ -372,7 +372,7 @@ class expired_context extends \core\persistent {
*
* @return bool
*/
public function is_fully_expired() : bool {
public function is_fully_expired(): bool {
return $this->get('defaultexpired') && empty($this->get('unexpiredroles'));
}
}
@@ -68,7 +68,7 @@ class expired_contexts_manager {
*
* @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');
if (!$this->check_requirements()) {
$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
* @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);
$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
* @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;
$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
* @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;
$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.
* @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;
$fulllist = $DB->get_recordset_sql($sql, $params);
@@ -334,7 +334,7 @@ class expired_contexts_manager {
* @param \context $context
* @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;
// Check whether any of the child contexts are ineligble.
$shouldskip = !empty(array_filter($pathstoskip, function($path) use ($context) {
@@ -361,7 +361,7 @@ class expired_contexts_manager {
*
* @return int[] The number of deleted contexts.
*/
public function process_approved_deletions() : array {
public function process_approved_deletions(): array {
$this->trace->output('Checking requirements');
if (!$this->check_requirements()) {
$this->trace->output('Requirements not met. Cannot process expired retentions.', 1);
@@ -538,7 +538,7 @@ class expired_contexts_manager {
*
* @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');
return !empty($requireenddate);
@@ -563,7 +563,7 @@ class expired_contexts_manager {
* @param int $comparisondate The date for comparison
* @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->setTimestamp($comparisondate);
$dt->add(new \DateInterval($period));
@@ -578,7 +578,7 @@ class expired_contexts_manager {
* @param int $comparisondate The date for comparison
* @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();
$expiredroles = $unexpiredroles = [];
if (empty($overrides)) {
@@ -730,7 +730,7 @@ class expired_contexts_manager {
* @param \context $context
* @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');
$expiredroleusers = [];
if (!empty($expiredroles)) {
@@ -782,7 +782,7 @@ class expired_contexts_manager {
* @param \context $context
* @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);
foreach ($parents as $parent) {
if ($parent instanceof \context_course) {
@@ -805,7 +805,7 @@ class expired_contexts_manager {
* @param \stdClass $course
* @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);
return self::is_course_context_expired($context);
@@ -818,7 +818,7 @@ class expired_contexts_manager {
* @param \context $context
* @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);
return !empty($expiryrecords[$context->path]) && $expiryrecords[$context->path]->info->is_fully_expired();
@@ -839,7 +839,7 @@ class expired_contexts_manager {
* @param \context_user $context
* @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.
if (isguestuser($context->instanceid) || is_siteadmin($context->instanceid)) {
// This is an admin, or the guest and cannot expire.
@@ -889,7 +889,7 @@ class expired_contexts_manager {
* @param \stdClass $user
* @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.
if (!data_registry::defaults_set()) {
return false;
@@ -972,7 +972,7 @@ class expired_contexts_manager {
*
* @return manager
*/
protected function get_privacy_manager() : manager {
protected function get_privacy_manager(): manager {
if (null === $this->manager) {
$this->manager = new manager();
$this->manager->set_observer(new \tool_dataprivacy\manager_observer());
@@ -986,7 +986,7 @@ class expired_contexts_manager {
*
* @return int
*/
protected function get_delete_limit() : int {
protected function get_delete_limit(): int {
return self::DELETE_LIMIT;
}
@@ -995,7 +995,7 @@ class expired_contexts_manager {
*
* @return \progress_trace
*/
protected function get_progress() : \progress_trace {
protected function get_progress(): \progress_trace {
if (null === $this->progresstracer) {
$this->set_progress(new \text_progress_trace());
}
@@ -1009,7 +1009,7 @@ class expired_contexts_manager {
* @param \progress_trace $trace
* @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;
return $this;
+10 -10
View File
@@ -76,7 +76,7 @@ class expiry_info {
*
* @return bool
*/
public function is_fully_expired() : bool {
public function is_fully_expired(): bool {
return $this->defaultexpiryreached && empty($this->unexpired);
}
@@ -85,7 +85,7 @@ class expiry_info {
*
* @return bool
*/
public function is_any_expired() : bool {
public function is_any_expired(): bool {
if ($this->is_fully_expired()) {
return true;
}
@@ -107,7 +107,7 @@ class expiry_info {
*
* @return int[]
*/
public function get_expired_roles() : array {
public function get_expired_roles(): array {
if ($this->is_default_expired()) {
return [];
}
@@ -121,7 +121,7 @@ class expiry_info {
* @param int $roleid
* @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);
}
@@ -130,7 +130,7 @@ class expiry_info {
*
* @return bool
*/
public function is_default_expired() : bool {
public function is_default_expired(): bool {
return $this->defaultexpiryreached;
}
@@ -139,7 +139,7 @@ class expiry_info {
*
* @return bool
*/
public function is_default_protected() : bool {
public function is_default_protected(): bool {
return $this->defaultprotected;
}
@@ -148,7 +148,7 @@ class expiry_info {
*
* @return int[]
*/
public function get_unexpired_roles() : array {
public function get_unexpired_roles(): array {
return $this->unexpired;
}
@@ -157,7 +157,7 @@ class expiry_info {
*
* @return int[]
*/
public function get_unexpired_protected_roles() : array {
public function get_unexpired_protected_roles(): array {
return array_keys(array_filter($this->protectedroles));
}
@@ -165,7 +165,7 @@ class expiry_info {
* Get a list of all overridden roles which are unprotected.
* @return int[]
*/
public function get_unprotected_overridden_roles() : array {
public function get_unprotected_overridden_roles(): array {
$allroles = array_merge($this->expired, $this->unexpired);
return array_diff($allroles, $this->protectedroles);
@@ -181,7 +181,7 @@ class expiry_info {
* @param expiry_info $child The child record to merge with.
* @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()) {
return $this;
}
@@ -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.
* @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.
$userids = $this->get_userids();
@@ -245,7 +245,7 @@ class purpose extends persistent {
* @param string $prefix The prefix to apply to the field
* @return \stdClass
*/
protected function get_role_override_id(string $prefix = '') : \stdClass {
protected function get_role_override_id(string $prefix = ''): \stdClass {
$fieldname = "{$prefix}id";
$fielddata = (object) [
@@ -264,7 +264,7 @@ class purpose extends persistent {
* @param string $prefix The prefix to apply to the field
* @return \stdClass
*/
protected function get_role_field(string $prefix = '') : \stdClass {
protected function get_role_field(string $prefix = ''): \stdClass {
$fieldname = "{$prefix}roleid";
$fielddata = (object) [
@@ -297,7 +297,7 @@ class purpose extends persistent {
* @param string $prefix The prefix to apply to the field
* @return \stdClass
*/
protected function get_lawful_base_field(string $prefix = '') : \stdClass {
protected function get_lawful_base_field(string $prefix = ''): \stdClass {
$fieldname = "{$prefix}lawfulbases";
$data = (object) [
@@ -334,7 +334,7 @@ class purpose extends persistent {
* @param string $prefix The prefix to apply to the field
* @return \stdClass
*/
protected function get_sensitive_base_field(string $prefix = '') : \stdClass {
protected function get_sensitive_base_field(string $prefix = ''): \stdClass {
$fieldname = "{$prefix}sensitivedatareasons";
$data = (object) [
@@ -373,7 +373,7 @@ class purpose extends persistent {
* @param string $prefix The name of the main field, and prefix for the subfields.
* @return \stdClass
*/
protected function get_retention_period_fields(string $prefix = '') : \stdClass {
protected function get_retention_period_fields(string $prefix = ''): \stdClass {
$prefix = "{$prefix}retentionperiod";
$data = (object) [
'fields' => [],
@@ -411,7 +411,7 @@ class purpose extends persistent {
* @param string $prefix The prefix to apply to the field
* @return \stdClass
*/
protected function get_protected_field(string $prefix = '') : \stdClass {
protected function get_protected_field(string $prefix = ''): \stdClass {
$fieldname = "{$prefix}protected";
return (object) [
@@ -470,7 +470,7 @@ class purpose extends persistent {
* @param \stdClass $data
* @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);
if (!empty($data->sensitivedatareasons)) {
$data->sensitivedatareasons = explode(',', $data->sensitivedatareasons);
@@ -429,7 +429,7 @@ class data_requests_table extends table_sql {
*
* @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;
}
@@ -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.
*/
public function get_requests_per_page_options() : array {
public function get_requests_per_page_options(): array {
return $this->perpageoptions;
}
}
@@ -370,7 +370,7 @@ class expired_contexts_table extends table_sql {
* @param expired_context $expiredcontext
* @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'));
if (empty($this->purposemap[$context->id])) {
@@ -66,7 +66,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_database_table(
'tool_dataprivacy_request',
[
@@ -103,7 +103,7 @@ class provider implements
* @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
$sql = "SELECT id
FROM {context}
WHERE instanceid = :userid
+1 -1
View File
@@ -185,7 +185,7 @@ class purpose extends \core\persistent {
*
* @return array
*/
public function get_purpose_overrides() : array {
public function get_purpose_overrides(): array {
return purpose_override::get_overrides_for_purpose($this);
}
}
@@ -88,7 +88,7 @@ class purpose_override extends \core\persistent {
* @param purpose $purpose
* @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');
$overrides = [];
+2 -2
View File
@@ -2165,7 +2165,7 @@ class api_test extends \advanced_testcase {
* @param string $course Retention policy for courses.
* @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();
$purposes = (object) [
@@ -2321,7 +2321,7 @@ class api_test extends \advanced_testcase {
* @param int $status
* @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) [
'userid' => $userid,
'type' => $type,
@@ -35,7 +35,7 @@ class data_request_test extends data_privacy_testcase {
*
* @return array
*/
public function status_state_provider() : array {
public function status_state_provider(): array {
return [
[
'state' => api::DATAREQUEST_STATUS_PENDING,
@@ -138,7 +138,7 @@ class data_request_test extends data_privacy_testcase {
*
* @return array
*/
public function non_resettable_provider() : array {
public function non_resettable_provider(): array {
$states = [];
foreach ($this->status_state_provider() as $thisstatus) {
if (!$thisstatus['resettable']) {
@@ -221,7 +221,7 @@ class data_request_test extends data_privacy_testcase {
* @param int $status
* @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) [
'userid' => $userid,
'type' => $type,
@@ -33,7 +33,7 @@ class expired_contexts_test extends \advanced_testcase {
* @param string $course Retention policy for courses.
* @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();
$purposes = (object) [
@@ -59,7 +59,7 @@ class expired_contexts_test extends \advanced_testcase {
* @param int $contextlevel
* @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) [
'name' => 'Test purpose ' . rand(1, 1000),
'retentionperiod' => $retention,
@@ -1918,7 +1918,7 @@ class expired_contexts_test extends \advanced_testcase {
*
* @return array
*/
public function can_process_deletion_provider() : array {
public function can_process_deletion_provider(): array {
return [
'Pending' => [
expired_context::STATUS_EXPIRED,
@@ -1956,7 +1956,7 @@ class expired_contexts_test extends \advanced_testcase {
*
* @return array
*/
public function is_complete_provider() : array {
public function is_complete_provider(): array {
return [
'Pending' => [
expired_context::STATUS_EXPIRED,
@@ -1991,7 +1991,7 @@ class expired_contexts_test extends \advanced_testcase {
*
* @return array
*/
public function is_fully_expired_provider() : array {
public function is_fully_expired_provider(): array {
return [
'Fully expired' => [
[
@@ -58,7 +58,7 @@ class filtered_userlist_test extends \advanced_testcase {
*
* @return array
*/
public function apply_expired_contexts_filters_provider() : array {
public function apply_expired_contexts_filters_provider(): array {
return [
// Entire list should be preserved.
'No overrides' => [
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+1 -1
View File
@@ -42,7 +42,7 @@ class locale {
* @return bool TRUE if the locale is available on OS.
* @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;
if (empty($langpackcode)) {
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+8 -8
View File
@@ -39,7 +39,7 @@ class helper {
*
* @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);
}
@@ -50,7 +50,7 @@ class helper {
*
* @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,
['action' => manager::ACTION_ENABLE, 'license' => $licenseshortname, 'sesskey' => sesskey()]);
@@ -64,7 +64,7 @@ class helper {
*
* @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,
['action' => manager::ACTION_DISABLE, 'license' => $licenseshortname, 'sesskey' => sesskey()]);
@@ -76,7 +76,7 @@ class helper {
*
* @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->params(['action' => manager::ACTION_CREATE]);
return $url;
@@ -89,7 +89,7 @@ class helper {
*
* @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->params(['action' => manager::ACTION_UPDATE, 'license' => $licenseshortname]);
return $url;
@@ -102,7 +102,7 @@ class helper {
*
* @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,
['action' => manager::ACTION_MOVE_UP, 'license' => $licenseshortname, 'sesskey' => sesskey()]);
@@ -116,7 +116,7 @@ class helper {
*
* @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,
['action' => manager::ACTION_MOVE_DOWN, 'license' => $licenseshortname, 'sesskey' => sesskey()]);
@@ -130,7 +130,7 @@ class helper {
*
* @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);
$epoch = strtotime($date);
@@ -75,7 +75,7 @@ class manager {
* @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.
*/
public function execute(string $action, $license) : void {
public function execute(string $action, $license): void {
admin_externalpage_setup('licensemanager');
@@ -140,7 +140,7 @@ class manager {
*
* @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) {
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 $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 ($direction == self::ACTION_MOVE_UP) {
@@ -208,7 +208,7 @@ class manager {
* @param string $licenseshortname the shortname of the license to create/edit.
* @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;
$renderer = $PAGE->get_renderer('tool_licensemanager');
@@ -233,7 +233,7 @@ class 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;
$renderer = $PAGE->get_renderer('tool_licensemanager');
@@ -44,7 +44,7 @@ class renderer extends plugin_renderer_base {
*
* @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'),
helper::get_create_license_url());
@@ -62,7 +62,7 @@ class renderer extends plugin_renderer_base {
*
* @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'),
helper::get_update_license_url($licenseshortname));
@@ -41,7 +41,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+2 -2
View File
@@ -52,7 +52,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_plugintype_link('logstore', [], 'privacy:metadata:logstore');
return $collection;
}
@@ -63,7 +63,7 @@ class provider implements
* @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : \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();
static::call_subplugins_method_with_args('add_contexts_for_userid', [$contextlist, $userid]);
return $contextlist;
@@ -51,7 +51,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_external_location_link('log', [
'eventname' => 'privacy:metadata:log:eventname',
'userid' => 'privacy:metadata:log:userid',
@@ -51,7 +51,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_database_table('logstore_standard_log', [
'eventname' => 'privacy:metadata:log:eventname',
'userid' => 'privacy:metadata:log:userid',
+1 -1
View File
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -54,7 +54,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_database_table('messageinbound_messagelist', [
'messageid' => 'privacy:metadata:messagelist:messageid',
@@ -75,7 +75,7 @@ class provider implements
* @param int $userid The user to search.
* @return \contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : \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();
// Always add the user context so we're sure we're not dodging user keys, besides it's not costly to do so.
+1 -1
View File
@@ -60,7 +60,7 @@ class helper {
* @param string $phonenumber from the given user input
* @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);
return (preg_match("/^\+[1-9]\d{1,14}$/", $phonenumber)) ? true : false;
}
@@ -39,7 +39,7 @@ use factor_sms\local\aws_helper;
*/
class aws_helper_test extends \advanced_testcase {
public function test_get_proxy_string():void {
public function test_get_proxy_string(): void {
global $CFG;
$this->resetAfterTest();
// Confirm with no config an empty string is returned.
@@ -32,7 +32,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+1 -1
View File
@@ -781,7 +781,7 @@ class api {
*
* @return array Subscription information
*/
public static function get_subscription_information() : ?array {
public static function get_subscription_information(): ?array {
global $CFG;
// Use session cache to prevent multiple requests.
@@ -47,7 +47,7 @@ class provider implements
* @param collection $collection The initialised item collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
// There is a one user preference.
$collection->add_user_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.
* @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
FROM {user_private_key} k
JOIN {user} u ON k.userid = u.id
@@ -52,7 +52,7 @@ class provider implements
* @param collection $collection An object for storing metadata.
* @return collection The metadata.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$toolmonitorrules = [
'description' => 'privacy:metadata:description',
'name' => 'privacy:metadata:name',
@@ -90,7 +90,7 @@ class provider implements
* @param int $userid The user ID.
* @return contextlist The list of context IDs.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
$params = ['useridrules' => $userid, 'useridsubscriptions' => $userid, 'contextuserrule' => CONTEXT_USER,
'contextusersub' => CONTEXT_USER];
$sql = "SELECT DISTINCT ctx.id
+1 -1
View File
@@ -40,7 +40,7 @@ class rule_form extends \moodleform {
* Mform class definition
*
*/
public function definition () {
public function definition() {
global $PAGE;
$mform = $this->_form;
@@ -38,7 +38,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -57,7 +57,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_database_table(
'tool_policy_acceptances',
[
@@ -104,7 +104,7 @@ class provider implements
* @param int $userid The userid.
* @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();
// Policies a user has modified.
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/formslib.php');
class profiling_import_form extends moodleform {
public function definition () {
public function definition() {
global $CFG;
$mform = $this->_form;
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ class adhocqueue extends check {
* Return result
* @return result
*/
public function get_result() : result {
public function get_result(): result {
global $DB, $CFG;
$stats = $DB->get_record_sql('
@@ -52,7 +52,7 @@ class cronrunning extends check {
* Return result
* @return result
*/
public function get_result() : result {
public function get_result(): result {
global $CFG;
// Eventually this should replace cron_overdue_warning and
@@ -52,7 +52,7 @@ class maxfaildelay extends check {
* Return result
* @return result
*/
public function get_result() : result {
public function get_result(): result {
global $CFG;
$status = result::OK;
+1 -1
View File
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -85,7 +85,7 @@ class running_tasks_table extends \table_sql {
* @param \stdClass $row
* @return string
*/
public function col_classname($row) : string {
public function col_classname($row): string {
$output = $row->classname;
if ($row->type == 'scheduled') {
if (class_exists($row->classname)) {
@@ -108,7 +108,7 @@ class running_tasks_table extends \table_sql {
* @return string
* @throws \coding_exception
*/
public function col_type($row) : string {
public function col_type($row): string {
if ($row->type == 'scheduled') {
$output = \html_writer::span(get_string('scheduled', 'tool_task'), 'badge bg-primary text-white');
} else if ($row->type == 'adhoc') {
@@ -126,7 +126,7 @@ class running_tasks_table extends \table_sql {
* @param \stdClass $row
* @return string
*/
public function col_time($row) : string {
public function col_time($row): string {
global $OUTPUT;
$taskmethod = "{$row->type}_task_from_record";
@@ -150,7 +150,7 @@ class running_tasks_table extends \table_sql {
* @param \stdClass $row
* @return string
*/
public function col_timestarted($row) : string {
public function col_timestarted($row): string {
return userdate($row->timestarted);
}
}
+1 -1
View File
@@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die();
*
* @return array of check objects
*/
function tool_task_status_checks() : array {
function tool_task_status_checks(): array {
return [
new \tool_task\check\cronrunning(),
new \tool_task\check\maxfaildelay(),
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+2 -2
View File
@@ -1199,7 +1199,7 @@ class tool_uploadcourse_course {
* @param int $roleid Role ID.
* @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])) {
$coursecontext = \context_course::instance($courseid);
$this->assignableroles[$courseid] = get_assignable_roles($coursecontext, ROLENAME_SHORT);
@@ -1216,7 +1216,7 @@ class tool_uploadcourse_course {
* @param int $roleid Role ID.
* @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])) {
$this->contextlevels[$roleid] = get_role_contextlevels($roleid);
}
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -39,7 +39,7 @@ class tool_uploadcourse_step1_form extends tool_uploadcourse_base_form {
* The standard form definiton.
* @return void
*/
public function definition () {
public function definition() {
$mform = $this->_form;
$mform->addElement('header', 'generalhdr', get_string('general'));
@@ -39,7 +39,7 @@ class tool_uploadcourse_step2_form extends tool_uploadcourse_base_form {
* The standard form definiton.
* @return void.
*/
public function definition () {
public function definition() {
global $CFG;
$mform = $this->_form;
@@ -1739,7 +1739,7 @@ class course_test extends \advanced_testcase {
*
* @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');
}
@@ -1753,7 +1753,7 @@ class course_test extends \advanced_testcase {
* @return \core_customfield\field_controller
*/
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([
'categoryid' => $category->get('id'),
@@ -470,7 +470,7 @@ class helper_test extends \advanced_testcase {
*
* @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');
}
@@ -484,7 +484,7 @@ class helper_test extends \advanced_testcase {
* @return \core_customfield\field_controller
*/
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([
'categoryid' => $category->get('id'),
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die();
require_once $CFG->libdir.'/formslib.php';
class admin_uploadpicture_form extends moodleform {
function definition (){
function definition(){
global $CFG, $USER;
$mform =& $this->_form;
+2 -2
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
*/
class admin_uploaduser_form1 extends moodleform {
function definition () {
function definition() {
$mform = $this->_form;
$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
*/
class admin_uploaduser_form2 extends moodleform {
function definition () {
function definition() {
global $CFG, $USER;
$mform = $this->_form;
+1 -1
View File
@@ -46,7 +46,7 @@ class tour implements \renderable {
*
* @param toursource $tour The tour being output.
*/
public function __construct (toursource $tour) {
public function __construct(toursource $tour) {
$this->tour = $tour;
}
@@ -50,7 +50,7 @@ class provider implements
* @param collection $items The initialised item collection to add items to.
* @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.
$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');
@@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+1 -1
View File
@@ -79,7 +79,7 @@ abstract class calculable {
*
* @return \lang_string
*/
public static abstract function get_name() : \lang_string;
public static abstract function get_name(): \lang_string;
/**
* The class id is the calculable class full qualified class name.
@@ -77,7 +77,7 @@ abstract class base {
*
* @return \lang_string
*/
public static abstract function get_name() : \lang_string;
public static abstract function get_name(): \lang_string;
/**
* Returns the time splitting method id.
+2 -2
View File
@@ -357,7 +357,7 @@ class manager {
*
* @return \core_analytics\local\target\base[]
*/
public static function get_all_targets() : array {
public static function get_all_targets(): array {
if (self::$alltargets !== null) {
return self::$alltargets;
}
@@ -909,7 +909,7 @@ class manager {
* @param array $model Model declaration
* @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));
}
+4 -4
View File
@@ -1597,7 +1597,7 @@ class model {
* @param bool $includeweights Include the model weights if available
* @return string Zip file path
*/
public function export_model(string $zipfilename, bool $includeweights = true) : string {
public function export_model(string $zipfilename, bool $includeweights = true): string {
\core_analytics\manager::check_can_manage_models();
@@ -1614,7 +1614,7 @@ class model {
* @param string $zipfilepath Zip file path
* @return \core_analytics\model
*/
public static function import_model(string $zipfilepath) : \core_analytics\model {
public static function import_model(string $zipfilepath): \core_analytics\model {
\core_analytics\manager::check_can_manage_models();
@@ -1627,7 +1627,7 @@ class model {
*
* @return bool
*/
public function can_export_configuration() : bool {
public function can_export_configuration(): bool {
if (empty($this->model->timesplitting)) {
return false;
@@ -1680,7 +1680,7 @@ class model {
*
* @return bool
*/
public function trained_locally() : bool {
public function trained_locally(): bool {
global $DB;
if (!$this->is_trained() || $this->is_static()) {
+6 -6
View File
@@ -61,7 +61,7 @@ class model_config {
* @param bool $includeweights Include the model weights if available
* @return string
*/
public function export(string $zipfilename, bool $includeweights = true) : string {
public function export(string $zipfilename, bool $includeweights = true): string {
if (!$this->model) {
throw new \coding_exception('No model object provided.');
@@ -111,7 +111,7 @@ class model_config {
* @param string $zipfilepath Path to the zip file to import
* @return \core_analytics\model
*/
public function import(string $zipfilepath) : \core_analytics\model {
public function import(string $zipfilepath): \core_analytics\model {
list($modeldata, $mlbackenddir) = $this->extract_import_contents($zipfilepath);
@@ -144,7 +144,7 @@ class model_config {
* @param bool $ignoreversionmismatches
* @return string|null Error string or null if all good.
*/
public function check_dependencies(\stdClass $modeldata, bool $ignoreversionmismatches) : ?string {
public function check_dependencies(\stdClass $modeldata, bool $ignoreversionmismatches): ?string {
$siteversions = \core_component::get_all_versions();
@@ -228,7 +228,7 @@ class model_config {
* @param string $fullclassname Qualified name including the namespace.
* @return string|null Frankenstyle component
*/
public static function get_class_component(string $fullclassname) : ?string {
public static function get_class_component(string $fullclassname): ?string {
// Strip out leading backslash.
$fullclassname = ltrim($fullclassname, '\\');
@@ -254,7 +254,7 @@ class model_config {
* @param string $zipfilepath Zip file path
* @return array [0] => \stdClass, [1] => string
*/
public function extract_import_contents(string $zipfilepath) : array {
public function extract_import_contents(string $zipfilepath): array {
$importtempdir = make_request_directory();
@@ -287,7 +287,7 @@ class model_config {
* Exports the configuration of the model.
* @return \stdClass
*/
protected function export_model_data() : \stdClass {
protected function export_model_data(): \stdClass {
$versions = \core_component::get_all_versions();
+2 -2
View File
@@ -43,7 +43,7 @@ interface packable {
* @param string $modeldir The directory that contains the trained model.
* @return string The path to the directory that contains the exported model.
*/
public function export(string $uniqueid, string $modeldir) : string;
public function export(string $uniqueid, string $modeldir): string;
/**
* Imports the provided machine learning model.
@@ -53,5 +53,5 @@ interface packable {
* @param string $importdir The directory that contains the files to import.
* @return bool Success
*/
public function import(string $uniqueid, string $modeldir, string $importdir) : bool;
public function import(string $uniqueid, string $modeldir, string $importdir): bool;
}
+2 -2
View File
@@ -52,7 +52,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_database_table(
'analytics_indicator_calc',
[
@@ -125,7 +125,7 @@ class provider implements
* @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
global $DB;
$contextlist = new \core_privacy\local\request\contextlist();
+4 -4
View File
@@ -39,7 +39,7 @@ class stats {
*
* @return int
*/
public static function enabled_models() : int {
public static function enabled_models(): int {
return count(manager::get_all_models(true));
}
@@ -48,7 +48,7 @@ class stats {
*
* @return int
*/
public static function predictions() : int {
public static function predictions(): int {
global $DB;
return $DB->count_records('analytics_predictions');
@@ -59,7 +59,7 @@ class stats {
*
* @return int
*/
public static function actions() : int {
public static function actions(): int {
global $DB;
return $DB->count_records('analytics_prediction_actions');
@@ -70,7 +70,7 @@ class stats {
*
* @return int
*/
public static function actions_not_useful() : int {
public static function actions_not_useful(): int {
global $DB;
// Simple version using core's TYPE_NEGATIVE actions.
+1 -1
View File
@@ -40,7 +40,7 @@ class test_indicator_discrete extends \core_analytics\local\indicator\discrete {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
// Using a string that exists and contains a corresponding '_help' string.
return new \lang_string('allowstealthmodules');
}
+1 -1
View File
@@ -42,7 +42,7 @@ class test_indicator_fullname extends \core_analytics\local\indicator\linear {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
// Using a string that exists and contains a corresponding '_help' string.
return new \lang_string('allowstealthmodules');
}
+1 -1
View File
@@ -42,7 +42,7 @@ class test_indicator_max extends \core_analytics\local\indicator\binary {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
// Using a string that exists and contains a corresponding '_help' string.
return new \lang_string('allowstealthmodules');
}

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