Add variable type hint to Icinga::app()'s returned object

This commit is contained in:
Sukhwinder Dhillon 2023-08-21 14:33:45 +02:00
parent 239c33ade9
commit d2f1a4dbde
3 changed files with 12 additions and 4 deletions

View file

@ -5,6 +5,7 @@
namespace Icinga\Module\Icingadb\Data;
use Icinga\Application\Icinga;
use Icinga\Application\Web;
use ipl\Orm\Query;
use ipl\Stdlib\Contract\Paginatable;
use ipl\Stdlib\Filter;
@ -209,9 +210,10 @@ class PivotTable
*/
protected function getPaginationParameter(string $axis, string $param, int $default = null): int
{
$request = Icinga::app()->getRequest();
/** @var Web $app */
$app = Icinga::app();
$value = $request->getParam($param, '');
$value = $app->getRequest()->getParam($param, '');
if (strpos($value, ',') > 0) {
$parts = explode(',', $value, 2);
return intval($parts[$axis === 'x' ? 0 : 1]);

View file

@ -11,6 +11,7 @@ use Icinga\Application\Config;
use Icinga\Application\Icinga;
use Icinga\Application\Logger;
use Icinga\Application\Version;
use Icinga\Application\Web;
use Icinga\Data\ConfigObject;
use Icinga\Date\DateFormatter;
use Icinga\Exception\ConfigurationError;
@ -535,7 +536,9 @@ class Controller extends CompatController
protected function moduleInit()
{
Icinga::app()->getFrontController()
/** @var Web $app */
$app = Icinga::app();
$app->getFrontController()
->getPlugin('Zend_Controller_Plugin_ErrorHandler')
->setErrorHandlerModule('icingadb');
}

View file

@ -10,6 +10,7 @@ use Icinga\Application\Hook;
use Icinga\Application\Hook\GrapherHook;
use Icinga\Application\Icinga;
use Icinga\Application\Logger;
use Icinga\Application\Web;
use Icinga\Date\DateFormatter;
use Icinga\Exception\IcingaException;
use Icinga\Module\Icingadb\Common\Auth;
@ -483,8 +484,10 @@ class ObjectDetail extends BaseHtmlElement
}
try {
/** @var Web $app */
$app = Icinga::app();
$renderedExtension = $extension
->setView(Icinga::app()->getViewRenderer()->view)
->setView($app->getViewRenderer()->view)
->getHtmlForObject($this->compatObject());
$extensionHtml = new HtmlElement(