Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define config generics #323

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion library/Graphite/Graphing/GraphingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -61,6 +62,7 @@ public static function getMetricsDataSource()
{
if (static::$metricsDataSource === null) {
$config = Config::module('graphite');
/** @var ConfigObject<string> $graphite */
$graphite = $config->getSection('graphite');
if (! isset($graphite->url)) {
throw new ConfigurationError('Missing "graphite.url" in "%s"', $config->getConfigFile());
Expand All @@ -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)
);
}

Expand Down
92 changes: 11 additions & 81 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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\\<int, string\\>\\|false given\\.$#"
count: 1
Expand All @@ -472,14 +417,19 @@ 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

-
message: "#^Parameter \\#1 \\$urlParams of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\Template\\:\\:setUrlParams\\(\\) expects array\\<Icinga\\\\Module\\\\Graphite\\\\Util\\\\MacroTemplate\\>, array\\<Icinga\\\\Module\\\\Graphite\\\\Util\\\\MacroTemplate\\|string\\> given\\.$#"
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\\<Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\Template\\>\\) does not accept array\\<array\\<array\\>\\|Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\Template\\>\\.$#"
count: 1
Expand Down Expand Up @@ -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
Expand Down
Loading