Skip to content

Commit f4cdeee

Browse files
committed
GraphingTrait: Define config value type
1 parent 254ff35 commit f4cdeee

File tree

2 files changed

+14
-82
lines changed

2 files changed

+14
-82
lines changed

library/Graphite/Graphing/GraphingTrait.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Icinga\Application\Config;
66
use Icinga\Application\Icinga;
7+
use Icinga\Data\ConfigObject;
78
use Icinga\Exception\ConfigurationError;
89
use Icinga\Module\Graphite\Web\FakeSchemeRequest;
910
use Icinga\Web\Url;
@@ -61,6 +62,7 @@ public static function getMetricsDataSource()
6162
{
6263
if (static::$metricsDataSource === null) {
6364
$config = Config::module('graphite');
65+
/** @var ConfigObject<string> $graphite */
6466
$graphite = $config->getSection('graphite');
6567
if (! isset($graphite->url)) {
6668
throw new ConfigurationError('Missing "graphite.url" in "%s"', $config->getConfigFile());
@@ -70,7 +72,7 @@ public static function getMetricsDataSource()
7072
(new GraphiteWebClient(Url::fromPath($graphite->url, [], new FakeSchemeRequest())))
7173
->setUser($graphite->user)
7274
->setPassword($graphite->password)
73-
->setInsecure($graphite->insecure)
75+
->setInsecure((bool) $graphite->insecure)
7476
);
7577
}
7678

phpstan-baseline.neon

Lines changed: 11 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,6 @@ parameters:
1515
count: 1
1616
path: application/clicommands/Icinga2Command.php
1717

18-
-
19-
message: "#^Parameter \\#1 \\$insecure of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setInsecure\\(\\) expects bool, mixed given\\.$#"
20-
count: 1
21-
path: application/clicommands/Icinga2Command.php
22-
23-
-
24-
message: "#^Parameter \\#1 \\$password of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setPassword\\(\\) expects string\\|null, mixed given\\.$#"
25-
count: 1
26-
path: application/clicommands/Icinga2Command.php
27-
28-
-
29-
message: "#^Parameter \\#1 \\$url of static method Icinga\\\\Web\\\\Url\\:\\:fromPath\\(\\) expects string, mixed given\\.$#"
30-
count: 1
31-
path: application/clicommands/Icinga2Command.php
32-
33-
-
34-
message: "#^Parameter \\#1 \\$user of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setUser\\(\\) expects string\\|null, mixed given\\.$#"
35-
count: 1
36-
path: application/clicommands/Icinga2Command.php
37-
3818
-
3919
message: "#^Method Icinga\\\\Module\\\\Graphite\\\\Controllers\\\\ConfigController\\:\\:advancedAction\\(\\) has no return type specified\\.$#"
4020
count: 1
@@ -65,26 +45,6 @@ parameters:
6545
count: 1
6646
path: application/controllers/GraphController.php
6747

68-
-
69-
message: "#^Parameter \\#1 \\$insecure of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setInsecure\\(\\) expects bool, mixed given\\.$#"
70-
count: 1
71-
path: application/controllers/GraphController.php
72-
73-
-
74-
message: "#^Parameter \\#1 \\$password of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setPassword\\(\\) expects string\\|null, mixed given\\.$#"
75-
count: 1
76-
path: application/controllers/GraphController.php
77-
78-
-
79-
message: "#^Parameter \\#1 \\$url of static method Icinga\\\\Web\\\\Url\\:\\:fromPath\\(\\) expects string, mixed given\\.$#"
80-
count: 1
81-
path: application/controllers/GraphController.php
82-
83-
-
84-
message: "#^Parameter \\#1 \\$user of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setUser\\(\\) expects string\\|null, mixed given\\.$#"
85-
count: 1
86-
path: application/controllers/GraphController.php
87-
8848
-
8949
message: "#^Parameter \\#2 \\$checkCommand of method Icinga\\\\Module\\\\Graphite\\\\Controllers\\\\GraphController\\:\\:supplyImage\\(\\) expects string, mixed given\\.$#"
9050
count: 2
@@ -190,26 +150,6 @@ parameters:
190150
count: 1
191151
path: application/controllers/MonitoringGraphController.php
192152

193-
-
194-
message: "#^Parameter \\#1 \\$insecure of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setInsecure\\(\\) expects bool, mixed given\\.$#"
195-
count: 1
196-
path: application/controllers/MonitoringGraphController.php
197-
198-
-
199-
message: "#^Parameter \\#1 \\$password of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setPassword\\(\\) expects string\\|null, mixed given\\.$#"
200-
count: 1
201-
path: application/controllers/MonitoringGraphController.php
202-
203-
-
204-
message: "#^Parameter \\#1 \\$url of static method Icinga\\\\Web\\\\Url\\:\\:fromPath\\(\\) expects string, mixed given\\.$#"
205-
count: 1
206-
path: application/controllers/MonitoringGraphController.php
207-
208-
-
209-
message: "#^Parameter \\#1 \\$user of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setUser\\(\\) expects string\\|null, mixed given\\.$#"
210-
count: 1
211-
path: application/controllers/MonitoringGraphController.php
212-
213153
-
214154
message: "#^Parameter \\#2 \\$host of class Icinga\\\\Module\\\\Monitoring\\\\Object\\\\Host constructor expects string, mixed given\\.$#"
215155
count: 1
@@ -460,6 +400,11 @@ parameters:
460400
count: 2
461401
path: library/Graphite/Graphing/Template.php
462402

403+
-
404+
message: "#^PHPDoc tag @var for variable \\$options contains generic class Icinga\\\\Data\\\\ConfigObject but does not specify its types\\: TValue$#"
405+
count: 1
406+
path: library/Graphite/Graphing/Templates.php
407+
463408
-
464409
message: "#^Parameter \\#1 \\$array of function array_unique expects array, array\\<int, string\\>\\|false given\\.$#"
465410
count: 1
@@ -472,14 +417,19 @@ parameters:
472417

473418
-
474419
message: "#^Parameter \\#1 \\$template of class Icinga\\\\Module\\\\Graphite\\\\Util\\\\MacroTemplate constructor expects string, mixed given\\.$#"
475-
count: 1
420+
count: 4
476421
path: library/Graphite/Graphing/Templates.php
477422

478423
-
479424
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\\.$#"
480425
count: 1
481426
path: library/Graphite/Graphing/Templates.php
482427

428+
-
429+
message: "#^Parameter \\#2 \\$subject of function preg_split expects string, mixed given\\.$#"
430+
count: 1
431+
path: library/Graphite/Graphing/Templates.php
432+
483433
-
484434
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\\>\\.$#"
485435
count: 1
@@ -710,26 +660,6 @@ parameters:
710660
count: 1
711661
path: library/Graphite/Web/Widget/Graphs.php
712662

713-
-
714-
message: "#^Parameter \\#1 \\$insecure of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setInsecure\\(\\) expects bool, mixed given\\.$#"
715-
count: 1
716-
path: library/Graphite/Web/Widget/Graphs.php
717-
718-
-
719-
message: "#^Parameter \\#1 \\$password of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setPassword\\(\\) expects string\\|null, mixed given\\.$#"
720-
count: 1
721-
path: library/Graphite/Web/Widget/Graphs.php
722-
723-
-
724-
message: "#^Parameter \\#1 \\$url of static method Icinga\\\\Web\\\\Url\\:\\:fromPath\\(\\) expects string, mixed given\\.$#"
725-
count: 1
726-
path: library/Graphite/Web/Widget/Graphs.php
727-
728-
-
729-
message: "#^Parameter \\#1 \\$user of method Icinga\\\\Module\\\\Graphite\\\\Graphing\\\\GraphiteWebClient\\:\\:setUser\\(\\) expects string\\|null, mixed given\\.$#"
730-
count: 1
731-
path: library/Graphite/Web/Widget/Graphs.php
732-
733663
-
734664
message: "#^Part \\$relative \\(mixed\\) of encapsed string cannot be cast to string\\.$#"
735665
count: 1

0 commit comments

Comments
 (0)