diff --git a/application/clicommands/MigrateCommand.php b/application/clicommands/MigrateCommand.php index 74b4ac4a9..ba79dee97 100644 --- a/application/clicommands/MigrateCommand.php +++ b/application/clicommands/MigrateCommand.php @@ -786,7 +786,7 @@ private function readFromIni($path, &$rc) return $config; } - private function createBackupIni(string $path, Config $config = null): void + private function createBackupIni(string $path, ?Config $config = null): void { $counter = 0; while (true) { diff --git a/application/forms/RedisConfigForm.php b/application/forms/RedisConfigForm.php index bed76b0c1..ccc7d04e1 100644 --- a/application/forms/RedisConfigForm.php +++ b/application/forms/RedisConfigForm.php @@ -675,13 +675,13 @@ public static function checkRedis(Form $form): bool * Wraps the given IPL validator class into a callback validator * for usage as the only validator of the element given by name. * - * @param string $cls IPL validator class FQN - * @param string $element Form element name - * @param Closure $additionalValidator + * @param string $cls IPL validator class FQN + * @param string $element Form element name + * @param ?Closure $additionalValidator * * @return array Callback validator */ - private function wrapIplValidator(string $cls, string $element, Closure $additionalValidator = null): array + private function wrapIplValidator(string $cls, string $element, ?Closure $additionalValidator = null): array { return [ 'Callback', diff --git a/library/Icingadb/Command/Object/ProcessCheckResultCommand.php b/library/Icingadb/Command/Object/ProcessCheckResultCommand.php index ce006341a..b3a38f8c7 100644 --- a/library/Icingadb/Command/Object/ProcessCheckResultCommand.php +++ b/library/Icingadb/Command/Object/ProcessCheckResultCommand.php @@ -121,7 +121,7 @@ public function getOutput() * * @return $this */ - public function setPerformanceData(string $performanceData = null): self + public function setPerformanceData(?string $performanceData = null): self { $this->performanceData = $performanceData; diff --git a/library/Icingadb/Command/Transport/ApiCommandTransport.php b/library/Icingadb/Command/Transport/ApiCommandTransport.php index e8a3e2bc7..068bf718f 100644 --- a/library/Icingadb/Command/Transport/ApiCommandTransport.php +++ b/library/Icingadb/Command/Transport/ApiCommandTransport.php @@ -306,7 +306,7 @@ protected function sendCommand(IcingaApiCommand $command) * * @return mixed */ - public function send(IcingaCommand|IcingaApiCommand $command, int $now = null) + public function send(IcingaCommand|IcingaApiCommand $command, ?int $now = null) { if ($command instanceof IcingaCommand) { $command = $this->renderer->render($command); diff --git a/library/Icingadb/Command/Transport/CommandTransport.php b/library/Icingadb/Command/Transport/CommandTransport.php index 812279d7e..96313edeb 100644 --- a/library/Icingadb/Command/Transport/CommandTransport.php +++ b/library/Icingadb/Command/Transport/CommandTransport.php @@ -100,7 +100,7 @@ public static function createTransport(ConfigObject $config): ApiCommandTranspor * * @return mixed */ - public function send(IcingaCommand $command, int $now = null) + public function send(IcingaCommand $command, ?int $now = null) { $errors = []; $results = []; diff --git a/library/Icingadb/Command/Transport/CommandTransportInterface.php b/library/Icingadb/Command/Transport/CommandTransportInterface.php index ad07cb904..3e2786409 100644 --- a/library/Icingadb/Command/Transport/CommandTransportInterface.php +++ b/library/Icingadb/Command/Transport/CommandTransportInterface.php @@ -19,5 +19,5 @@ interface CommandTransportInterface * * @throws CommandTransportException If sending the Icinga command failed */ - public function send(IcingaCommand $command, int $now = null); + public function send(IcingaCommand $command, ?int $now = null); } diff --git a/library/Icingadb/Common/Backend.php b/library/Icingadb/Common/Backend.php index 908fea0dd..9b4cfc290 100644 --- a/library/Icingadb/Common/Backend.php +++ b/library/Icingadb/Common/Backend.php @@ -60,7 +60,16 @@ public static function getDb(): Connection $config->options = [PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ]; if ($config->db === 'mysql') { - $config->options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET SESSION SQL_MODE='STRICT_TRANS_TABLES" + // In PHP 8.5+, driver-specific constants of the PDO class are deprecated, + // but the replacements are only available since php 8.4 + if (version_compare(PHP_VERSION, '8.4.0', '<')) { + $mysqlAttrInitCommand = PDO::MYSQL_ATTR_INIT_COMMAND; + } else { + $mysqlAttrInitCommand = Pdo\Mysql::ATTR_INIT_COMMAND; + } + + $config->options[$mysqlAttrInitCommand] + = "SET SESSION SQL_MODE='STRICT_TRANS_TABLES" . ",NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'"; } diff --git a/library/Icingadb/Common/HostStates.php b/library/Icingadb/Common/HostStates.php index fb2656de4..65916d84b 100644 --- a/library/Icingadb/Common/HostStates.php +++ b/library/Icingadb/Common/HostStates.php @@ -52,7 +52,7 @@ public static function int(string $state): int * * @throws \InvalidArgumentException If the given host state is invalid, i.e. not known */ - public static function text(int $state = null): string + public static function text(?int $state = null): string { switch (true) { case $state === self::UP: @@ -83,7 +83,7 @@ public static function text(int $state = null): string * * @throws \InvalidArgumentException If the given host state is invalid, i.e. not known */ - public static function translated(int $state = null): string + public static function translated(?int $state = null): string { switch (true) { case $state === self::UP: diff --git a/library/Icingadb/Common/IcingaRedis.php b/library/Icingadb/Common/IcingaRedis.php index e6c58a78c..25bfbc1a4 100644 --- a/library/Icingadb/Common/IcingaRedis.php +++ b/library/Icingadb/Common/IcingaRedis.php @@ -176,7 +176,7 @@ protected function fetchState(string $key, array $ids, array $columns): Generato * * @return float|int|null */ - public static function getLastIcingaHeartbeat(Redis $redis = null) + public static function getLastIcingaHeartbeat(?Redis $redis = null) { if ($redis === null) { $redis = Backend::getRedis()->getConnection(); @@ -205,7 +205,7 @@ public static function getLastIcingaHeartbeat(Redis $redis = null) * * @return Redis */ - public static function getPrimaryRedis(Config $moduleConfig = null, Config $redisConfig = null): Redis + public static function getPrimaryRedis(?Config $moduleConfig = null, ?Config $redisConfig = null): Redis { if ($moduleConfig === null) { $moduleConfig = Config::module('icingadb'); @@ -239,7 +239,7 @@ public static function getPrimaryRedis(Config $moduleConfig = null, Config $redi * * @return ?Redis */ - public static function getSecondaryRedis(Config $moduleConfig = null, Config $redisConfig = null) + public static function getSecondaryRedis(?Config $moduleConfig = null, ?Config $redisConfig = null) { if ($moduleConfig === null) { $moduleConfig = Config::module('icingadb'); diff --git a/library/Icingadb/Common/ServiceStates.php b/library/Icingadb/Common/ServiceStates.php index 27ee18311..85821ce80 100644 --- a/library/Icingadb/Common/ServiceStates.php +++ b/library/Icingadb/Common/ServiceStates.php @@ -62,7 +62,7 @@ public static function int(string $state): int * * @throws \InvalidArgumentException If the given service state is invalid, i.e. not known */ - public static function text(int $state = null): string + public static function text(?int $state = null): string { switch (true) { case $state === self::OK: @@ -99,7 +99,7 @@ public static function text(int $state = null): string * * @throws \InvalidArgumentException If the given service state is invalid, i.e. not known */ - public static function translated(int $state = null): string + public static function translated(?int $state = null): string { switch (true) { case $state === self::OK: diff --git a/library/Icingadb/Common/StateBadges.php b/library/Icingadb/Common/StateBadges.php index 307248bd2..3f46f03bc 100644 --- a/library/Icingadb/Common/StateBadges.php +++ b/library/Icingadb/Common/StateBadges.php @@ -117,7 +117,7 @@ public function setUrl(Url $url): self * * @return Link */ - protected function createLink($content, Filter\Rule $filter = null): Link + protected function createLink($content, ?Filter\Rule $filter = null): Link { $url = clone $this->getUrl(); diff --git a/library/Icingadb/Compat/UrlMigrator.php b/library/Icingadb/Compat/UrlMigrator.php index eb8d76508..7969e5489 100644 --- a/library/Icingadb/Compat/UrlMigrator.php +++ b/library/Icingadb/Compat/UrlMigrator.php @@ -83,7 +83,7 @@ public static function transformUrl(Url $url): Url return $url; } - public static function transformParams(Url $url, string $transformerName = null): array + public static function transformParams(Url $url, ?string $transformerName = null): array { $transformer = new self(); @@ -156,7 +156,7 @@ public static function transformParams(Url $url, string $transformerName = null) * * @return Filter\Rule|false */ - public static function transformFilter(Filter\Rule $filter, string $queryTransformer = null) + public static function transformFilter(Filter\Rule $filter, ?string $queryTransformer = null) { $transformer = new self(); diff --git a/library/Icingadb/Data/PivotTable.php b/library/Icingadb/Data/PivotTable.php index 8db09adb3..be8171246 100644 --- a/library/Icingadb/Data/PivotTable.php +++ b/library/Icingadb/Data/PivotTable.php @@ -114,11 +114,11 @@ public function __construct(Query $query, string $xAxisColumn, string $yAxisColu /** * Set the filter to apply on the query for the x-axis * - * @param Filter\Rule $filter + * @param ?Filter\Rule $filter * * @return $this */ - public function setXAxisFilter(Filter\Rule $filter = null): self + public function setXAxisFilter(?Filter\Rule $filter = null): self { $this->xAxisFilter = $filter; return $this; @@ -127,11 +127,11 @@ public function setXAxisFilter(Filter\Rule $filter = null): self /** * Set the filter to apply on the query for the y-axis * - * @param Filter\Rule $filter + * @param ?Filter\Rule $filter * * @return $this */ - public function setYAxisFilter(Filter\Rule $filter = null): self + public function setYAxisFilter(?Filter\Rule $filter = null): self { $this->yAxisFilter = $filter; return $this; @@ -204,11 +204,11 @@ public function setYAxisHeader(string $yAxisHeader): self * * @param string $axis The axis for which to return the parameter ('x' or 'y') * @param string $param The parameter name to return - * @param int $default The default value to return + * @param ?int $default The default value to return * * @return int */ - protected function getPaginationParameter(string $axis, string $param, int $default = null): int + protected function getPaginationParameter(string $axis, string $param, ?int $default = null): int { /** @var Web $app */ $app = Icinga::app(); @@ -325,12 +325,12 @@ protected function queryYAxis(): Query * * $limit and $page are taken from the current request if not given. * - * @param int $limit The maximum amount of entries to fetch - * @param int $page The page to set as current one + * @param ?int $limit The maximum amount of entries to fetch + * @param ?int $page The page to set as current one * * @return Paginatable */ - public function paginateXAxis(int $limit = null, int $page = null): Paginatable + public function paginateXAxis(?int $limit = null, ?int $page = null): Paginatable { if ($limit === null || $page === null) { if ($limit === null) { @@ -357,12 +357,12 @@ public function paginateXAxis(int $limit = null, int $page = null): Paginatable * * $limit and $page are taken from the current request if not given. * - * @param int $limit The maximum amount of entries to fetch - * @param int $page The page to set as current one + * @param ?int $limit The maximum amount of entries to fetch + * @param ?int $page The page to set as current one * * @return Paginatable */ - public function paginateYAxis(int $limit = null, int $page = null): Paginatable + public function paginateYAxis(?int $limit = null, ?int $page = null): Paginatable { if ($limit === null || $page === null) { if ($limit === null) { diff --git a/library/Icingadb/Hook/Common/TotalSlaReportUtils.php b/library/Icingadb/Hook/Common/TotalSlaReportUtils.php index 1006056ae..f5d15a1af 100644 --- a/library/Icingadb/Hook/Common/TotalSlaReportUtils.php +++ b/library/Icingadb/Hook/Common/TotalSlaReportUtils.php @@ -13,7 +13,7 @@ trait TotalSlaReportUtils { - public function getHtml(Timerange $timerange, array $config = null) + public function getHtml(Timerange $timerange, ?array $config = null) { $data = $this->getData($timerange, $config); $count = $data->count(); diff --git a/library/Icingadb/Model/Behavior/Bitmask.php b/library/Icingadb/Model/Behavior/Bitmask.php index f8d91f627..77901e439 100644 --- a/library/Icingadb/Model/Behavior/Bitmask.php +++ b/library/Icingadb/Model/Behavior/Bitmask.php @@ -56,7 +56,7 @@ public function toDb($value, $key, $context) public function rewriteCondition(Condition $condition, $relation = null) { $column = $condition->metaData()->get('columnName'); - if (! isset($this->properties[$column])) { + if ($column === null || ! isset($this->properties[$column])) { return; } diff --git a/library/Icingadb/Model/UnreachableParent.php b/library/Icingadb/Model/UnreachableParent.php index 7e3e208c3..f7af77a6e 100644 --- a/library/Icingadb/Model/UnreachableParent.php +++ b/library/Icingadb/Model/UnreachableParent.php @@ -85,7 +85,7 @@ public function createBehaviors(Behaviors $behaviors): void ])); } - public static function on(Connection $db, Model $root = null): Query + public static function on(Connection $db, ?Model $root = null): Query { if ($root === null) { throw new InvalidArgumentException('Root node must not be null'); @@ -187,7 +187,6 @@ private static function selectNodes(Connection $db, Model $root): Select // TODO: ipl-orm doesn't preserve key order :'( $columnsProperty = (new \ReflectionClass($nodeSelect))->getProperty('columns'); - $columnsProperty->setAccessible(true); $columnsProperty->setValue($nodeSelect, array_merge( [ 'id' => null, diff --git a/library/Icingadb/ProvidedHook/Reporting/HostSlaReport.php b/library/Icingadb/ProvidedHook/Reporting/HostSlaReport.php index d9c4f4f13..56f83c89d 100644 --- a/library/Icingadb/ProvidedHook/Reporting/HostSlaReport.php +++ b/library/Icingadb/ProvidedHook/Reporting/HostSlaReport.php @@ -44,7 +44,7 @@ protected function createReportRow($row) ->setValues([(float) $row->sla]); } - protected function fetchSla(Timerange $timerange, Rule $filter = null) + protected function fetchSla(Timerange $timerange, ?Rule $filter = null) { $sla = Host::on($this->getDb()) ->columns([ diff --git a/library/Icingadb/ProvidedHook/Reporting/ServiceSlaReport.php b/library/Icingadb/ProvidedHook/Reporting/ServiceSlaReport.php index 46a068437..efde4f4ae 100644 --- a/library/Icingadb/ProvidedHook/Reporting/ServiceSlaReport.php +++ b/library/Icingadb/ProvidedHook/Reporting/ServiceSlaReport.php @@ -44,7 +44,7 @@ protected function createReportRow($row) ->setValues([(float) $row->sla]); } - protected function fetchSla(Timerange $timerange, Rule $filter = null) + protected function fetchSla(Timerange $timerange, ?Rule $filter = null) { $sla = Service::on($this->getDb()) ->columns([ diff --git a/library/Icingadb/ProvidedHook/Reporting/SlaReport.php b/library/Icingadb/ProvidedHook/Reporting/SlaReport.php index 3b4067edb..4ea653a0c 100644 --- a/library/Icingadb/ProvidedHook/Reporting/SlaReport.php +++ b/library/Icingadb/ProvidedHook/Reporting/SlaReport.php @@ -59,9 +59,9 @@ abstract protected function createReportRow($row); * * @return iterable */ - abstract protected function fetchSla(Timerange $timerange, Rule $filter = null); + abstract protected function fetchSla(Timerange $timerange, ?Rule $filter = null); - protected function fetchReportData(Timerange $timerange, array $config = null) + protected function fetchReportData(Timerange $timerange, ?array $config = null) { $rd = $this->createReportData(); $rows = []; @@ -208,12 +208,12 @@ public function initConfigForm(Form $form) ]); } - public function getData(Timerange $timerange, array $config = null) + public function getData(Timerange $timerange, ?array $config = null) { return $this->fetchReportData($timerange, $config); } - public function getHtml(Timerange $timerange, array $config = null) + public function getHtml(Timerange $timerange, ?array $config = null) { $data = $this->getData($timerange, $config); diff --git a/library/Icingadb/ProvidedHook/X509/Sni.php b/library/Icingadb/ProvidedHook/X509/Sni.php index 6f20a7df6..ae34896cc 100644 --- a/library/Icingadb/ProvidedHook/X509/Sni.php +++ b/library/Icingadb/ProvidedHook/X509/Sni.php @@ -20,7 +20,7 @@ class Sni extends SniHook /** * @inheritDoc */ - public function getHosts(Filter $filter = null): Generator + public function getHosts(?Filter $filter = null): Generator { $this->getDb()->ping(); diff --git a/library/Icingadb/Util/PerfDataSet.php b/library/Icingadb/Util/PerfDataSet.php index df3139304..1def010fb 100644 --- a/library/Icingadb/Util/PerfDataSet.php +++ b/library/Icingadb/Util/PerfDataSet.php @@ -134,11 +134,11 @@ protected function readLabel(): string * Return all characters between the current parser position and the given character * * @param string $stopChar The character on which to stop - * @param string $backtrackOn The character on which to backtrack + * @param ?string $backtrackOn The character on which to backtrack * * @return string */ - protected function readUntil(string $stopChar, string $backtrackOn = null): string + protected function readUntil(string $stopChar, ?string $backtrackOn = null): string { $start = $this->parserPos; $breakCharEncounteredAt = null; diff --git a/library/Icingadb/Web/Control/ViewModeSwitcher.php b/library/Icingadb/Web/Control/ViewModeSwitcher.php index b45218448..470c4d5d6 100644 --- a/library/Icingadb/Web/Control/ViewModeSwitcher.php +++ b/library/Icingadb/Web/Control/ViewModeSwitcher.php @@ -104,7 +104,7 @@ public function getViewMode(): string { $viewMode = $this->getPopulatedValue($this->getViewModeParam(), $this->getDefaultViewMode()); - if (array_key_exists($viewMode, static::$viewModes)) { + if ($viewMode && array_key_exists($viewMode, static::$viewModes)) { return $viewMode; } diff --git a/library/Icingadb/Web/Controller.php b/library/Icingadb/Web/Controller.php index f2cfa90b5..3cdc92144 100644 --- a/library/Icingadb/Web/Controller.php +++ b/library/Icingadb/Web/Controller.php @@ -317,11 +317,11 @@ protected function prepareSearchFilter(Query $query, string $search, Filter\Any /** * Require permission to access the given route * - * @param string $name If NULL, the current controller name is used + * @param ?string $name If NULL, the current controller name is used * * @throws SecurityException */ - public function assertRouteAccess(string $name = null) + public function assertRouteAccess(?string $name = null) { if (! $name) { $name = $this->getRequest()->getControllerName(); @@ -447,7 +447,7 @@ protected function addContent(ValidHtml $content) return parent::addContent($content); } - public function filter(Query $query, Filter\Rule $filter = null): self + public function filter(Query $query, ?Filter\Rule $filter = null): self { if ($this->format !== 'sql' || $this->hasPermission('config/authentication/roles/show')) { $this->applyRestrictions($query); diff --git a/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php b/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php index f06cacf0e..a07346d36 100644 --- a/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php +++ b/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php @@ -114,7 +114,7 @@ public function getTitle() return $this->title; } - public function render(NavigationItem $item = null): string + public function render(?NavigationItem $item = null): string { if ($item === null) { $item = $this->getItem(); diff --git a/library/Icingadb/Widget/Detail/CustomVarTable.php b/library/Icingadb/Widget/Detail/CustomVarTable.php index 0aac95c64..5c74a3c97 100644 --- a/library/Icingadb/Widget/Detail/CustomVarTable.php +++ b/library/Icingadb/Widget/Detail/CustomVarTable.php @@ -51,7 +51,7 @@ class CustomVarTable extends BaseHtmlElement * @param iterable $data * @param ?Model $object */ - public function __construct($data, Model $object = null) + public function __construct($data, ?Model $object = null) { $this->data = $data; $this->object = $object; diff --git a/library/Icingadb/Widget/ShowMore.php b/library/Icingadb/Widget/ShowMore.php index d7fc7fb4d..7de256259 100644 --- a/library/Icingadb/Widget/ShowMore.php +++ b/library/Icingadb/Widget/ShowMore.php @@ -27,7 +27,7 @@ class ShowMore extends BaseHtmlElement /** @var ?string */ protected $label; - public function __construct(ResultSet $resultSet, Url $url, string $label = null) + public function __construct(ResultSet $resultSet, Url $url, ?string $label = null) { $this->label = $label; $this->resultSet = $resultSet; diff --git a/phpstan-baseline-7x.neon b/phpstan-baseline-7x.neon deleted file mode 100644 index 95668ced4..000000000 --- a/phpstan-baseline-7x.neon +++ /dev/null @@ -1,106 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Parameter \\#1 \\$data of function hex2bin expects string, mixed given\\.$#" - count: 1 - path: application/controllers/EventController.php - - - - message: "#^Parameter \\#1 \\$str of function md5 expects string, mixed given\\.$#" - count: 1 - path: application/forms/RedisConfigForm.php - - - - message: "#^Parameter \\#1 \\$stack of function array_pop expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Command/Transport/ApiCommandTransport.php - - - - message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Common/IcingaRedis.php - - - - message: "#^Parameter \\#1 \\$arr1 of function array_diff_key expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Common/ObjectInspectionDetail.php - - - - message: "#^Parameter \\#1 \\$data of function bin2hex expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Common/ObjectInspectionDetail.php - - - - message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#" - count: 2 - path: library/Icingadb/Compat/UrlMigrator.php - - - - message: "#^Parameter \\#1 \\$input of function array_keys expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/CsvResultSet.php - - - - message: "#^Parameter \\#1 \\$input of function array_values expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/CsvResultSet.php - - - - message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/PivotTable.php - - - - message: "#^Parameter \\#1 \\$input of function array_keys expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/VolatileCsvResults.php - - - - message: "#^Parameter \\#1 \\$input of function array_values expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/VolatileCsvResults.php - - - - message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php - - - - message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, array\\\\|false given\\.$#" - count: 1 - path: library/Icingadb/Model/CustomvarFlat.php - - - - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, Icinga\\\\Module\\\\Reporting\\\\ReportData\\|null given\\.$#" - count: 1 - path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php - - - - message: "#^Parameter \\#1 \\$number of function number_format expects float, float\\|int\\|string given\\.$#" - count: 1 - path: library/Icingadb/Util/PerfData.php - - - - message: "#^Parameter \\#1 \\$str of function trim expects string, string\\|null given\\.$#" - count: 1 - path: library/Icingadb/Util/PluginOutput.php - - - - message: "#^Parameter \\#3 \\$encoding of function htmlspecialchars expects string, null given\\.$#" - count: 1 - path: library/Icingadb/Util/PluginOutput.php - - - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Web/Controller.php - - - - message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Web/Controller.php - - - - message: "#^Parameter \\#1 \\$objects of method Icinga\\\\Module\\\\Icingadb\\\\Forms\\\\Command\\\\CommandForm\\:\\:setObjects\\(\\) expects array\\\\|\\(Countable&Traversable\\\\), array\\\\|false given\\.$#" - count: 1 - path: library/Icingadb/Widget/Detail/MultiselectQuickActions.php diff --git a/phpstan-baseline-8x.neon b/phpstan-baseline-8x.neon deleted file mode 100644 index d27ed7950..000000000 --- a/phpstan-baseline-8x.neon +++ /dev/null @@ -1,101 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Parameter \\#1 \\$string of function hex2bin expects string, mixed given\\.$#" - count: 1 - path: application/controllers/EventController.php - - - - message: "#^Parameter \\#1 \\$string of function md5 expects string, mixed given\\.$#" - count: 1 - path: application/forms/RedisConfigForm.php - - - - message: "#^Parameter \\#1 \\$array of function array_pop expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Command/Transport/ApiCommandTransport.php - - - - message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Common/IcingaRedis.php - - - - message: "#^Parameter \\#1 \\$array of function array_diff_key expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Common/ObjectInspectionDetail.php - - - - message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Common/ObjectInspectionDetail.php - - - - message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#" - count: 2 - path: library/Icingadb/Compat/UrlMigrator.php - - - - message: "#^Parameter \\#1 \\$array of function array_keys expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/CsvResultSet.php - - - - message: "#^Parameter \\#1 \\$array of function array_values expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/CsvResultSet.php - - - - message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/PivotTable.php - - - - message: "#^Parameter \\#1 \\$array of function array_keys expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/VolatileCsvResults.php - - - - message: "#^Parameter \\#1 \\$array of function array_values expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/VolatileCsvResults.php - - - - message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php - - - - message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, array\\\\|false given\\.$#" - count: 1 - path: library/Icingadb/Model/CustomvarFlat.php - - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, Icinga\\\\Module\\\\Reporting\\\\ReportData\\|null given\\.$#" - count: 1 - path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php - - - - message: "#^Parameter \\#1 \\$num of function number_format expects float, float\\|int\\|string given\\.$#" - count: 1 - path: library/Icingadb/Util/PerfData.php - - - - message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|null given\\.$#" - count: 1 - path: library/Icingadb/Util/PluginOutput.php - - - - message: "#^Parameter \\#1 \\$string of function trim expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Web/Controller.php - - - - message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Web/Controller.php - - - - message: "#^Parameter \\#1 \\$objects of method Icinga\\\\Module\\\\Icingadb\\\\Forms\\\\Command\\\\CommandForm\\:\\:setObjects\\(\\) expects array\\\\|\\(Countable&Traversable\\\\), array\\ given\\.$#" - count: 1 - path: library/Icingadb/Widget/Detail/MultiselectQuickActions.php diff --git a/phpstan-baseline-by-php-version.php b/phpstan-baseline-by-php-version.php deleted file mode 100644 index 4bd791e86..000000000 --- a/phpstan-baseline-by-php-version.php +++ /dev/null @@ -1,12 +0,0 @@ -= 80000) { - $includes[] = __DIR__ . '/phpstan-baseline-8x.neon'; -} else { - $includes[] = __DIR__ . '/phpstan-baseline-7x.neon'; -} - -return [ - 'includes' => $includes -]; diff --git a/phpstan-baseline-standard.neon b/phpstan-baseline.neon similarity index 95% rename from phpstan-baseline-standard.neon rename to phpstan-baseline.neon index 72c95db90..42e3aea04 100644 --- a/phpstan-baseline-standard.neon +++ b/phpstan-baseline.neon @@ -48,96 +48,12 @@ parameters: count: 2 path: application/controllers/CommandTransportController.php - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:acknowledgeAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/CommentController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:addCommentAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/CommentController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:assertIsGrantedOnCommandTargets\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/CommentController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:checkNowAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/CommentController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:fetchCommandTargets\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: application/controllers/CommentController.php - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:indexAction\(\) has no return type specified\.$#' identifier: missingType.return count: 1 path: application/controllers/CommentController.php - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:processCheckresultAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/CommentController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:removeAcknowledgementAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/CommentController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:scheduleCheckAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/CommentController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:scheduleDowntimeAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/CommentController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:sendCustomNotificationAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/CommentController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:toggleFeaturesAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/CommentController.php - - - - message: '#^Parameter \#1 \$form of method Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:handleCommandForm\(\) expects Icinga\\Module\\Icingadb\\Forms\\Command\\CommandForm\|string, Icinga\\Module\\Icingadb\\Forms\\Command\\Object\\ToggleObjectFeaturesForm\|null given\.$#' - identifier: argument.type - count: 1 - path: application/controllers/CommentController.php - - - - message: '#^Parameter \#2 \$value of static method ipl\\Stdlib\\Filter\:\:equal\(\) expects array\|bool\|float\|int\|string, mixed given\.$#' - identifier: argument.type - count: 1 - path: application/controllers/CommentController.php - - - - message: '#^Property Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:\$commandTargetModel \(ipl\\Orm\\Model\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: application/controllers/CommentController.php - - message: '#^Property Icinga\\Module\\Icingadb\\Controllers\\CommentController\:\:\$comment \(Icinga\\Module\\Icingadb\\Model\\Comment\) does not accept ipl\\Orm\\Model\.$#' identifier: assign.propertyType @@ -204,96 +120,12 @@ parameters: count: 1 path: application/controllers/ConfigController.php - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:acknowledgeAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/DowntimeController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:addCommentAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/DowntimeController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:assertIsGrantedOnCommandTargets\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/DowntimeController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:checkNowAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/DowntimeController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:fetchCommandTargets\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: application/controllers/DowntimeController.php - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:indexAction\(\) has no return type specified\.$#' identifier: missingType.return count: 1 path: application/controllers/DowntimeController.php - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:processCheckresultAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/DowntimeController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:removeAcknowledgementAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/DowntimeController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:scheduleCheckAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/DowntimeController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:scheduleDowntimeAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/DowntimeController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:sendCustomNotificationAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/DowntimeController.php - - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:toggleFeaturesAction\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: application/controllers/DowntimeController.php - - - - message: '#^Parameter \#1 \$form of method Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:handleCommandForm\(\) expects Icinga\\Module\\Icingadb\\Forms\\Command\\CommandForm\|string, Icinga\\Module\\Icingadb\\Forms\\Command\\Object\\ToggleObjectFeaturesForm\|null given\.$#' - identifier: argument.type - count: 1 - path: application/controllers/DowntimeController.php - - - - message: '#^Parameter \#2 \$value of static method ipl\\Stdlib\\Filter\:\:equal\(\) expects array\|bool\|float\|int\|string, mixed given\.$#' - identifier: argument.type - count: 1 - path: application/controllers/DowntimeController.php - - - - message: '#^Property Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:\$commandTargetModel \(ipl\\Orm\\Model\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: application/controllers/DowntimeController.php - - message: '#^Property Icinga\\Module\\Icingadb\\Controllers\\DowntimeController\:\:\$downtime \(Icinga\\Module\\Icingadb\\Model\\Downtime\) does not accept ipl\\Orm\\Model\.$#' identifier: assign.propertyType @@ -366,6 +198,12 @@ parameters: count: 1 path: application/controllers/EventController.php + - + message: '#^Parameter \#1 \$string of function hex2bin expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: application/controllers/EventController.php + - message: '#^Property Icinga\\Module\\Icingadb\\Controllers\\EventController\:\:\$event \(Icinga\\Module\\Icingadb\\Model\\History\) does not accept ipl\\Orm\\Model\.$#' identifier: assign.propertyType @@ -468,12 +306,6 @@ parameters: count: 1 path: application/controllers/HostController.php - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\HostController\:\:fetchCommandTargets\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: application/controllers/HostController.php - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\HostController\:\:processCheckresultAction\(\) has no return type specified\.$#' identifier: missingType.return @@ -546,12 +378,6 @@ parameters: count: 1 path: application/controllers/HostController.php - - - message: '#^Parameter \#2 \$value of static method ipl\\Stdlib\\Filter\:\:equal\(\) expects array\|bool\|float\|int\|string, mixed given\.$#' - identifier: argument.type - count: 1 - path: application/controllers/HostController.php - - message: '#^Parameter \#2 \$value of static method ipl\\Stdlib\\Filter\:\:lessThanOrEqual\(\) expects float\|int\|string, mixed given\.$#' identifier: argument.type @@ -816,12 +642,6 @@ parameters: count: 1 path: application/controllers/ServiceController.php - - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\ServiceController\:\:fetchCommandTargets\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: application/controllers/ServiceController.php - - message: '#^Method Icinga\\Module\\Icingadb\\Controllers\\ServiceController\:\:processCheckresultAction\(\) has no return type specified\.$#' identifier: missingType.return @@ -906,12 +726,6 @@ parameters: count: 1 path: application/controllers/ServiceController.php - - - message: '#^Parameter \#2 \$value of static method ipl\\Stdlib\\Filter\:\:equal\(\) expects array\|bool\|float\|int\|string, mixed given\.$#' - identifier: argument.type - count: 2 - path: application/controllers/ServiceController.php - - message: '#^Parameter \#2 \$value of static method ipl\\Stdlib\\Filter\:\:lessThanOrEqual\(\) expects float\|int\|string, mixed given\.$#' identifier: argument.type @@ -1716,6 +1530,12 @@ parameters: count: 1 path: application/forms/RedisConfigForm.php + - + message: '#^Parameter \#1 \$string of function md5 expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: application/forms/RedisConfigForm.php + - message: '#^Parameter \#2 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\.$#' identifier: argument.type @@ -1854,12 +1674,6 @@ parameters: count: 1 path: library/Icingadb/Command/Object/GetObjectCommand.php - - - message: '#^Method Icinga\\Module\\Icingadb\\Command\\Object\\ObjectsCommand\:\:getObjects\(\) return type has no value type specified in iterable type Traversable\.$#' - identifier: missingType.iterableValue - count: 1 - path: library/Icingadb/Command/Object/ObjectsCommand.php - - message: '#^Property Icinga\\Module\\Icingadb\\Command\\Object\\ProcessCheckResultCommand\:\:\$performanceData \(string\) does not accept string\|null\.$#' identifier: assign.propertyType @@ -1920,6 +1734,12 @@ parameters: count: 1 path: library/Icingadb/Command/Transport/ApiCommandTransport.php + - + message: '#^Parameter \#1 \$array of function array_pop expects array, mixed given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/Command/Transport/ApiCommandTransport.php + - message: '#^Property Icinga\\Module\\Icingadb\\Command\\Transport\\CommandTransportConfig\:\:\$configs type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -1939,22 +1759,16 @@ parameters: path: library/Icingadb/Command/Transport/CommandTransportInterface.php - - message: '#^Cannot access offset ''in_downtime'' on mixed\.$#' - identifier: offsetAccess.nonOffsetAccessible + message: '#^Access to constant ATTR_INIT_COMMAND on an unknown class PDO\\Mysql\.$#' + identifier: class.notFound count: 1 - path: library/Icingadb/Common/IcingaRedis.php + path: library/Icingadb/Common/Backend.php - - message: '#^Cannot access offset ''is_acknowledged'' on mixed\.$#' - identifier: offsetAccess.nonOffsetAccessible + message: '#^Possibly invalid array key type mixed\.$#' + identifier: offsetAccess.invalidOffset count: 1 - path: library/Icingadb/Common/IcingaRedis.php - - - - message: '#^Cannot access offset ''state_type'' on mixed\.$#' - identifier: offsetAccess.nonOffsetAccessible - count: 2 - path: library/Icingadb/Common/IcingaRedis.php + path: library/Icingadb/Common/Backend.php - message: '#^Method Icinga\\Module\\Icingadb\\Common\\IcingaRedis\:\:fetchHostState\(\) has parameter \$columns with no value type specified in iterable type array\.$#' @@ -1998,6 +1812,12 @@ parameters: count: 1 path: library/Icingadb/Common/IcingaRedis.php + - + message: '#^Parameter \#2 \.\.\.\$arrays of function array_merge expects array, mixed given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/Common/IcingaRedis.php + - message: '#^Method Icinga\\Module\\Icingadb\\Common\\Links\:\:hostgroup\(\) has parameter \$hostgroup with no type specified\.$#' identifier: missingType.parameter @@ -2106,12 +1926,24 @@ parameters: count: 1 path: library/Icingadb/Common/ObjectInspectionDetail.php + - + message: '#^Parameter \#1 \$array of function array_diff_key expects array, mixed given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/Common/ObjectInspectionDetail.php + - message: '#^Parameter \#1 \$content of static method ipl\\Html\\Table\:\:td\(\) expects array\|ipl\\Html\\Html\|string\|null, mixed given\.$#' identifier: argument.type count: 1 path: library/Icingadb/Common/ObjectInspectionDetail.php + - + message: '#^Parameter \#1 \$string of function bin2hex expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/Common/ObjectInspectionDetail.php + - message: '#^Property Icinga\\Module\\Icingadb\\Common\\ObjectInspectionDetail\:\:\$attrs type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -2226,12 +2058,6 @@ parameters: count: 2 path: library/Icingadb/Compat/CompatHost.php - - - message: '#^Cannot call method columns\(\) on mixed\.$#' - identifier: method.nonObject - count: 1 - path: library/Icingadb/Compat/CompatHost.php - - message: '#^Cannot call method execute\(\) on mixed\.$#' identifier: method.nonObject @@ -2334,12 +2160,6 @@ parameters: count: 2 path: library/Icingadb/Compat/CompatHost.php - - - message: '#^Parameter \#2 \$value of static method ipl\\Stdlib\\Filter\:\:equal\(\) expects array\|bool\|float\|int\|string, mixed given\.$#' - identifier: argument.type - count: 3 - path: library/Icingadb/Compat/CompatHost.php - - message: '#^Property Icinga\\Module\\Icingadb\\Compat\\CompatHost\:\:\$legacyColumns has no type specified\.$#' identifier: missingType.property @@ -2358,30 +2178,6 @@ parameters: count: 1 path: library/Icingadb/Compat/CompatHost.php - - - message: '#^Property Icinga\\Module\\Monitoring\\Object\\MonitoredObject\:\:\$eventhistory \(Icinga\\Module\\Monitoring\\DataView\\EventHistory\) does not accept array\.$#' - identifier: assign.propertyType - count: 1 - path: library/Icingadb/Compat/CompatHost.php - - - - message: '#^Property Icinga\\Module\\Monitoring\\Object\\MonitoredObject\:\:\$hostVariables \(array\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: library/Icingadb/Compat/CompatHost.php - - - - message: '#^Property Icinga\\Module\\Monitoring\\Object\\MonitoredObject\:\:\$serviceVariables \(array\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: library/Icingadb/Compat/CompatHost.php - - - - message: '#^Unreachable statement \- code above always terminates\.$#' - identifier: deadCode.unreachable - count: 2 - path: library/Icingadb/Compat/CompatHost.php - - message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#' identifier: foreach.nonIterable @@ -2478,12 +2274,6 @@ parameters: count: 2 path: library/Icingadb/Compat/CompatService.php - - - message: '#^Cannot call method columns\(\) on mixed\.$#' - identifier: method.nonObject - count: 1 - path: library/Icingadb/Compat/CompatService.php - - message: '#^Cannot call method execute\(\) on mixed\.$#' identifier: method.nonObject @@ -2544,12 +2334,6 @@ parameters: count: 1 path: library/Icingadb/Compat/CompatService.php - - - message: '#^Method Icinga\\Module\\Icingadb\\Compat\\CompatService\:\:getHost\(\) should return Icinga\\Module\\Icingadb\\Compat\\CompatHost but returns Icinga\\Module\\Monitoring\\Object\\Host\.$#' - identifier: return.type - count: 1 - path: library/Icingadb/Compat/CompatService.php - - message: '#^Method Icinga\\Module\\Icingadb\\Compat\\CompatService\:\:getName\(\) should return string but returns mixed\.$#' identifier: return.type @@ -2604,12 +2388,6 @@ parameters: count: 2 path: library/Icingadb/Compat/CompatService.php - - - message: '#^Parameter \#2 \$value of static method ipl\\Stdlib\\Filter\:\:equal\(\) expects array\|bool\|float\|int\|string, mixed given\.$#' - identifier: argument.type - count: 3 - path: library/Icingadb/Compat/CompatService.php - - message: '#^Property Icinga\\Module\\Icingadb\\Compat\\CompatService\:\:\$legacyColumns has no type specified\.$#' identifier: missingType.property @@ -2628,30 +2406,6 @@ parameters: count: 1 path: library/Icingadb/Compat/CompatService.php - - - message: '#^Property Icinga\\Module\\Monitoring\\Object\\MonitoredObject\:\:\$eventhistory \(Icinga\\Module\\Monitoring\\DataView\\EventHistory\) does not accept array\.$#' - identifier: assign.propertyType - count: 1 - path: library/Icingadb/Compat/CompatService.php - - - - message: '#^Property Icinga\\Module\\Monitoring\\Object\\MonitoredObject\:\:\$hostVariables \(array\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: library/Icingadb/Compat/CompatService.php - - - - message: '#^Property Icinga\\Module\\Monitoring\\Object\\MonitoredObject\:\:\$serviceVariables \(array\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: library/Icingadb/Compat/CompatService.php - - - - message: '#^Unreachable statement \- code above always terminates\.$#' - identifier: deadCode.unreachable - count: 2 - path: library/Icingadb/Compat/CompatService.php - - message: '#^Method Icinga\\Module\\Icingadb\\Compat\\UrlMigrator\:\:commentsColumns\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -2785,9 +2539,9 @@ parameters: path: library/Icingadb/Compat/UrlMigrator.php - - message: '#^Parameter \#1 \$column of method ipl\\Stdlib\\Filter\\Condition\:\:setColumn\(\) expects string, int\|string\|null given\.$#' + message: '#^Parameter \#1 \$string of function strtolower expects string, mixed given\.$#' identifier: argument.type - count: 1 + count: 2 path: library/Icingadb/Compat/UrlMigrator.php - @@ -2802,6 +2556,12 @@ parameters: count: 1 path: library/Icingadb/Data/CsvResultSet.php + - + message: '#^Parameter \#1 \$array of function array_keys expects array, mixed given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/Data/CsvResultSet.php + - message: '#^Parameter \#1 \$key of method Icinga\\Module\\Icingadb\\Data\\CsvResultSet\:\:formatValue\(\) expects string, mixed given\.$#' identifier: argument.type @@ -2868,6 +2628,12 @@ parameters: count: 1 path: library/Icingadb/Data/PivotTable.php + - + message: '#^Parameter \#2 \$string of function explode expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/Data/PivotTable.php + - message: '#^Property Icinga\\Module\\Icingadb\\Data\\PivotTable\:\:\$gridcols type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -2904,6 +2670,12 @@ parameters: count: 1 path: library/Icingadb/Data/VolatileCsvResults.php + - + message: '#^Parameter \#1 \$array of function array_keys expects array, mixed given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/Data/VolatileCsvResults.php + - message: '#^Parameter \#1 \$key of method Icinga\\Module\\Icingadb\\Data\\VolatileCsvResults\:\:formatValue\(\) expects string, mixed given\.$#' identifier: argument.type @@ -3108,6 +2880,12 @@ parameters: count: 1 path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php + - + message: '#^Parameter \#2 \$string of function explode expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php + - message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#' identifier: foreach.nonIterable @@ -3198,12 +2976,6 @@ parameters: count: 1 path: library/Icingadb/Model/Behavior/FlattenedObjectVars.php - - - message: '#^Parameter \#2 \$value of static method ipl\\Stdlib\\Filter\:\:equal\(\) expects array\|bool\|float\|int\|string, mixed given\.$#' - identifier: argument.type - count: 1 - path: library/Icingadb/Model/Behavior/FlattenedObjectVars.php - - message: '#^Part \$column \(mixed\) of encapsed string cannot be cast to string\.$#' identifier: encapsedStringPart.nonString @@ -4806,6 +4578,12 @@ parameters: count: 1 path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php + - + message: '#^Parameter \#1 \$value of function count expects array\|Countable, Icinga\\Module\\Reporting\\ReportData\|null given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php + - message: '#^Parameter \#2 \$end of class Icinga\\Module\\Reporting\\Timerange constructor expects DateTime, mixed given\.$#' identifier: argument.type @@ -5280,6 +5058,12 @@ parameters: count: 1 path: library/Icingadb/Util/PerfData.php + - + message: '#^Parameter \#1 \$num of function number_format expects float, float\|int\|string given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/Util/PerfData.php + - message: '#^Parameter \#1 \$value of method Icinga\\Module\\Icingadb\\Util\\ThresholdRange\:\:contains\(\) expects float, float\|null given\.$#' identifier: argument.type @@ -5496,6 +5280,12 @@ parameters: count: 1 path: library/Icingadb/Util/PluginOutput.php + - + message: '#^Parameter \#1 \$string of function trim expects string, string\|null given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/Util/PluginOutput.php + - message: '#^Property Icinga\\Module\\Icingadb\\Util\\PluginOutput\:\:\$renderedOutput \(string\) does not accept string\|null\.$#' identifier: assign.propertyType @@ -5574,12 +5364,6 @@ parameters: count: 1 path: library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php - - - message: '#^Cannot access property \$flatname on array\\.$#' - identifier: property.nonObject - count: 1 - path: library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php - - message: '#^Cannot call method getRoles\(\) on Icinga\\User\|null\.$#' identifier: method.nonObject @@ -5850,12 +5634,6 @@ parameters: count: 1 path: library/Icingadb/Web/Controller.php - - - message: '#^Method Icinga\\Module\\Icingadb\\Web\\Controller\:\:sendAsPdf\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: library/Icingadb/Web/Controller.php - - message: '#^PHPDoc tag @param references unknown parameter\: \$preserveParams$#' identifier: parameter.notFound @@ -5898,6 +5676,18 @@ parameters: count: 3 path: library/Icingadb/Web/Controller.php + - + message: '#^Parameter \#1 \$string of function trim expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/Web/Controller.php + + - + message: '#^Parameter \#2 \$string of function explode expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: library/Icingadb/Web/Controller.php + - message: '#^Parameter \#2 \$tableName of method ipl\\Orm\\Resolver\:\:qualifyColumn\(\) expects string, int\\|int\<1, max\>\|string given\.$#' identifier: argument.type @@ -6396,12 +6186,6 @@ parameters: count: 1 path: library/Icingadb/Widget/Detail/CustomVarTable.php - - - message: '#^Parameter \#2 \$value of method ipl\\Html\\Attributes\:\:add\(\) expects array\|bool\|string\|null, int given\.$#' - identifier: argument.type - count: 1 - path: library/Icingadb/Widget/Detail/CustomVarTable.php - - message: '#^Property Icinga\\Module\\Icingadb\\Widget\\Detail\\CustomVarTable\:\:\$data \(array\) does not accept iterable\.$#' identifier: assign.propertyType @@ -7128,12 +6912,6 @@ parameters: count: 3 path: library/Icingadb/Widget/Detail/ObjectDetail.php - - - message: '#^Parameter \#1 \$view of method Icinga\\Module\\Monitoring\\Hook\\DetailviewExtensionHook\:\:setView\(\) expects Icinga\\Web\\View, null given\.$#' - identifier: argument.type - count: 1 - path: library/Icingadb/Widget/Detail/ObjectDetail.php - - message: '#^Parameter \#2 \$tableName of method ipl\\Orm\\Resolver\:\:qualifyColumn\(\) expects string, int\\|int\<1, max\>\|string given\.$#' identifier: argument.type @@ -7146,12 +6924,6 @@ parameters: count: 2 path: library/Icingadb/Widget/Detail/ObjectDetail.php - - - message: '#^Possibly invalid array key type array\|bool\|string\|null\.$#' - identifier: offsetAccess.invalidOffset - count: 1 - path: library/Icingadb/Widget/Detail/ObjectDetail.php - - message: '#^Property Icinga\\Module\\Icingadb\\Widget\\Detail\\ObjectDetail\:\:\$compatObject has no type specified\.$#' identifier: missingType.property diff --git a/phpstan.neon b/phpstan.neon index a0656a4bf..453c53894 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,5 @@ includes: - - phpstan-baseline-standard.neon - - phpstan-baseline-by-php-version.php + - phpstan-baseline.neon parameters: level: max diff --git a/test/php/library/Icingadb/Common/StateBadgesTest.php b/test/php/library/Icingadb/Common/StateBadgesTest.php index 0b9fd5e22..166edd384 100644 --- a/test/php/library/Icingadb/Common/StateBadgesTest.php +++ b/test/php/library/Icingadb/Common/StateBadgesTest.php @@ -83,7 +83,7 @@ protected function getStateInt(string $state): int return 0; } - public function generateLink($content, Filter\Rule $filter = null): Link + public function generateLink($content, ?Filter\Rule $filter = null): Link { return parent::createLink($content, $filter); }