diff --git a/library/Graphite/Graphing/GraphingTrait.php b/library/Graphite/Graphing/GraphingTrait.php index e32a52a1..a1c1cdc2 100644 --- a/library/Graphite/Graphing/GraphingTrait.php +++ b/library/Graphite/Graphing/GraphingTrait.php @@ -4,6 +4,7 @@ use Icinga\Application\Config; use Icinga\Application\Icinga; +use Icinga\Data\ConfigObject; use Icinga\Exception\ConfigurationError; use Icinga\Module\Graphite\Web\FakeSchemeRequest; use Icinga\Web\Url; @@ -61,6 +62,7 @@ public static function getMetricsDataSource() { if (static::$metricsDataSource === null) { $config = Config::module('graphite'); + /** @var ConfigObject $graphite */ $graphite = $config->getSection('graphite'); if (! isset($graphite->url)) { throw new ConfigurationError('Missing "graphite.url" in "%s"', $config->getConfigFile()); @@ -70,7 +72,7 @@ public static function getMetricsDataSource() (new GraphiteWebClient(Url::fromPath($graphite->url, [], new FakeSchemeRequest()))) ->setUser($graphite->user) ->setPassword($graphite->password) - ->setInsecure($graphite->insecure) + ->setInsecure((bool) $graphite->insecure) ); } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 918a5988..60e4201a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -15,26 +15,6 @@ parameters: count: 1 path: application/clicommands/Icinga2Command.php - - - message: "#^Parameter \\#1 \\$insecure of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setInsecure\\(\\) expects bool, mixed given\\.$#" - count: 1 - path: application/clicommands/Icinga2Command.php - - - - message: "#^Parameter \\#1 \\$password of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setPassword\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: application/clicommands/Icinga2Command.php - - - - message: "#^Parameter \\#1 \\$url of static method Icinga\\\\Web\\\\Url\\:\\:fromPath\\(\\) expects string, mixed given\\.$#" - count: 1 - path: application/clicommands/Icinga2Command.php - - - - message: "#^Parameter \\#1 \\$user of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setUser\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: application/clicommands/Icinga2Command.php - - message: "#^Method Icinga\\\\Module\\\\Graphite\\\\Controllers\\\\ConfigController\\:\\:advancedAction\\(\\) has no return type specified\\.$#" count: 1 @@ -65,26 +45,6 @@ parameters: count: 1 path: application/controllers/GraphController.php - - - message: "#^Parameter \\#1 \\$insecure of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setInsecure\\(\\) expects bool, mixed given\\.$#" - count: 1 - path: application/controllers/GraphController.php - - - - message: "#^Parameter \\#1 \\$password of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setPassword\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: application/controllers/GraphController.php - - - - message: "#^Parameter \\#1 \\$url of static method Icinga\\\\Web\\\\Url\\:\\:fromPath\\(\\) expects string, mixed given\\.$#" - count: 1 - path: application/controllers/GraphController.php - - - - message: "#^Parameter \\#1 \\$user of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setUser\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: application/controllers/GraphController.php - - message: "#^Parameter \\#2 \\$checkCommand of method Icinga\\\\Module\\\\Graphite\\\\Controllers\\\\GraphController\\:\\:supplyImage\\(\\) expects string, mixed given\\.$#" count: 2 @@ -190,26 +150,6 @@ parameters: count: 1 path: application/controllers/MonitoringGraphController.php - - - message: "#^Parameter \\#1 \\$insecure of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setInsecure\\(\\) expects bool, mixed given\\.$#" - count: 1 - path: application/controllers/MonitoringGraphController.php - - - - message: "#^Parameter \\#1 \\$password of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setPassword\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: application/controllers/MonitoringGraphController.php - - - - message: "#^Parameter \\#1 \\$url of static method Icinga\\\\Web\\\\Url\\:\\:fromPath\\(\\) expects string, mixed given\\.$#" - count: 1 - path: application/controllers/MonitoringGraphController.php - - - - message: "#^Parameter \\#1 \\$user of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setUser\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: application/controllers/MonitoringGraphController.php - - message: "#^Parameter \\#2 \\$host of class Icinga\\\\Module\\\\Monitoring\\\\Object\\\\Host constructor expects string, mixed given\\.$#" count: 1 @@ -460,6 +400,11 @@ parameters: count: 2 path: library/Graphite/Graphing/Template.php + - + message: "#^PHPDoc tag @var for variable \\$options contains generic class Icinga\\\\Data\\\\ConfigObject but does not specify its types\\: TValue$#" + count: 1 + path: library/Graphite/Graphing/Templates.php + - message: "#^Parameter \\#1 \\$array of function array_unique expects array, array\\\\|false given\\.$#" count: 1 @@ -472,7 +417,7 @@ parameters: - message: "#^Parameter \\#1 \\$template of class Icinga\\\\Module\\\\Graphite\\\\Util\\\\MacroTemplate constructor expects string, mixed given\\.$#" - count: 1 + count: 4 path: library/Graphite/Graphing/Templates.php - @@ -480,6 +425,11 @@ parameters: count: 1 path: library/Graphite/Graphing/Templates.php + - + message: "#^Parameter \\#2 \\$subject of function preg_split expects string, mixed given\\.$#" + count: 1 + path: library/Graphite/Graphing/Templates.php + - message: "#^Property Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\Templates\\:\\:\\$defaultTemplates \\(array\\\\) does not accept array\\\\|Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\Template\\>\\.$#" count: 1 @@ -710,26 +660,6 @@ parameters: count: 1 path: library/Graphite/Web/Widget/Graphs.php - - - message: "#^Parameter \\#1 \\$insecure of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setInsecure\\(\\) expects bool, mixed given\\.$#" - count: 1 - path: library/Graphite/Web/Widget/Graphs.php - - - - message: "#^Parameter \\#1 \\$password of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setPassword\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: library/Graphite/Web/Widget/Graphs.php - - - - message: "#^Parameter \\#1 \\$url of static method Icinga\\\\Web\\\\Url\\:\\:fromPath\\(\\) expects string, mixed given\\.$#" - count: 1 - path: library/Graphite/Web/Widget/Graphs.php - - - - message: "#^Parameter \\#1 \\$user of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setUser\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: library/Graphite/Web/Widget/Graphs.php - - message: "#^Part \\$relative \\(mixed\\) of encapsed string cannot be cast to string\\.$#" count: 1