Skip to content

Commit

Permalink
phpstan lvl 1
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Oct 30, 2023
1 parent a1e4395 commit 0bdf5e3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions inc/containerdisplaycondition.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ private static function getItemtypesForContainer(int $container_id): array
{
global $DB;

$results = [];

$iterator = $DB->request([
'SELECT' => ['itemtypes'],
'FROM' => PluginFieldsContainer::getTable(),
Expand All @@ -212,9 +214,9 @@ private static function getItemtypesForContainer(int $container_id): array
foreach ($itemtypes as $itemtype) {
$results[$itemtype] = $itemtype::getTypeName();
}
return $results;
}
return [];

return $results;
}


Expand Down
6 changes: 3 additions & 3 deletions inc/field.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public function prepareInputForAdd($input)

//reject adding for same dropdown on same bloc
if (!empty($found)) {
Session::AddMessageAfterRedirect(__("You cannot add same field 'dropdown' on same bloc", 'fields', false, ERROR));
Session::AddMessageAfterRedirect(__("You cannot add same field 'dropdown' on same bloc", 'fields'), false, ERROR);
return false;
}

Expand Down Expand Up @@ -676,8 +676,8 @@ public function showForm($ID, $options = [])
{
$rand = mt_rand();

$container = new PluginFieldsContainer();
if (isset($options['parent_id']) && !empty($options['parent_id'])) {
$container = new PluginFieldsContainer();
$container->getFromDB($options['parent_id']);
} else if (
isset($options['parent'])
Expand All @@ -697,7 +697,7 @@ public function showForm($ID, $options = [])
}

$this->initForm($ID, $options);
$this->showFormHeader($ID, $options);
$this->showFormHeader($options);

echo "<tr>";
echo "<td>" . __("Label") . " : </td>";
Expand Down
4 changes: 3 additions & 1 deletion inc/inventory.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public static function updateInventory($params = [])
$availaibleItemType = ["Computer","Printer","NetworkEquipment"];
foreach (array_keys($params['inventory_data']) as $itemtype) {
if (in_array($itemtype, $availaibleItemType)) {
//retrive items id switch itemtype
$items_id = 0;
//retrieve items id switch itemtype
switch ($itemtype) {
case Computer::getType():
$items_id = $params['computers_id'];
Expand Down Expand Up @@ -110,6 +111,7 @@ public static function loadXMLFile($itemtype, $items_id)
}

//Check if the file exists with the .xml extension (new format)
/** @phpstan-ignore-next-line */
$file = PLUGIN_FUSIONINVENTORY_XML_DIR . strtolower($itemtype) . "/" . $folder . "/" . $items_id;
if (file_exists($file . '.xml')) {
$file .= '.xml';
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
parallel:
maximumNumberOfProcesses: 2
level: 0
level: 1
bootstrapFiles:
- ../../inc/based_config.php
- setup.php
Expand Down

0 comments on commit 0bdf5e3

Please sign in to comment.