diff --git a/front/config.form.php b/front/config.form.php
index 53c0f22..80ac93b 100644
--- a/front/config.form.php
+++ b/front/config.form.php
@@ -30,4 +30,5 @@
include("../../../inc/includes.php");
+/** @var array $CFG_GLPI */
Html::redirect($CFG_GLPI["root_doc"] . "/front/config.form.php?forcetab=PluginUninstallConfig\$1");
diff --git a/inc/model.class.php b/inc/model.class.php
index d4825d8..fd8b986 100644
--- a/inc/model.class.php
+++ b/inc/model.class.php
@@ -210,7 +210,6 @@ public function showForm($ID, $options = [])
$this->showFormHeader($options);
$entities = (isset($_SESSION['glpiparententities']) ? $_SESSION['glpiparententities'] : 0);
- $entity_sons = empty($entity_sons) ? 0 : 1;
echo "
" . __('Name') . " | ";
echo "";
diff --git a/inc/replace.class.php b/inc/replace.class.php
index 7a577bf..4402818 100644
--- a/inc/replace.class.php
+++ b/inc/replace.class.php
@@ -165,7 +165,7 @@ public static function replace($type, $model_id, $tab_ids, $location)
]);
}
- // General Informations - NAME
+ // General Information - NAME
if ($model->fields["replace_name"]) {
if ($overwrite || empty($newitem->fields['name'])) {
$newitem->update(
@@ -465,8 +465,8 @@ public static function replace($type, $model_id, $tab_ids, $location)
// If old item is attached in PDF/CSV
// Delete AND Purge it in DB
- if ($document_added) {
- $olditem->delete(['id' => $olditem_id], true);
+ if (isset($document_added) && $document_added) {
+ $olditem->delete(['id' => $olditem_id], true);
}
break;
diff --git a/inc/uninstall.class.php b/inc/uninstall.class.php
index 70d60ae..9e8112e 100644
--- a/inc/uninstall.class.php
+++ b/inc/uninstall.class.php
@@ -355,14 +355,14 @@ public static function uninstall($type, $model_id, $tab_ids, $location)
]);
Html::changeProgressBarPosition($count, $tot + 1);
- }
- //Add line in machine's history to say that machine was uninstalled
- self::addUninstallLog([
- 'itemtype' => $type,
- 'items_id' => $id,
- 'models_id' => $model_id,
- ]);
+ //Add line in machine's history to say that machine was uninstalled
+ self::addUninstallLog([
+ 'itemtype' => $type,
+ 'items_id' => $id,
+ 'models_id' => $model_id,
+ ]);
+ }
Html::changeProgressBarPosition($count, $tot, __('Uninstallation successful', 'uninstall'));
@@ -750,8 +750,8 @@ public static function addUninstallLog($params = [])
$changes[0] = 0;
$changes[1] = "";
+ $model = new PluginUninstallModel();
if (isset($params['models_id'])) {
- $model = new PluginUninstallModel();
$model->getConfig($params['models_id']);
}
diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644
index 0000000..8feb506
--- /dev/null
+++ b/phpstan.neon
@@ -0,0 +1,19 @@
+parameters:
+ parallel:
+ maximumNumberOfProcesses: 2
+ level: 1
+ bootstrapFiles:
+ - ../../inc/based_config.php
+ paths:
+ - inc
+ - front
+ - ajax
+ - hook.php
+ - setup.php
+ scanDirectories:
+ - ../../inc
+ - ../../src
+ stubFiles:
+ - ../../stubs/glpi_constants.php
+rules:
+ - GlpiProject\Tools\PHPStan\Rules\GlobalVarTypeRule
|