Skip to content

Commit cad37ba

Browse files
authored
return back php 7.4 (#215)
* return back php 7.4 * fixer
1 parent 8c03d47 commit cad37ba

3 files changed

Lines changed: 32 additions & 32 deletions

File tree

monitor_controller.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ function monitorGetZoomDropdownState(bool &$dozoombgndcolor): array {
431431
*
432432
* @return void
433433
*/
434-
function monitorRenderPrimaryFilterRow(array $dashboards, array $monitor_status, array $monitor_view_type, array $monitor_grouping, array $item_rows, int|null $mon_zoom_status): void {
434+
function monitorRenderPrimaryFilterRow(array $dashboards, array $monitor_status, array $monitor_view_type, array $monitor_grouping, array $item_rows, mixed $mon_zoom_status): void {
435435
drawFilterDropdown('dashboard', __('Layout', 'monitor'), $dashboards);
436436
drawFilterDropdown('status', __('Status', 'monitor'), $monitor_status, $mon_zoom_status);
437437
drawFilterDropdown('view', __('View', 'monitor'), $monitor_view_type);
@@ -465,7 +465,7 @@ function monitorRenderPrimaryFilterRow(array $dashboards, array $monitor_status,
465465
*
466466
* @return void
467467
*/
468-
function monitorRenderGroupingDropdowns(array $classes, array $criticalities, array $monitor_trim, array $page_refresh_interval, string|null $mon_zoom_size): void {
468+
function monitorRenderGroupingDropdowns(array $classes, array $criticalities, array $monitor_trim, array $page_refresh_interval, mixed $mon_zoom_size): void {
469469
drawFilterDropdown('crit', __('Criticality', 'monitor'), $criticalities);
470470

471471
if (get_request_var('view') != 'list') {
@@ -971,13 +971,13 @@ function validateRequestVars(bool $force = false): void {
971971
/**
972972
* Load host row and normalize status fields for AJAX tooltip rendering.
973973
*
974-
* @param int $id Host id.
974+
* @param int $id|string Host id.
975975
* @param array $thold_hosts Threshold host map.
976976
* @param array $config Global Cacti config.
977977
*
978978
* @return array
979979
*/
980-
function monitorLoadAjaxStatusHost(int|string $id, array $thold_hosts, array $config): array {
980+
function monitorLoadAjaxStatusHost(mixed $id, array $thold_hosts, array $config): array {
981981
$host = db_fetch_row_prepared(
982982
'SELECT *
983983
FROM host

monitor_render.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function renderDefault(): string {
8989
$maxlen = 10;
9090

9191
if (get_request_var('view') == 'default') {
92-
$maxlen = db_fetch_cell("SELECT MAX(LENGTH(description))
92+
$maxlen = (int) db_fetch_cell("SELECT MAX(LENGTH(description))
9393
FROM host AS h
9494
$sql_join
9595
$sql_where");
@@ -692,11 +692,11 @@ function getHostStatus(array $host, bool $real = false): int {
692692
/**
693693
* Translate status code into localized display label.
694694
*
695-
* @param int $status Monitor status code.
695+
* @param int|string $status Monitor status code.
696696
*
697697
* @return string
698698
*/
699-
function getHostStatusDescription(int|string $status): string {
699+
function getHostStatusDescription(mixed $status): string {
700700
global $icolorsdisplay;
701701

702702
if (array_key_exists($status, $icolorsdisplay)) {
@@ -803,12 +803,12 @@ function getStatusIcon(int $status, string $icon): string {
803803
/**
804804
* Convert uptime/fail timestamp into compact human-readable duration text.
805805
*
806-
* @param string|int $status_time Timestamp string or SNMP uptime ticks.
806+
* @param int|string $status_time Timestamp string or SNMP uptime ticks.
807807
* @param bool $seconds Include seconds in output string.
808808
*
809809
* @return string
810810
*/
811-
function monitorPrintHostTime(int|string $status_time, bool $seconds = false): string {
811+
function monitorPrintHostTime(mixed $status_time, bool $seconds = false): string {
812812
// If the host is down, make a downtime since message
813813
$dt = '';
814814

poller_functions.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
/**
2929
* Add a host id to each recipient entry in the reboot recipient map.
3030
*
31-
* @param array $reboot_emails Recipient map keyed by email, then host id.
32-
* @param array $alert_emails List of raw email addresses.
33-
* @param int $host_id Host id to associate with each recipient.
31+
* @param array $reboot_emails Recipient map keyed by email, then host id.
32+
* @param array $alert_emails List of raw email addresses.
33+
* @param int|string $host_id Host id to associate with each recipient.
3434
*
3535
* @return void
3636
*/
37-
function monitorAddEmails(array &$reboot_emails, array $alert_emails, int|string $host_id): void {
37+
function monitorAddEmails(array &$reboot_emails, array $alert_emails, mixd $host_id): void {
3838
if (cacti_sizeof($alert_emails)) {
3939
foreach ($alert_emails as $email) {
4040
$reboot_emails[trim(strtolower($email))][$host_id] = $host_id;
@@ -45,14 +45,14 @@ function monitorAddEmails(array &$reboot_emails, array $alert_emails, int|string
4545
/**
4646
* Add a host id to recipients coming from a notification list id.
4747
*
48-
* @param array $reboot_emails Recipient map keyed by email, then host id.
49-
* @param int $notify_list Notification list id.
50-
* @param int $host_id Host id to add.
51-
* @param array $notification_lists Map of list id to comma-delimited emails.
48+
* @param array $reboot_emails Recipient map keyed by email, then host id.
49+
* @param int|string|null $notify_list Notification list id.
50+
* @param int|string $host_id Host id to add.
51+
* @param array $notification_lists Map of list id to comma-delimited emails.
5252
*
5353
* @return void
5454
*/
55-
function monitorAddNotificationList(array &$reboot_emails, int|string|null $notify_list, int|string $host_id, array $notification_lists): void {
55+
function monitorAddNotificationList(array &$reboot_emails, mixed $notify_list, mixed $host_id, array $notification_lists): void {
5656
if ($notify_list !== null && $notify_list > 0 && isset($notification_lists[$notify_list])) {
5757
$emails = explode(',', $notification_lists[$notify_list]);
5858
monitorAddEmails($reboot_emails, $emails, $host_id);
@@ -130,14 +130,14 @@ function getNotificationListsMap(): array {
130130
/**
131131
* Add reboot recipients based on host threshold notification settings.
132132
*
133-
* @param array $reboot_emails Recipient map keyed by email, then host id.
134-
* @param int $host_id Host id being processed.
135-
* @param array $alert_emails Global alert email list.
136-
* @param array $notification_lists Map of notification list id to emails.
133+
* @param array $reboot_emails Recipient map keyed by email, then host id.
134+
* @param int|string $host_id Host id being processed.
135+
* @param array $alert_emails Global alert email list.
136+
* @param array $notification_lists Map of notification list id to emails.
137137
*
138138
* @return void
139139
*/
140-
function addTholdRebootRecipients(array &$reboot_emails, int|string $host_id, array $alert_emails, array $notification_lists): void {
140+
function addTholdRebootRecipients(array &$reboot_emails, mixed $host_id, array $alert_emails, array $notification_lists): void {
141141
$notify = db_fetch_row_prepared(
142142
'SELECT thold_send_email, thold_host_email
143143
FROM host
@@ -490,11 +490,11 @@ function normalizeAndLogNotificationHosts(array &$alert_hosts, array &$warn_host
490490
/**
491491
* Build shared intro copy for ping threshold email and text output.
492492
*
493-
* @param int $freq Resend frequency in minutes.
493+
* @param int|string $freq Resend frequency in minutes.
494494
*
495495
* @return array{string, string}
496496
*/
497-
function buildPingNotificationIntro(int|string $freq): array {
497+
function buildPingNotificationIntro(mixed $freq): array {
498498
$body = '<h1>' . __(MONITOR_PING_NOTIFICATION_SUBJECT, 'monitor') . '</h1>' . PHP_EOL;
499499
$body_txt = __(MONITOR_PING_NOTIFICATION_SUBJECT, 'monitor') . PHP_EOL;
500500

@@ -819,15 +819,15 @@ function addGroupedNotificationEntry(string $type, array $entry, array &$global_
819819
/**
820820
* Query and group threshold-breached hosts for one severity type.
821821
*
822-
* @param string $type Severity key (`alert` or `warn`).
823-
* @param int $criticality Minimum criticality threshold.
824-
* @param array $global_list Global grouped bucket, updated in place.
825-
* @param array $notify_list Per-list grouped bucket, updated in place.
826-
* @param array $lists Set of notification list ids, updated in place.
822+
* @param int|string $type Severity key (`alert` or `warn`).
823+
* @param int $criticality Minimum criticality threshold.
824+
* @param array $global_list Global grouped bucket, updated in place.
825+
* @param array $notify_list Per-list grouped bucket, updated in place.
826+
* @param array $lists Set of notification list ids, updated in place.
827827
*
828828
* @return void
829829
*/
830-
function getHostsByListType(string $type, int|string $criticality, array &$global_list, array &$notify_list, array &$lists): void {
830+
function getHostsByListType(string $type, mixed $criticality, array &$global_list, array &$notify_list, array &$lists): void {
831831
$last_time = date(MONITOR_DATE_TIME_FORMAT, time() - read_config_option('monitor_resend_frequency') * 60);
832832

833833
$hosts = db_fetch_cell_prepared(
@@ -954,7 +954,7 @@ function flattenLists(array &$global_list, array &$notify_list): void {
954954
*
955955
* @return void
956956
*/
957-
function addEmailsToNotificationMap(array &$notification_emails, array $emails, string|int $scope_key): void {
957+
function addEmailsToNotificationMap(array &$notification_emails, array $emails, mixed $scope_key): void {
958958
foreach ($emails as $user) {
959959
$user = trim($user);
960960

0 commit comments

Comments
 (0)