Skip to content

Commit

Permalink
Make codechecker happy again
Browse files Browse the repository at this point in the history
  • Loading branch information
abias committed Aug 18, 2024
1 parent 0296116 commit d649e75
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,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 changes: 4 additions & 4 deletions classes/profilecohort.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private function output_members_entry($cohortname, $cohortmembers, $lastcohortid
* @param \core\event\base|null $event (optional)
* @param int $userid (optional) mostly used by testing
*/
public static function set_cohorts_from_profile(\core\event\base $event = null, $userid = null) {
public static function set_cohorts_from_profile(?\core\event\base $event = null, $userid = null) {
global $USER, $DB, $CFG;
require_once($CFG->dirroot.'/cohort/lib.php');

Expand Down Expand Up @@ -239,7 +239,7 @@ public static function set_cohorts_from_profile(\core\event\base $event = null,
* @param \core\event\base|null $event (optional)
* @param int $userid (optional) mostly used by testing; overrides possible value from event
*/
public static function set_cohorts_from_profile_loginas(\core\event\base $event = null, $userid = null) {
public static function set_cohorts_from_profile_loginas(?\core\event\base $event = null, $userid = null) {
global $USER;

if ($event && $event->relateduserid && !$userid) {
Expand All @@ -258,7 +258,7 @@ public static function set_cohorts_from_profile_loginas(\core\event\base $event
* @param \core\event\base|null $event (optional)
* @param int $userid (optional) mostly used by testing; overrides possible value from event
*/
public static function set_cohorts_from_profile_created(\core\event\base $event = null, $userid = null) {
public static function set_cohorts_from_profile_created(?\core\event\base $event = null, $userid = null) {
if ($event && $event->objectid && !$userid) {
// We have received an event, and caller has not asked for specific user id.
$userid = $event->objectid;
Expand All @@ -272,7 +272,7 @@ public static function set_cohorts_from_profile_created(\core\event\base $event
* @param \core\event\base|null $event (optional)
* @param int $userid (optional) mostly used by testing; overrides possible value from event
*/
public static function set_cohorts_from_profile_updated(\core\event\base $event = null, $userid = null) {
public static function set_cohorts_from_profile_updated(?\core\event\base $event = null, $userid = null) {
if ($event && $event->objectid && !$userid) {
// We have received an event, and caller has not asked for specific user id.
$userid = $event->objectid;
Expand Down
6 changes: 3 additions & 3 deletions lang/en/local_profilecohort.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
$string['addrule'] = 'Add rule for custom user profile field ...';
$string['addrules'] = 'Add new rule';
$string['andnextrule'] = 'The next rule must also match, to join this cohort.';
$string['countusers'] = '{$a} users';
$string['countnousers'] = 'No users';
$string['delete'] = 'Delete this rule';
$string['cohortsintro'] = 'On this tab, you select the cohorts you want this plugin to manage.<br>
Once selected, you will not be able to manually update the members of these cohorts anymore. Furthermore, any users who are currently a member of these cohorts will be removed from the cohorts and the cohorts are then filled from scratch with the users matching the rule(s) you create with this plugin.<br>
If you decide to stop managing a cohort with this plugin and deselect it here, all users who are currently a member of this cohort will keep being a member. Additionally, you will be able to manually update the members of this cohort again.';
$string['countnousers'] = 'No users';
$string['countusers'] = '{$a} users';
$string['delete'] = 'Delete this rule';
$string['iffield'] = 'If {$a}';
$string['invisiblecohortsnote'] = 'Please note: This plugin handles invisible cohorts completely equal to visible cohorts. Thus, the list of cohorts also includes cohorts which have been created as invisible.';
$string['match_contains'] = 'Contains';
Expand Down
24 changes: 12 additions & 12 deletions tests/rules_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @copyright 2016 Davo Smith, Synergy Learning UK on behalf of Alexander Bias, Ulm University <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class rules_test extends \advanced_testcase {
final class rules_test extends \advanced_testcase {

/** @var int[] mapping user profile field shortname => field id */
protected $fieldids = [];
Expand Down Expand Up @@ -82,7 +82,7 @@ public function setUp(): void {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_create_rules() {
public function test_create_rules(): void {
// Create a 'checkbox' rule.
$ruledata = (object) [
'fieldid' => $this->fieldids['checkboxfield'], 'datatype' => 'checkbox',
Expand Down Expand Up @@ -159,7 +159,7 @@ public function test_create_rules() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_update_rule() {
public function test_update_rule(): void {
// Create a 'text' rule.
$ruledata = (object) [
'fieldid' => $this->fieldids['textfield'], 'datatype' => 'text',
Expand Down Expand Up @@ -204,7 +204,7 @@ public function test_update_rule() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_delete_rule() {
public function test_delete_rule(): void {
// Create a 'text' rule.
$ruledata = (object) [
'fieldid' => $this->fieldids['textfield'], 'datatype' => 'text',
Expand Down Expand Up @@ -242,7 +242,7 @@ public function test_delete_rule() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_update_from_form_data() {
public function test_update_from_form_data(): void {
// Create a 'text' rule + reload.
$ruledata = (object) [
'fieldid' => $this->fieldids['textfield'], 'datatype' => 'text',
Expand Down Expand Up @@ -336,7 +336,7 @@ public function test_update_from_form_data() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_match_checkbox() {
public function test_match_checkbox(): void {
global $DB;
// Set up 3 users:
// user1 has profile field unchecked.
Expand Down Expand Up @@ -380,7 +380,7 @@ public function test_match_checkbox() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_match_menu() {
public function test_match_menu(): void {
global $DB;
// Set up 3 users:
// user1 has profile field 'Opt 1'.
Expand Down Expand Up @@ -424,7 +424,7 @@ public function test_match_menu() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_match_text() {
public function test_match_text(): void {
global $DB;
// Set up 3 users:
// user1 has profile field 'Testing ABC'.
Expand Down Expand Up @@ -510,7 +510,7 @@ public function test_match_text() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_update_all_cohort_memberships() {
public function test_update_all_cohort_memberships(): void {
global $DB, $CFG;
require_once($CFG->dirroot.'/cohort/lib.php');

Expand Down Expand Up @@ -572,7 +572,7 @@ public function test_update_all_cohort_memberships() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_update_cohort_membership() {
public function test_update_cohort_membership(): void {
global $DB, $CFG;
require_once($CFG->dirroot.'/cohort/lib.php');

Expand Down Expand Up @@ -632,7 +632,7 @@ public function test_update_cohort_membership() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_and_rules() {
public function test_and_rules(): void {
global $DB;

// Set up a user with 'menufield' set to 'Opt 1', 'checkboxfield' set to 'No', 'textfield' set to 'Fred'.
Expand Down Expand Up @@ -736,7 +736,7 @@ public function test_and_rules() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_and_rules_ending_in_and() {
public function test_and_rules_ending_in_and(): void {
global $DB;

// Set up a user with 'menufield' set to 'Opt 1', 'checkboxfield' set to 'No'.
Expand Down

0 comments on commit d649e75

Please sign in to comment.