Skip to content

Commit 6cb15da

Browse files
malteschmitzdaniil-berg
authored andcommitted
chore: move type annotation for global variables
The type annotation comment for global variables must be placed directly before the first usage of that variable. Unfortunately global $ADMIN does not count as usage.
1 parent ed45706 commit 6cb15da

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

classes/plugininfo/monitoringexporter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function get_settings_section_name(): string {
7070
#[\Override]
7171
public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig): void {
7272
global $ADMIN;
73-
/** @var admin_root $ADMIN */
73+
7474
if (!$this->is_installed_and_upgraded()) {
7575
return;
7676
}
@@ -86,6 +86,7 @@ public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $h
8686
include($this->full_path('settings.php'));
8787
if ($settings->settings != new stdClass()) {
8888
// Only if settings were actually added to the page, do we want to add it to the tree.
89+
/** @var admin_root $ADMIN */
8990
$ADMIN->add($parentnodename, $settings);
9091
}
9192
}

settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
defined('MOODLE_INTERNAL') || die;
3838

3939
global $ADMIN;
40-
/** @var admin_root $ADMIN */
4140

4241
// Create a top-level plugin category and add it under the admin tools super-category.
4342
$monitoringcategory = new admin_category(
4443
name: 'tool_monitoring',
4544
visiblename: new lang_string('pluginname', 'tool_monitoring'),
4645
);
46+
/** @var admin_root $ADMIN */
4747
$ADMIN->add('tools', $monitoringcategory);
4848

4949
// Create a link to the metrics overview page and add it as the first item in the monitoring category.

0 commit comments

Comments
 (0)