From 94630c46fdff957ec4ce376df2f2ea5e1d397dbe Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 3 Nov 2021 16:48:54 +0100 Subject: [PATCH] Enforce int as type for params when creating instances of `CheckAttempt` --- library/Icingadb/Widget/Detail/CheckStatistics.php | 2 +- library/Icingadb/Widget/ItemList/BaseHistoryListItem.php | 4 ++-- library/Icingadb/Widget/ItemList/StateListItem.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/Icingadb/Widget/Detail/CheckStatistics.php b/library/Icingadb/Widget/Detail/CheckStatistics.php index b92a8c70..63dc85bf 100644 --- a/library/Icingadb/Widget/Detail/CheckStatistics.php +++ b/library/Icingadb/Widget/Detail/CheckStatistics.php @@ -176,7 +176,7 @@ class CheckStatistics extends Card new VerticalKeyValue(t('Command'), $this->object->checkcommand), new VerticalKeyValue( t('Attempts'), - new CheckAttempt($this->object->state->attempt, $this->object->max_check_attempts) + new CheckAttempt((int) $this->object->state->attempt, (int) $this->object->max_check_attempts) ), new VerticalKeyValue(t('Check Source'), $checkSource), new VerticalKeyValue( diff --git a/library/Icingadb/Widget/ItemList/BaseHistoryListItem.php b/library/Icingadb/Widget/ItemList/BaseHistoryListItem.php index e6d96b2c..d749a94b 100644 --- a/library/Icingadb/Widget/ItemList/BaseHistoryListItem.php +++ b/library/Icingadb/Widget/ItemList/BaseHistoryListItem.php @@ -200,8 +200,8 @@ abstract class BaseHistoryListItem extends BaseListItem $isSoftState = true; $visual->addHtml(new CheckAttempt( - $this->item->state->attempt, - $this->item->state->max_check_attempts + (int) $this->item->state->attempt, + (int) $this->item->state->max_check_attempts )); } else { $previousState = 'previous_hard_state'; diff --git a/library/Icingadb/Widget/ItemList/StateListItem.php b/library/Icingadb/Widget/ItemList/StateListItem.php index b4fc0927..01a13c78 100644 --- a/library/Icingadb/Widget/ItemList/StateListItem.php +++ b/library/Icingadb/Widget/ItemList/StateListItem.php @@ -120,7 +120,7 @@ abstract class StateListItem extends BaseListItem $visual->add($stateBall); if ($this->state->state_type === 'soft') { - $visual->add(new CheckAttempt($this->state->attempt, $this->item->max_check_attempts)); + $visual->add(new CheckAttempt((int) $this->state->attempt, (int) $this->item->max_check_attempts)); } }