From 415ea241e89f5b26f83218bdf4265da9424b5575 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Thu, 21 Nov 2024 13:03:20 +0100 Subject: [PATCH] (Host|Service)Controller: Add return type to methods --- application/controllers/HostController.php | 16 ++++++++-------- application/controllers/ServiceController.php | 17 +++++++++-------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/application/controllers/HostController.php b/application/controllers/HostController.php index a9718b6fc..37fb307c9 100644 --- a/application/controllers/HostController.php +++ b/application/controllers/HostController.php @@ -47,7 +47,7 @@ class HostController extends Controller /** @var Host The host object */ protected $host; - public function init() + public function init(): void { $name = $this->params->shiftRequired('name'); @@ -76,7 +76,7 @@ public function init() $this->setTitle($host->display_name); } - public function indexAction() + public function indexAction(): void { $serviceSummary = ServicestateSummary::on($this->getDb()); $serviceSummary->filter(Filter::equal('service.host_id', $this->host->id)); @@ -95,7 +95,7 @@ public function indexAction() $this->setAutorefreshInterval(10); } - public function sourceAction() + public function sourceAction(): void { $this->assertPermission('icingadb/object/show-source'); @@ -114,7 +114,7 @@ public function sourceAction() )); } - public function historyAction() + public function historyAction(): \Generator { $compact = $this->view->compact; // TODO: Find a less-legacy way.. @@ -185,7 +185,7 @@ public function historyAction() } } - public function servicesAction() + public function servicesAction(): \Generator { if ($this->host->state->is_overdue) { $this->controls->addAttributes(['class' => 'overdue']); @@ -234,7 +234,7 @@ public function servicesAction() $this->setAutorefreshInterval(10); } - public function parentsAction() + public function parentsAction(): void { $nodesQuery = $this->fetchNodes(true); @@ -293,7 +293,7 @@ public function parentsAction() $this->setAutorefreshInterval(10); } - public function childrenAction() + public function childrenAction(): void { $nodesQuery = $this->fetchNodes(); @@ -473,7 +473,7 @@ protected function createTabs(): Tabs return $tabs; } - protected function setTitleTab(string $name) + protected function setTitleTab(string $name): void { $tab = $this->createTabs()->get($name); diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 92c2c8f68..e3f0384ff 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -31,6 +31,7 @@ use ipl\Web\Control\LimitControl; use ipl\Web\Control\SortControl; use ipl\Web\Url; +use ipl\Web\Widget\Tabs; class ServiceController extends Controller { @@ -40,7 +41,7 @@ class ServiceController extends Controller /** @var Service The service object */ protected $service; - public function init() + public function init(): void { $name = $this->params->shiftRequired('name'); $hostName = $this->params->shiftRequired('host.name'); @@ -85,7 +86,7 @@ public function init() ); } - public function indexAction() + public function indexAction(): void { if ($this->service->state->is_overdue) { $this->controls->addAttributes(['class' => 'overdue']); @@ -99,7 +100,7 @@ public function indexAction() $this->setAutorefreshInterval(10); } - public function parentsAction() + public function parentsAction(): void { $nodesQuery = $this->fetchNodes(true); @@ -159,7 +160,7 @@ public function parentsAction() $this->setAutorefreshInterval(10); } - public function childrenAction() + public function childrenAction(): void { $nodesQuery = $this->fetchNodes(); @@ -222,7 +223,7 @@ public function childrenAction() $this->setAutorefreshInterval(10); } - public function sourceAction() + public function sourceAction(): void { $this->assertPermission('icingadb/object/show-source'); @@ -241,7 +242,7 @@ public function sourceAction() )); } - public function historyAction() + public function historyAction(): \Generator { $compact = $this->view->compact; // TODO: Find a less-legacy way.. @@ -392,7 +393,7 @@ protected function fetchNodes(bool $fetchParents = false): Query return $query; } - protected function createTabs() + protected function createTabs(): Tabs { $hasDependecyNode = DependencyNode::on($this->getDb()) ->columns('1') @@ -445,7 +446,7 @@ protected function createTabs() return $tabs; } - protected function setTitleTab(string $name) + protected function setTitleTab(string $name): void { $tab = $this->createTabs()->get($name);