Skip to content

Commit 4e256da

Browse files
authored
PHPStan level 5 (#38)
* PHPStan level 5 * deprecated queryOrDie
1 parent be170d0 commit 4e256da

File tree

5 files changed

+124
-25
lines changed

5 files changed

+124
-25
lines changed

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"friendsofphp/php-cs-fixer": "^3.66",
77
"glpi-project/tools": "^0.7.4",
88
"php-parallel-lint/php-parallel-lint": "^1.4",
9+
"phpstan/extension-installer": "^1.4",
910
"phpstan/phpstan": "^2.1",
11+
"phpstan/phpstan-deprecation-rules": "^2.0",
1012
"phpunit/phpunit": "^9.6",
1113
"squizlabs/php_codesniffer": "^3.11"
1214
},
@@ -15,7 +17,10 @@
1517
"platform": {
1618
"php": "7.4.0"
1719
},
18-
"sort-packages": true
20+
"sort-packages": true,
21+
"allow-plugins": {
22+
"phpstan/extension-installer": true
23+
}
1924
},
2025
"autoload": {
2126
"psr-4": {

composer.lock

Lines changed: 114 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function plugin_centreon_install($version)
5757
) ENGINE=InnoDB
5858
DEFAULT CHARSET={$default_charset}
5959
COLLATE={$default_collation}";
60-
$DB->queryOrDie($query, $DB->error());
60+
$DB->doQuery($query);
6161
}
6262
$centreon_password = Config::getConfigurationValue('plugin:centreon', 'centreon-password');
6363
/**Migration to 1.0.1 */

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parameters:
22
parallel:
33
maximumNumberOfProcesses: 2
4-
level: 2
4+
level: 5
55
bootstrapFiles:
66
- ../../inc/based_config.php
77
paths:

src/Config.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ public static function displayTabContentForItem(
6464
$tabnum = 1,
6565
$withtemplate = 0
6666
) {
67-
switch ($item->getType()) {
68-
case \Config::class:
69-
return self::showForConfig($item, $withtemplate);
67+
if ($item instanceof \Config) {
68+
return self::showForConfig($item, $withtemplate);
7069
}
7170

7271
return true;

0 commit comments

Comments
 (0)