diff --git a/application/clicommands/ProcessCommand.php b/application/clicommands/ProcessCommand.php
index 3b470b8..2227ad3 100644
--- a/application/clicommands/ProcessCommand.php
+++ b/application/clicommands/ProcessCommand.php
@@ -132,8 +132,8 @@ class ProcessCommand extends Command
}
}
- /** @var BpNode $node */
try {
+ /** @var BpNode $node */
$node = $bp->getNode($nodeName);
if (Module::exists('icingadb')
&& (! $bp->hasBackendName() && IcingadbSupport::useIcingaDbAsBackend())
diff --git a/application/controllers/HostController.php b/application/controllers/HostController.php
index ac724cf..09352d0 100644
--- a/application/controllers/HostController.php
+++ b/application/controllers/HostController.php
@@ -7,6 +7,7 @@ use Icinga\Module\Businessprocess\IcingaDbObject;
use Icinga\Module\Businessprocess\ProvidedHook\Icingadb\IcingadbSupport;
use Icinga\Module\Icingadb\Model\Host;
use Icinga\Module\Monitoring\Controller;
+use Icinga\Module\Monitoring\DataView\DataView;
use Icinga\Web\Url;
use ipl\Stdlib\Filter;
@@ -54,7 +55,9 @@ class HostController extends Controller
->from('hoststatus', array('host_name'))
->where('host_name', $hostName);
- if ($this->applyRestriction('monitoring/filter/objects', $query)->fetchRow() !== false) {
+ /** @var DataView $restrictedQuery */
+ $restrictedQuery = $this->applyRestriction('monitoring/filter/objects', $query);
+ if ($restrictedQuery->fetchRow() !== false) {
$this->redirectNow(Url::fromPath('monitoring/host/show')->setParams($this->params));
}
}
diff --git a/application/controllers/ProcessController.php b/application/controllers/ProcessController.php
index 44429df..208c91e 100644
--- a/application/controllers/ProcessController.php
+++ b/application/controllers/ProcessController.php
@@ -35,6 +35,7 @@ use ipl\Html\HtmlString;
use ipl\Html\TemplateString;
use ipl\Html\Text;
use ipl\Web\Control\SortControl;
+use ipl\Web\FormElement\TermInput;
use ipl\Web\Widget\Link;
use ipl\Web\Widget\Icon;
@@ -282,7 +283,9 @@ class ProcessController extends Controller
->handleRequest($this->getServerRequest());
if ($form->hasElement('children')) {
- foreach ($form->getElement('children')->prepareMultipartUpdate($this->getServerRequest()) as $update) {
+ /** @var TermInput $childrenElement */
+ $childrenElement = $form->getElement('children');
+ foreach ($childrenElement->prepareMultipartUpdate($this->getServerRequest()) as $update) {
if (! is_array($update)) {
$update = [$update];
}
diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php
index 2c0563d..f10c791 100644
--- a/application/controllers/ServiceController.php
+++ b/application/controllers/ServiceController.php
@@ -7,6 +7,7 @@ use Icinga\Module\Businessprocess\IcingaDbObject;
use Icinga\Module\Businessprocess\ProvidedHook\Icingadb\IcingadbSupport;
use Icinga\Module\Icingadb\Model\Service;
use Icinga\Module\Monitoring\Controller;
+use Icinga\Module\Monitoring\DataView\DataView;
use Icinga\Web\Url;
use ipl\Stdlib\Filter;
@@ -61,7 +62,9 @@ class ServiceController extends Controller
->where('host_name', $hostName)
->where('service_description', $serviceName);
- if ($this->applyRestriction('monitoring/filter/objects', $query)->fetchRow() !== false) {
+ /** @var DataView $restrictedQuery */
+ $restrictedQuery = $this->applyRestriction('monitoring/filter/objects', $query);
+ if ($restrictedQuery->fetchRow() !== false) {
$this->redirectNow(Url::fromPath('monitoring/service/show')->setParams($this->params));
}
}
diff --git a/application/forms/BpUploadForm.php b/application/forms/BpUploadForm.php
index ee3faf3..a746740 100644
--- a/application/forms/BpUploadForm.php
+++ b/application/forms/BpUploadForm.php
@@ -155,7 +155,7 @@ class BpUploadForm extends BpConfigBaseForm
protected function processUploadedSource()
{
- /** @var \Zend_Form_Element_File $el */
+ /** @var ?\Zend_Form_Element_File $el */
$el = $this->getElement('uploaded_file');
if ($el && $this->hasBeenSent()) {
diff --git a/application/forms/DeleteNodeForm.php b/application/forms/DeleteNodeForm.php
index 30fcdd4..ea39817 100644
--- a/application/forms/DeleteNodeForm.php
+++ b/application/forms/DeleteNodeForm.php
@@ -6,6 +6,7 @@ use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\Modification\ProcessChanges;
use Icinga\Module\Businessprocess\Node;
use Icinga\Module\Businessprocess\Web\Form\BpConfigBaseForm;
+use Icinga\Web\View;
class DeleteNodeForm extends BpConfigBaseForm
{
@@ -19,6 +20,8 @@ class DeleteNodeForm extends BpConfigBaseForm
{
$node = $this->node;
$nodeName = $node->getAlias() ?? $node->getName();
+
+ /** @var View $view */
$view = $this->getView();
$this->addHtml(
'
' . $view->escape(
diff --git a/application/forms/MoveNodeForm.php b/application/forms/MoveNodeForm.php
index 876ab90..81d15c7 100644
--- a/application/forms/MoveNodeForm.php
+++ b/application/forms/MoveNodeForm.php
@@ -3,6 +3,7 @@
namespace Icinga\Module\Businessprocess\Forms;
use Icinga\Application\Icinga;
+use Icinga\Application\Web;
use Icinga\Exception\Http\HttpException;
use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\BpNode;
@@ -136,7 +137,9 @@ class MoveNodeForm extends BpConfigBaseForm
);
} catch (ModificationError $e) {
$this->notifyError($e->getMessage());
- Icinga::app()->getResponse()
+ /** @var Web $app */
+ $app = Icinga::app();
+ $app->getResponse()
// Web 2's JS forces a content update for non-200s. Our own JS
// can't prevent this, hence we're not making this a 400 :(
//->setHttpResponseCode(400)
diff --git a/application/forms/ProcessForm.php b/application/forms/ProcessForm.php
index 69ab1a6..126fe9b 100644
--- a/application/forms/ProcessForm.php
+++ b/application/forms/ProcessForm.php
@@ -7,6 +7,7 @@ use Icinga\Module\Businessprocess\Modification\ProcessChanges;
use Icinga\Module\Businessprocess\Node;
use Icinga\Module\Businessprocess\Web\Form\BpConfigBaseForm;
use Icinga\Web\Notification;
+use Icinga\Web\View;
class ProcessForm extends BpConfigBaseForm
{
@@ -16,8 +17,11 @@ class ProcessForm extends BpConfigBaseForm
public function setup()
{
if ($this->node !== null) {
+ /** @var View $view */
+ $view = $this->getView();
+
$this->addHtml(
- '' . $this->getView()->escape(
+ '' . $view->escape(
sprintf($this->translate('Modify "%s"'), $this->node->getAlias())
) . '
'
);
diff --git a/application/forms/SimulationForm.php b/application/forms/SimulationForm.php
index 3d43e3a..938ffaf 100644
--- a/application/forms/SimulationForm.php
+++ b/application/forms/SimulationForm.php
@@ -5,6 +5,7 @@ namespace Icinga\Module\Businessprocess\Forms;
use Icinga\Module\Businessprocess\MonitoredNode;
use Icinga\Module\Businessprocess\Simulation;
use Icinga\Module\Businessprocess\Web\Form\BpConfigBaseForm;
+use Icinga\Web\View;
class SimulationForm extends BpConfigBaseForm
{
@@ -36,6 +37,7 @@ class SimulationForm extends BpConfigBaseForm
$node = $this->node;
}
+ /** @var View $view */
$view = $this->getView();
if ($hasSimulation) {
$title = $this->translate('Modify simulation for %s');
diff --git a/library/Businessprocess/Web/Form/QuickForm.php b/library/Businessprocess/Web/Form/QuickForm.php
index c39b34b..451c66f 100644
--- a/library/Businessprocess/Web/Form/QuickForm.php
+++ b/library/Businessprocess/Web/Form/QuickForm.php
@@ -3,6 +3,7 @@
namespace Icinga\Module\Businessprocess\Web\Form;
use Icinga\Application\Icinga;
+use Icinga\Application\Web;
use Icinga\Exception\ProgrammingError;
use Icinga\Web\Notification;
use Icinga\Web\Request;
@@ -428,14 +429,18 @@ abstract class QuickForm extends QuickBaseForm
protected function redirectAndExit($url)
{
+ /** @var Web $app */
+ $app = Icinga::app();
/** @var Response $response */
- $response = Icinga::app()->getFrontController()->getResponse();
+ $response = $app->getFrontController()->getResponse();
$response->redirectAndExit($url);
}
protected function setHttpResponseCode($code)
{
- Icinga::app()->getFrontController()->getResponse()->setHttpResponseCode($code);
+ /** @var Web $app */
+ $app = Icinga::app();
+ $app->getFrontController()->getResponse()->setHttpResponseCode($code);
return $this;
}
@@ -461,8 +466,10 @@ abstract class QuickForm extends QuickBaseForm
public function getRequest()
{
if ($this->request === null) {
+ /** @var Web $app */
+ $app = Icinga::app();
/** @var Request $request */
- $request = Icinga::app()->getFrontController()->getRequest();
+ $request = $app->getFrontController()->getRequest();
$this->setRequest($request);
}
return $this->request;
@@ -471,14 +478,15 @@ abstract class QuickForm extends QuickBaseForm
public function hasBeenSent()
{
if ($this->hasBeenSent === null) {
-
- /** @var Request $req */
if ($this->request === null) {
- $req = Icinga::app()->getFrontController()->getRequest();
+ /** @var Web $app */
+ $app = Icinga::app();
+ $req = $app->getFrontController()->getRequest();
} else {
$req = $this->request;
}
+ /** @var Request $req */
if ($req->isPost()) {
$post = $req->getPost();
$this->hasBeenSent = array_key_exists(self::ID, $post) &&
diff --git a/library/Businessprocess/Web/Url.php b/library/Businessprocess/Web/Url.php
index 3c036d4..b07b9fb 100644
--- a/library/Businessprocess/Web/Url.php
+++ b/library/Businessprocess/Web/Url.php
@@ -3,6 +3,7 @@
namespace Icinga\Module\Businessprocess\Web;
use Icinga\Application\Icinga;
+use Icinga\Application\Web;
use Icinga\Web\Url as WebUrl;
/**
@@ -19,8 +20,9 @@ class Url extends WebUrl
$app = Icinga::app();
if ($app->isCli()) {
return new FakeRequest();
- } else {
- return $app->getRequest();
}
+
+ /** @var Web $app */
+ return $app->getRequest();
}
}