Skip to content

Commit

Permalink
phpstan lvl 1
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Nov 9, 2023
1 parent 30dffaa commit af1e3b4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
1 change: 1 addition & 0 deletions front/config.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
1 change: 0 additions & 1 deletion inc/model.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<tr class='tab_bg_1'><td>" . __('Name') . "</td>";
echo "<td>";
Expand Down
6 changes: 3 additions & 3 deletions inc/replace.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;

Expand Down
16 changes: 8 additions & 8 deletions inc/uninstall.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand Down Expand Up @@ -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']);
}

Expand Down
19 changes: 19 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit af1e3b4

Please sign in to comment.