From f532f9ae6d5211b2ba3d4b9c0267a1160a0e6b9b Mon Sep 17 00:00:00 2001 From: Dmitrii Metelkin Date: Mon, 25 Mar 2024 15:44:19 +1100 Subject: [PATCH] Fix some coding style issues --- classes/local/tool_dynamic_cohorts/condition/fields_trait.php | 4 ++-- classes/privacy/provider.php | 4 ++-- classes/rule.php | 2 +- .../tool_dynamic_cohorts/condition/cohort_field_test.php | 2 +- .../condition/user_custom_profile_test.php | 2 +- .../tool_dynamic_cohorts/condition/user_profile_test.php | 2 +- tests/rule_manager_test.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/classes/local/tool_dynamic_cohorts/condition/fields_trait.php b/classes/local/tool_dynamic_cohorts/condition/fields_trait.php index 602b0b5..af941fb 100644 --- a/classes/local/tool_dynamic_cohorts/condition/fields_trait.php +++ b/classes/local/tool_dynamic_cohorts/condition/fields_trait.php @@ -32,7 +32,7 @@ trait fields_trait { * * @return array A list of operators. */ - protected function get_text_operators() : array { + protected function get_text_operators(): array { return [ self::TEXT_CONTAINS => get_string('contains', 'filters'), self::TEXT_DOES_NOT_CONTAIN => get_string('doesnotcontain', 'filters'), @@ -50,7 +50,7 @@ protected function get_text_operators() : array { * * @return array A list of operators. */ - protected function get_menu_operators() : array { + protected function get_menu_operators(): array { return [ self::TEXT_IS_EQUAL_TO => get_string('isequalto', 'filters'), self::TEXT_IS_NOT_EQUAL_TO => get_string('isnotequalto', 'filters'), diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index e6f3560..3ecdf28 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -41,7 +41,7 @@ class provider implements \core_privacy\local\metadata\provider, * @param collection $collection a reference to the collection to use to store the metadata. * @return collection the updated collection of metadata items. */ - public static function get_metadata(collection $collection) : collection { + public static function get_metadata(collection $collection): collection { $collection->add_database_table( 'tool_dynamic_cohorts', [ @@ -71,7 +71,7 @@ public static function get_metadata(collection $collection) : collection { * @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 { global $DB; $contextlist = new contextlist(); diff --git a/classes/rule.php b/classes/rule.php index b0862a2..31ed4ea 100644 --- a/classes/rule.php +++ b/classes/rule.php @@ -98,7 +98,7 @@ public function get_condition_records(): array { * * @return bool */ - public function is_enabled() : bool { + public function is_enabled(): bool { return (bool) $this->get('enabled'); } diff --git a/tests/local/tool_dynamic_cohorts/condition/cohort_field_test.php b/tests/local/tool_dynamic_cohorts/condition/cohort_field_test.php index 931e315..e293e5d 100644 --- a/tests/local/tool_dynamic_cohorts/condition/cohort_field_test.php +++ b/tests/local/tool_dynamic_cohorts/condition/cohort_field_test.php @@ -89,7 +89,7 @@ public function test_set_and_get_configdata() { * * @return array[] */ - public function config_description_data_provider(): array { + public static function config_description_data_provider(): array { return [ [condition_base::TEXT_CONTAINS, 'A user is not member of cohorts with field \'Theme\' contains 123'], [condition_base::TEXT_DOES_NOT_CONTAIN, 'A user is not member of cohorts with field \'Theme\' doesn\'t contain 123'], diff --git a/tests/local/tool_dynamic_cohorts/condition/user_custom_profile_test.php b/tests/local/tool_dynamic_cohorts/condition/user_custom_profile_test.php index f30bc60..c9c4c3e 100644 --- a/tests/local/tool_dynamic_cohorts/condition/user_custom_profile_test.php +++ b/tests/local/tool_dynamic_cohorts/condition/user_custom_profile_test.php @@ -148,7 +148,7 @@ public function test_set_and_get_configdata() { * * @return array[] */ - public function config_description_data_provider(): array { + public static function config_description_data_provider(): array { return [ [condition_base::TEXT_CONTAINS, 'Test field1 contains 123', true], [condition_base::TEXT_DOES_NOT_CONTAIN, 'Test field1 doesn\'t contain 123', true], diff --git a/tests/local/tool_dynamic_cohorts/condition/user_profile_test.php b/tests/local/tool_dynamic_cohorts/condition/user_profile_test.php index 5f07a8e..9d70ee9 100644 --- a/tests/local/tool_dynamic_cohorts/condition/user_profile_test.php +++ b/tests/local/tool_dynamic_cohorts/condition/user_profile_test.php @@ -88,7 +88,7 @@ public function test_set_and_get_configdata() { * * @return array[] */ - public function config_description_data_provider(): array { + public static function config_description_data_provider(): array { return [ [condition_base::TEXT_CONTAINS, 'First name contains 123'], [condition_base::TEXT_DOES_NOT_CONTAIN, 'First name doesn\'t contain 123'], diff --git a/tests/rule_manager_test.php b/tests/rule_manager_test.php index c32dc79..e837484 100644 --- a/tests/rule_manager_test.php +++ b/tests/rule_manager_test.php @@ -136,7 +136,7 @@ public function test_build_rule_data_for_form() { * * @return array */ - public function process_rule_form_with_invalid_data_provider(): array { + public static function process_rule_form_with_invalid_data_provider(): array { return [ [[]], [['name' => 'Test']],