Skip to content

Commit 525df10

Browse files
committed
cleanup php 8 warnings
Signed-off-by: Travis Glenn Hansen <[email protected]>
1 parent 25c79c6 commit 525df10

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v0.5.5
2+
3+
Released 2021-08-01
4+
5+
- handle more stringent type checks by php 8
6+
17
# v0.5.4
28

39
Released 2021-08-01

src/KubernetesPfSenseController/Plugin/DNSHAProxyIngressProxy.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,9 @@ public function doAction()
142142
$ingressProxyPluginStore = [];
143143
}
144144

145-
$managedFrontends = $ingressProxyPluginStore['managed_frontends'];
146-
if (empty($managedFrontends)) {
147-
$managedFrontends = [];
148-
}
149-
145+
$managedFrontends = $ingressProxyPluginStore['managed_frontends'] ?? [];
150146
$managedHostsPreSave = [];
151-
$managedHosts = $store['managed_hosts'];
152-
if (empty($managedHosts)) {
153-
$managedHosts = [];
154-
}
147+
$managedHosts = $store['managed_hosts'] ?? [];
155148

156149
foreach ($managedFrontends as $frontendName => $frontendDetails) {
157150
$primaryFrontendName = $haProxyConfig->getFrontend($frontendName)['primary_frontend'];

src/KubernetesPfSenseController/Plugin/DNSResourceTrait.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ public function doAction()
5656
$store = [];
5757
}
5858

59-
$managedHosts = $store['managed_hosts'];
60-
if (empty($managedHosts)) {
61-
$managedHosts = [];
62-
}
59+
$managedHosts = $store['managed_hosts'] ?? [];
6360

6461
// actually remove them from config
6562
$toDeleteHosts = array_diff(@array_keys($managedHosts), @array_keys($managedHostsPreSave));
@@ -72,7 +69,7 @@ public function doAction()
7269

7370
if ($dnsmasqEnabled) {
7471
$dnsmasqConfig = PfSenseConfigBlock::getRootConfigBlock($this->getController()->getRegistryItem('pfSenseClient'), 'dnsmasq');
75-
if (!is_array($dnsmasqConfig->data['hosts'])) {
72+
if (!isset($dnsmasqConfig->data['hosts']) || !is_array($dnsmasqConfig->data['hosts'])) {
7673
$dnsmasqConfig->data['hosts'] = [];
7774
}
7875
foreach ($hosts as $host) {
@@ -90,7 +87,7 @@ public function doAction()
9087

9188
if ($unboundEnabled) {
9289
$unboundConfig = PfSenseConfigBlock::getRootConfigBlock($this->getController()->getRegistryItem('pfSenseClient'), 'unbound');
93-
if (!is_array($unboundConfig->data['hosts'])) {
90+
if (!isset($unboundConfig->data['hosts']) || !is_array($unboundConfig->data['hosts'])) {
9491
$unboundConfig->data['hosts'] = [];
9592
}
9693
foreach ($hosts as $host) {

0 commit comments

Comments
 (0)