From f3b0819855551c1c2673c447e56fc7ece2d5b68f Mon Sep 17 00:00:00 2001 From: Alexander Bias Date: Sun, 18 Aug 2024 10:10:32 +0200 Subject: [PATCH] Make codechecker happy again --- classes/privacy/provider.php | 4 ++-- lib.php | 2 +- tests/block_cohortspecifichtml_test.php | 5 +++-- tests/privacy/privacy_test.php | 16 ++++++++-------- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index d0cc3dc..cc4ea87 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -51,7 +51,7 @@ class provider implements \core_privacy\local\metadata\provider, * @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->link_subsystem('block', 'privacy:metadata:block'); return $collection; @@ -63,7 +63,7 @@ public static function get_metadata(collection $collection) : collection { * @param int $userid The user to search. * @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin. */ - public static function get_contexts_for_userid(int $userid) : \core_privacy\local\request\contextlist { + public static function get_contexts_for_userid(int $userid): \core_privacy\local\request\contextlist { // This block doesn't know who information is stored against unless it // is at the user context. $contextlist = new \core_privacy\local\request\contextlist(); diff --git a/lib.php b/lib.php index d0e6e30..a948468 100644 --- a/lib.php +++ b/lib.php @@ -134,7 +134,7 @@ function block_cohortspecifichtml_global_db_replace($search, $replace) { * @param array $args The path (the part after the filearea and before the filename). * @return array The itemid and the filepath inside the $args path, for the defined filearea. */ -function block_cohortspecifichtml_get_path_from_pluginfile(string $filearea, array $args) : array { +function block_cohortspecifichtml_get_path_from_pluginfile(string $filearea, array $args): array { // This block never has an itemid (the number represents the revision but it's not stored in database). array_shift($args); diff --git a/tests/block_cohortspecifichtml_test.php b/tests/block_cohortspecifichtml_test.php index baa0076..ca39209 100644 --- a/tests/block_cohortspecifichtml_test.php +++ b/tests/block_cohortspecifichtml_test.php @@ -22,15 +22,16 @@ * @package block_cohortspecifichtml * @copyright 2023 Alexander Bias * based on code from 2022 Open LMS (https://www.openlms.net/) Petr Skoda + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * * @coversDefaultClass \block_cohortspecifichtml */ -class block_cohortspecifichtml_test extends \advanced_testcase { +final class block_cohortspecifichtml_test extends \advanced_testcase { /** * Tests instance files copying. * @covers ::instance_copy */ - public function test_instance_copy() { + public function test_instance_copy(): void { global $USER; $this->resetAfterTest(); diff --git a/tests/privacy/privacy_test.php b/tests/privacy/privacy_test.php index fe3d4b9..8a2050c 100644 --- a/tests/privacy/privacy_test.php +++ b/tests/privacy/privacy_test.php @@ -36,7 +36,7 @@ * based on code from 2018 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class privacy_test extends \core_privacy\tests\provider_testcase { +final class privacy_test extends \core_privacy\tests\provider_testcase { /** * Get the list of standard format options for comparison. * @@ -166,7 +166,7 @@ protected function construct_course_page(\stdClass $course) { * It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing. * @coversNothing */ - public function test_user_block() { + public function test_user_block(): void { $this->resetAfterTest(); $title = 'Example title'; @@ -213,7 +213,7 @@ public function test_user_block() { * It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing. * @coversNothing */ - public function test_user_block_unconfigured() { + public function test_user_block_unconfigured(): void { global $DB; $this->resetAfterTest(); @@ -253,7 +253,7 @@ public function test_user_block_unconfigured() { * It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing. * @coversNothing */ - public function test_user_multiple_blocks_exported() { + public function test_user_multiple_blocks_exported(): void { $this->resetAfterTest(); $title = 'Example title'; @@ -301,7 +301,7 @@ public function test_user_multiple_blocks_exported() { * It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing. * @coversNothing */ - public function test_course_blocks_not_exported() { + public function test_course_blocks_not_exported(): void { $this->resetAfterTest(); $title = 'Example title'; @@ -330,7 +330,7 @@ public function test_course_blocks_not_exported() { * It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing. * @coversNothing */ - public function test_mixed_multiple_blocks_exported() { + public function test_mixed_multiple_blocks_exported(): void { $this->resetAfterTest(); $title = 'Example title'; @@ -372,7 +372,7 @@ public function test_mixed_multiple_blocks_exported() { * It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing. * @coversNothing */ - public function test_get_users_in_context() { + public function test_get_users_in_context(): void { $this->resetAfterTest(); $component = 'block_cohortspecifichtml'; @@ -419,7 +419,7 @@ public function test_get_users_in_context() { * It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing. * @coversNothing */ - public function test_delete_data_for_users() { + public function test_delete_data_for_users(): void { $this->resetAfterTest(); $component = 'block_cohortspecifichtml';