From 1d490672865fd21c8a69632b7a1e4f201e06cd86 Mon Sep 17 00:00:00 2001 From: Lainow Date: Fri, 7 Jun 2024 16:41:58 +0200 Subject: [PATCH] Set params types and remove useless phpstan ignore --- front/info.form.php | 1 - front/mapping.form.php | 1 - front/model.form.php | 2 - hook.php | 6 +- inc/autoupdatesysteminjection.class.php | 4 +- inc/backend.class.php | 8 +- inc/backendcsv.class.php | 16 +-- inc/backendinterface.class.php | 2 +- inc/clientinjection.class.php | 21 +-- inc/commoninjectionlib.class.php | 151 +++++++++----------- inc/computer_iteminjection.class.php | 4 +- inc/contact_supplierinjection.class.php | 4 +- inc/contract_iteminjection.class.php | 4 +- inc/contract_supplierinjection.class.php | 4 +- inc/contractinjection.class.php | 4 +- inc/data.class.php | 4 +- inc/devicecaseinjection.class.php | 6 +- inc/devicecontrolinjection.class.php | 6 +- inc/devicedriveinjection.class.php | 6 +- inc/deviceharddriveinjection.class.php | 6 +- inc/devicememoryinjection.class.php | 6 +- inc/devicemotherboardinjection.class.php | 6 +- inc/devicenetworkcardinjection.class.php | 6 +- inc/deviceprocessorinjection.class.php | 6 +- inc/dropdown.class.php | 4 +- inc/engine.class.php | 16 +-- inc/entityinjection.class.php | 12 +- inc/group_userinjection.class.php | 4 +- inc/info.class.php | 28 ++-- inc/infocollection.class.php | 2 +- inc/infocominjection.class.php | 6 +- inc/injectioninterface.class.php | 22 +-- inc/injectiontype.class.php | 32 ++--- inc/interfacetypeinjection.class.php | 4 +- inc/item_operatingsysteminjection.class.php | 4 +- inc/item_softwarelicenseinjection.class.php | 4 +- inc/item_softwareversioninjection.class.php | 4 +- inc/mapping.class.php | 10 +- inc/mappingcollection.class.php | 14 +- inc/model.class.php | 49 ++++--- inc/modelcsv.class.php | 15 +- inc/monitorinjection.class.php | 4 +- inc/netpointinjection.class.php | 4 +- inc/networkequipmentinjection.class.php | 6 +- inc/networknameinjection.class.php | 10 +- inc/networkport_vlaninjection.class.php | 4 +- inc/networkportinjection.class.php | 31 ++-- inc/notepadinjection.class.php | 4 +- inc/peripheralinjection.class.php | 4 +- inc/phoneinjection.class.php | 4 +- inc/printerinjection.class.php | 6 +- inc/profile.class.php | 22 ++- inc/profile_userinjection.class.php | 4 +- inc/profileinjection.class.php | 6 +- inc/session.class.php | 6 +- inc/softwareinjection.class.php | 2 +- inc/softwarelicenseinjection.class.php | 17 ++- inc/softwareversioninjection.class.php | 17 ++- inc/userinjection.class.php | 19 ++- 59 files changed, 326 insertions(+), 358 deletions(-) diff --git a/front/info.form.php b/front/info.form.php index 1465496..53a5543 100644 --- a/front/info.form.php +++ b/front/info.form.php @@ -44,6 +44,5 @@ } Html::back(); } -/** @phpstan-ignore-next-line */ Session::setActiveTab('PluginDatainjectionModel', 'PluginDatainjectionModel$5'); Html::back(); diff --git a/front/mapping.form.php b/front/mapping.form.php index 953c6bd..f04cec8 100644 --- a/front/mapping.form.php +++ b/front/mapping.form.php @@ -72,7 +72,6 @@ $_POST['models_id'], PluginDatainjectionModel::OTHERS_STEP ); - /** @phpstan-ignore-next-line */ Session::setActiveTab('PluginDatainjectionModel', 'PluginDatainjectionModel$5'); Session::addMessageAfterRedirect( __( diff --git a/front/model.form.php b/front/model.form.php index cf402c8..011a84e 100644 --- a/front/model.form.php +++ b/front/model.form.php @@ -47,7 +47,6 @@ $newID = $model->add($_POST); //Set display to the advanced options tab - /** @phpstan-ignore-next-line */ Session::setActiveTab('PluginDatainjectionModel', 'PluginDatainjectionModel$3'); Html::redirect(Toolbox::getItemTypeFormURL('PluginDatainjectionModel') . "?id=$newID"); } else if (isset($_POST["delete"])) { @@ -81,7 +80,6 @@ ] ) ) { - /** @phpstan-ignore-next-line */ Session::setActiveTab('PluginDatainjectionModel', 'PluginDatainjectionModel$4'); } else { Session::addMessageAfterRedirect( diff --git a/hook.php b/hook.php index a5a9a50..4e448da 100644 --- a/hook.php +++ b/hook.php @@ -1921,8 +1921,8 @@ function plugin_datainjection_update220_230() /** - * @param $hook_name - * @param $params array + * @param string $hook_name + * @param array $params **/ function plugin_datainjection_loadHook($hook_name, $params = []) { @@ -1968,7 +1968,7 @@ function plugin_datainjection_needUpdateOrInstall() /** * Used for filter list of models * - * @param $itemtype + * @param string $itemtype **/ function plugin_datainjection_addDefaultWhere($itemtype) { diff --git a/inc/autoupdatesysteminjection.class.php b/inc/autoupdatesysteminjection.class.php index fdf8f62..6c6a9af 100644 --- a/inc/autoupdatesysteminjection.class.php +++ b/inc/autoupdatesysteminjection.class.php @@ -75,8 +75,8 @@ public function getOptions($primary_type = '') /** * Standard method to add an object into glpi * - * @param $values array fields to add into glpi - * @param $options array options used during creation + * @param array $values array fields to add into glpi + * @param array $options array options used during creation * * @return array of IDs of newly created objects : for example array(Computer=>1, Networkport=>10) **/ diff --git a/inc/backend.class.php b/inc/backend.class.php index c51a9c0..de8584d 100644 --- a/inc/backend.class.php +++ b/inc/backend.class.php @@ -47,12 +47,12 @@ abstract class PluginDatainjectionBackend /** * Get header of the file * - * @param $injectionData - * @param $header_present + * @param PluginDatainjectionData|null $injectionData + * @param boolean $header_present * * @return array with the data from the header **/ - public static function getHeader(PluginDatainjectionData $injectionData, $header_present) + public static function getHeader($injectionData, $header_present) { if ($header_present) { @@ -71,7 +71,7 @@ public static function getHeader(PluginDatainjectionData $injectionData, $header /** * Get the backend implementation by type * - * @param $type + * @param string $type **/ public static function getInstance($type) { diff --git a/inc/backendcsv.class.php b/inc/backendcsv.class.php index 03db5d5..a2a2e3b 100644 --- a/inc/backendcsv.class.php +++ b/inc/backendcsv.class.php @@ -57,7 +57,7 @@ public function isHeaderPresent() /** - * @param $delimiter + * @param string $delimiter **/ public function setDelimiter($delimiter) { @@ -67,7 +67,7 @@ public function setDelimiter($delimiter) /** - * @param $present (true by default) + * @param boolean $present (true by default) **/ public function setHeaderPresent($present = true) { @@ -79,9 +79,9 @@ public function setHeaderPresent($present = true) /** * CSV File parsing methods * - * @param $fic - * @param $data - * @param $encoding (default 1) + * @param mixed $fic + * @param mixed $data + * @param integer $encoding (default 1) **/ public static function parseLine($fic, $data, $encoding = 1) { @@ -124,8 +124,8 @@ public static function parseLine($fic, $data, $encoding = 1) /** - * @param $newfile - * @param $encoding + * @param string $newfile + * @param string $encoding **/ public function init($newfile, $encoding) { @@ -138,7 +138,7 @@ public function init($newfile, $encoding) /** * Read a CSV file and store data in an array * - * @param $numberOfLines inumber of lines to be read (-1 means all file) (default 1) + * @param integer $numberOfLines inumber of lines to be read (-1 means all file) (default 1) **/ public function read($numberOfLines = 1) { diff --git a/inc/backendinterface.class.php b/inc/backendinterface.class.php index ba0c17c..5d36b97 100644 --- a/inc/backendinterface.class.php +++ b/inc/backendinterface.class.php @@ -36,7 +36,7 @@ interface PluginDatainjectionBackendInterface /** * Read from file * - * @param $numberOfLines (default 1) + * @param integer $numberOfLines (default 1) **/ public function read($numberOfLines = 1); diff --git a/inc/clientinjection.class.php b/inc/clientinjection.class.php index 884e23d..e583c31 100644 --- a/inc/clientinjection.class.php +++ b/inc/clientinjection.class.php @@ -39,13 +39,6 @@ class PluginDatainjectionClientInjection //Injection results private $results = []; - //Model used for injection - private $model; /** @phpstan-ignore-line */ - - //Overall injection results - private $global_results; /** @phpstan-ignore-line */ - - /** * Print a good title for group pages * @@ -140,7 +133,7 @@ public function showForm($ID, $options = []) /** - * @param $options array + * @param array $options **/ public static function showUploadFileForm($options = []) { @@ -197,8 +190,8 @@ public static function showUploadFileForm($options = []) /** - * @param $model PluginDatainjectionModel object - * @param $entities_id + * @param PluginDatainjectionModel $model PluginDatainjectionModel object + * @param integer $entities_id **/ public static function showInjectionForm(PluginDatainjectionModel $model, $entities_id) { @@ -228,8 +221,8 @@ public static function showInjectionForm(PluginDatainjectionModel $model, $entit /** - * @param $model PluginDatainjectionModel object - * @param $entities_id + * @param PluginDatainjectionModel $model + * @param integer $entities_id **/ public static function processInjection(PluginDatainjectionModel $model, $entities_id) { @@ -340,7 +333,7 @@ public static function processInjection(PluginDatainjectionModel $model, $entiti * to be used instead of Toolbox::stripslashes_deep to reduce memory usage * execute stripslashes in place (no copy) * - * @param $value array of value + * @param array|null $value array of value */ public static function stripslashes_array(&$value) // phpcs:ignore { @@ -356,7 +349,7 @@ public static function stripslashes_array(&$value) // phpcs:ignore /** - * @param $model PluginDatainjectionModel object + * @param PluginDatainjectionModel $model PluginDatainjectionModel object **/ public static function showResultsForm(PluginDatainjectionModel $model) { diff --git a/inc/commoninjectionlib.class.php b/inc/commoninjectionlib.class.php index 30dd144..6d09d22 100644 --- a/inc/commoninjectionlib.class.php +++ b/inc/commoninjectionlib.class.php @@ -41,9 +41,6 @@ class PluginDatainjectionCommonInjectionLib //Fields mandatory for injection private $mandatory_fields = []; - //List of fields which can agregate more than one value (type multiline_text) - //private $severalvalues_fields = []; - private $optional_infos = []; //Injection class to use @@ -152,10 +149,10 @@ public function setDefaultValues(): void /** * Constructor : store all needed options into the library * - * @param $injectionClass class which represents the itemtype to injection + * @param PluginDatainjectionInjectionInterface $injectionClass class which represents the itemtype to injection * (in 0.80, will be directly the itemtype class) - * @param $values array values to injection into GLPI - * @param $injection_options array options that can be used during the injection + * @param array|null $values array values to injection into GLPI + * @param array|null $injection_options array options that can be used during the injection * (maybe an empty array) * * @return void nothing @@ -219,7 +216,7 @@ public function __construct($injectionClass, $values = [], $injection_options = * Check and add fields for itemtype which depend on other itemtypes * (for example SoftwareLicense needs to be linked to a Software) * - * @param $injectionClass class to use for injection + * @param PluginDatainjectionInjectionInterface $injectionClass class to use for injection **/ public function areTypeMandatoryFieldsOK($injectionClass) { @@ -268,7 +265,7 @@ public function areTypeMandatoryFieldsOK($injectionClass) /** * Check if a field type represents a dropdown or not * - * @param $field_type the type of field + * @param string $field_type the type of field * * @return boolean true if it's a dropdown type, false if not **/ @@ -292,7 +289,7 @@ public static function isFieldADropdown($field_type) /** * Return an the class of an item by giving his injection class * - * @param $injectionClassName the injection class name + * @param string $injectionClassName the injection class name * * @return CommonDBTM instance of the itemtype associated to the injection class name */ @@ -307,7 +304,7 @@ public static function getItemtypeInstanceByInjection($injectionClassName) /** * Get an itemtype name by giving his injection class name * - * @param $injectionClassName the injection class name + * @param string $injectionClassName the injection class name * * @return string the itemtype associated */ @@ -321,7 +318,7 @@ public static function getItemtypeByInjection($injectionClassName) /** * Get an itemtype by giving an injection class object * - * @param $injectionClassName the injection class object + * @param object $injectionClass Name the injection class object * * @return string instance of the itemtype associated to the injection class */ @@ -335,9 +332,9 @@ public static function getItemtypeByInjectionClass($injectionClass) /** * Get an injection class instance for an itemtype * - * @param $itemtype the itemtype + * @param string $itemtype the itemtype * - * @return object the injection class instance + * @return PluginDatainjectionInjectionInterface the injection class instance */ public static function getInjectionClassInstance($itemtype) { @@ -354,7 +351,7 @@ public static function getInjectionClassInstance($itemtype) /** * Add blacklisted fields for an itemtype * - * @param $itemtype the itemtype + * @param string $itemtype the itemtype * * @return array the array of all blacklisted fields */ @@ -423,8 +420,8 @@ public static function getBlacklistedOptions($itemtype) /** * Find and return the right search option * - * @param $options the search options array - * @param $lookfor the search option we're looking for + * @param array $options the search options array + * @param string $lookfor the search option we're looking for * * @return array the search option matching lookfor parameter or false it not found **/ @@ -554,12 +551,12 @@ private function manageFieldValues() /** * Get the ID associated with a value from the CSV file * - * @param $injectionClass - * @param $itemtype itemtype of the values to inject - * @param $searchOption option associated with the field to check - * @param $field the field to check - * @param $value the value coming from the CSV file - * @param $add is insertion (true) or update (false) (true by default) + * @param PluginDatainjectionInjectionInterface|null $injectionClass + * @param string $itemtype itemtype of the values to inject + * @param array $searchOption option associated with the field to check + * @param string $field the field to check + * @param mixed $value the value coming from the CSV file + * @param boolean $add is insertion (true) or update (false) (true by default) * * @return void nothing **/ @@ -688,7 +685,7 @@ private function getFieldValue( /** * Add additional parameters needed for dropdown import * - * @param $itemtype dropdrown's itemtype + * @param string $itemtype dropdrown's itemtype * * @return array with additional options to be added **/ @@ -731,8 +728,8 @@ private function addExternalDropdownParameters($itemtype) /** * Find a user. Look for login OR firstname + lastname OR lastname + firstname * - * @param $value the user to look for - * @param $entity the entity where the user should have right + * @param mixed $value the user to look for + * @param mixed $entity the entity where the user should have right * * @return int|string the user ID if found or '' **/ @@ -746,8 +743,7 @@ private static function findUser($value, $entity) WHERE LOWER(`name`) = '" . strtolower($value) . "' OR (CONCAT(LOWER(`realname`),' ',LOWER(`firstname`)) = '" . strtolower($value) . "' OR CONCAT(LOWER(`firstname`),' ',LOWER(`realname`)) = '" . strtolower($value) . "')"; - /** @phpstan-ignore-next-line */ - $result = $DB->query($sql); // phpcs:ignore + $result = $DB->doQuery($sql); if ($DB->numrows($result) > 0) { //check if user has right on the current entity $ID = $DB->result($result, 0, "id"); @@ -765,8 +761,8 @@ private static function findUser($value, $entity) /** * Find a user. Look for login OR firstname + lastname OR lastname + firstname * - * @param $value the user to look for - * @param $entity the entity where the user should have right + * @param mixed $value the user to look for + * @param mixed $entity the entity where the user should have right * * @return int|string the user ID if found or '' */ @@ -781,8 +777,7 @@ private static function findContact($value, $entity) AND (LOWER(`name`) = '" . strtolower($value) . "' OR (CONCAT(LOWER(`name`),' ',LOWER(`firstname`)) = '" . strtolower($value) . "' OR CONCAT(LOWER(`firstname`),' ',LOWER(`name`)) = '" . strtolower($value) . "'))"; - /** @phpstan-ignore-next-line */ - $result = $DB->query($sql); // phpcs:ignore + $result = $DB->doQuery($sql); if ($DB->numrows($result) > 0) { //check if user has right on the current entity @@ -795,10 +790,10 @@ private static function findContact($value, $entity) /** * Find id for a single type * - * @param $item the ComonDBTM item representing an itemtype - * @param $searchOption searchOption related to the item - * @param $entity the current entity - * @param $value the name of the item for which id must be returned + * @param CommonDBTM $item the CommonDBTM item representing an itemtype + * @param array $searchOption searchOption related to the item + * @param mixed $entity the current entity + * @param mixed $value the name of the item for which id must be returned * * @return int|string the id of the item found **/ @@ -826,8 +821,7 @@ private static function findSingle($item, $searchOption, $entity, $value) } $query .= " AND `" . $searchOption['field'] . "` = '$value'"; - /** @phpstan-ignore-next-line */ - $result = $DB->query($query); // phpcs:ignore + $result = $DB->doQuery($query); if ($DB->numrows($result) > 0) { //check if user has right on the current entity @@ -840,7 +834,7 @@ private static function findSingle($item, $searchOption, $entity, $value) /** * Get values to inject for an itemtype * - * @param $itemtype + * @param string $itemtype * * @return mixed|false an array with all values for this itemtype **/ @@ -857,7 +851,7 @@ public function getValuesForItemtype($itemtype) /** * Get values to inject for an itemtype * - * @param $itemtype + * @param string $itemtype * * @return mixed|false an array with all values for this itemtype **/ @@ -875,7 +869,7 @@ private function getValueByItemtypeAndName($itemtype, $field) /** * Unset a value to inject for an itemtype * - * @param $itemtype + * @param string $itemtype * * @return void nothing **/ @@ -891,10 +885,10 @@ private function unsetValue($itemtype, $field) /** * Set values to inject for an itemtype * - * @param $itemtype - * @param $field name - * @param $value of the field - * @param $fromdb boolean + * @param string $itemtype + * @param string $field name + * @param mixed $value of the field + * @param boolean $fromdb boolean **/ private function setValueForItemtype($itemtype, $field, $value, $fromdb = false) { @@ -931,8 +925,8 @@ private function setValueForItemtype($itemtype, $field, $value, $fromdb = false) /** * Get a template name by giving his ID * - * @param $itemtype the objet's type - * @param $id the template's id + * @param string $itemtype the objet's type + * @param string $name the template's name * * @return string|false name of the template or false is no template found **/ @@ -945,8 +939,7 @@ private static function getTemplateIDByName($itemtype, $name) FROM `" . getTableForItemType($itemtype) . "` WHERE `is_template` = '1' AND `template_name` = '$name'"; - /** @phpstan-ignore-next-line */ - $result = $DB->query($query); // phpcs:ignore + $result = $DB->doQuery($query); if ($DB->numrows($result) > 0) { return $DB->result($result, 0, 'id'); @@ -979,9 +972,7 @@ private function reformatFirstPass() foreach ($data as $field => $value) { if ($value && $value == "NULL") { // TODO: fix this code - // if (isset($option['datatype']) && self::isFieldADropdown($option['displaytype'])) { - /** @phpstan-ignore-next-line */ - if (false) { + if (isset($searchOptions['datatype']) && self::isFieldADropdown($searchOptions['displaytype'])) { $this->values[$itemtype][$field] = self::EMPTY_VALUE; } } @@ -1075,8 +1066,8 @@ private function reformat() * xx,xxx.xx * xxxx,xx * - * @param $value : the float to reformat - * @param $the float format + * @param mixed $value : the float to reformat + * @param mixed $format the float format * * @return float modified as expected in GLPI **/ @@ -1113,7 +1104,7 @@ private static function reformatFloat($value, $format) /** * Reformat date from dd-mm-yyyy to yyyy-mm-dd * - * @param $original_date the original date + * @param string $original_date the original date * * @return string the date reformated, if needed **/ @@ -1160,7 +1151,7 @@ private static function reformatDate($original_date, $date_format) /** * Reformat mac adress if mac doesn't contains : or - as seperator * - * @param $mac the original mac address + * @param string $mac the original mac address * * @return mixed the mac address modified, if needed **/ @@ -1244,7 +1235,7 @@ private function check() /** * Is a value a float ? * - * @param $val the value to check + * @param mixed $val the value to check * * @return boolean true if it's a float, false otherwise */ @@ -1257,7 +1248,7 @@ private function isFloat($val) /** * Is a value an integer ? * - * @param $val the value to check + * @param mixed $val the value to check * * @return boolean true if it's an integer, false otherwise */ @@ -1270,11 +1261,11 @@ private function isInteger($val) /** * Check one data * - * @param $injectionClass the injection class - * @param $option the option associated with the field - * @param $field_name the field name - * @param $data the data to check - * @param $mandatory is the field mandatory + * @param PluginDatainjectionInjectionInterface $injectionClass the injection class + * @param array $option the option associated with the field + * @param string $field_name the field name + * @param mixed $data the data to check + * @param boolean $mandatory is the field mandatory * * @return int the result of the check **/ @@ -1378,8 +1369,8 @@ private function addNecessaryFields() /** * Add fields needed to inject and itemtype * - * @param $injectionClass class which represents the object to inject - * @param $itemtype the itemtype to inject + * @param object $injectionClass class which represents the object to inject + * @param string $itemtype the itemtype to inject * * @return void nothing **/ @@ -1582,10 +1573,10 @@ public function processAddOrUpdate() /** * Perform data injection into GLPI DB * - * @param $injectionClass class which represents the object to inject - * @param $item the CommonDBTM object representing the itemtype to inject - * @param $values the values to inject - * @param $add true to insert an object, false to update an existing object + * @param PluginDatainjectionInjectionInterface $injectionClass class which represents the object to inject + * @param CommonDBTM $item the CommonDBTM object representing the itemtype to inject + * @param mixed $values the values to inject + * @param boolean $add true to insert an object, false to update an existing object * * @return int|string the id of the object added or updated **/ @@ -1768,8 +1759,8 @@ private function manageRelations() /** * Function to check if the data to inject already exists in DB * - * @param $class which represents type to inject - * @param $itemtype the itemtype to inject + * @param object $injectionClass which represents type to inject + * @param string $itemtype the itemtype to inject * * @return void nothing **/ @@ -1920,9 +1911,7 @@ private function dataAlreadyInDB($injectionClass, $itemtype) } $sql .= " WHERE 1 " . $where_entity . " " . $where; } - - /** @phpstan-ignore-next-line */ - $result = $DB->query($sql); // phpcs:ignore + $result = $DB->doQuery($sql); if ($DB->numrows($result) > 0) { $db_fields = $DB->fetchAssoc($result); foreach ($db_fields as $key => $value) { @@ -1940,7 +1929,7 @@ private function dataAlreadyInDB($injectionClass, $itemtype) /** * Add fields coming for a template to the values to be injected * - * @param $itemtype the itemtype to inject + * @param string $itemtype the itemtype to inject * * @return void **/ @@ -1997,8 +1986,8 @@ private function addTemplateFields($itemtype) /** * Log event into the history * - * @param $item the item to log - * @param $add true if it's an add, false if it's an update + * @param object $item the item to log + * @param boolean $add true if it's an add, false if it's an update * * @return void nothing **/ @@ -2022,7 +2011,7 @@ public static function logAddOrUpdate($item, $add = true) /** * Get label associated with an injection action * - * @param $action code as defined in the head of this file + * @param string $action code as defined in the head of this file * * @return string label associated with the code **/ @@ -2044,7 +2033,7 @@ public static function getActionLabel($action) /** * Get label associated with an injection result * - * @param $action code as defined in the head of this file + * @param string|int $type code as defined in the head of this file * * @return string label associated with the code **/ @@ -2215,8 +2204,8 @@ function ($option) use ($linkfield_preserved_option) { /** * Add necessary search options for template management * - * @param $injectionClass the injection class to use - * @param $tab the options tab, as an array (passed as a reference) + * @param PluginDatainjectionInjectionInterface $injectionClass the injection class to use + * @param mixed $tab the options tab, as an array (passed as a reference) * * @return void nothing **/ @@ -2250,7 +2239,7 @@ public static function addTemplateSearchOptions($injectionClass, &$tab) /** * If itemtype injection needs to process things after data is written in DB * - * @param $injectionClass the injection class to use + * @param PluginDatainjectionInjectionInterface $injectionClass the injection class to use * @param $add true if an item is created, false if it's an update * * @return void nothing diff --git a/inc/computer_iteminjection.class.php b/inc/computer_iteminjection.class.php index 348e501..2f2bd74 100644 --- a/inc/computer_iteminjection.class.php +++ b/inc/computer_iteminjection.class.php @@ -115,8 +115,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/contact_supplierinjection.class.php b/inc/contact_supplierinjection.class.php index d8fd60c..5618343 100644 --- a/inc/contact_supplierinjection.class.php +++ b/inc/contact_supplierinjection.class.php @@ -87,8 +87,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/contract_iteminjection.class.php b/inc/contract_iteminjection.class.php index 47ff0a6..84d5d3c 100644 --- a/inc/contract_iteminjection.class.php +++ b/inc/contract_iteminjection.class.php @@ -104,8 +104,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/contract_supplierinjection.class.php b/inc/contract_supplierinjection.class.php index 3142240..c16b3ca 100644 --- a/inc/contract_supplierinjection.class.php +++ b/inc/contract_supplierinjection.class.php @@ -91,8 +91,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/contractinjection.class.php b/inc/contractinjection.class.php index 1a0fc30..f1ac3ef 100644 --- a/inc/contractinjection.class.php +++ b/inc/contractinjection.class.php @@ -122,8 +122,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $info array - * @param $option array + * @param array $info array + * @param array $option array **/ public function showAdditionalInformation($info = [], $option = []) { diff --git a/inc/data.class.php b/inc/data.class.php index edd96cc..14f2f50 100644 --- a/inc/data.class.php +++ b/inc/data.class.php @@ -41,7 +41,7 @@ public function __construct() /** - * @param $newData + * @param mixed $newData **/ public function addToData($newData) { @@ -58,7 +58,7 @@ public function getData() /** - * @param $line_id + * @param integer $line_id **/ public function getDataAtLine($line_id) { diff --git a/inc/devicecaseinjection.class.php b/inc/devicecaseinjection.class.php index 95e8e0c..38af239 100644 --- a/inc/devicecaseinjection.class.php +++ b/inc/devicecaseinjection.class.php @@ -78,9 +78,9 @@ public function getOptions($primary_type = '') /** - * @param $values - * @param $add (true by default) - * @param $rights array + * @param mixed $values + * @param boolean $add (true by default) + * @param array|null $rights array **/ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) { diff --git a/inc/devicecontrolinjection.class.php b/inc/devicecontrolinjection.class.php index 128c4d9..aadfc59 100644 --- a/inc/devicecontrolinjection.class.php +++ b/inc/devicecontrolinjection.class.php @@ -79,9 +79,9 @@ public function getOptions($primary_type = '') /** - * @param $values - * @param $add (true by default) - * @param $rights array + * @param mixed $values + * @param boolean $add (true by default) + * @param array|null $rights array **/ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) { diff --git a/inc/devicedriveinjection.class.php b/inc/devicedriveinjection.class.php index 4bfa74e..e5570eb 100644 --- a/inc/devicedriveinjection.class.php +++ b/inc/devicedriveinjection.class.php @@ -79,9 +79,9 @@ public function getOptions($primary_type = '') /** - * @param $values - * @param $add (true by default) - * @param $rights array + * @param mixed $values + * @param boolean $add (true by default) + * @param array|null $rights array */ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) { diff --git a/inc/deviceharddriveinjection.class.php b/inc/deviceharddriveinjection.class.php index 843ebc3..c9545c9 100644 --- a/inc/deviceharddriveinjection.class.php +++ b/inc/deviceharddriveinjection.class.php @@ -78,9 +78,9 @@ public function getOptions($primary_type = '') /** - * @param $values - * @param $add (true by default) - * @param $rights array + * @param mixed $values + * @param boolean $add (true by default) + * @param array|null $rights array */ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) { diff --git a/inc/devicememoryinjection.class.php b/inc/devicememoryinjection.class.php index 4908648..7027dbd 100644 --- a/inc/devicememoryinjection.class.php +++ b/inc/devicememoryinjection.class.php @@ -78,9 +78,9 @@ public function getOptions($primary_type = '') /** - * @param $values - * @param $add (true by default) - * @param $rights array + * @param mixed $values + * @param boolean $add (true by default) + * @param array|null $rights array **/ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) { diff --git a/inc/devicemotherboardinjection.class.php b/inc/devicemotherboardinjection.class.php index 32f2ba7..9e7784f 100644 --- a/inc/devicemotherboardinjection.class.php +++ b/inc/devicemotherboardinjection.class.php @@ -78,9 +78,9 @@ public function getOptions($primary_type = '') /** - * @param $values - * @param $add (true by default) - * @param $rights array + * @param mixed $values + * @param boolean $add (true by default) + * @param array|null $rights array */ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) { diff --git a/inc/devicenetworkcardinjection.class.php b/inc/devicenetworkcardinjection.class.php index b8fefb1..fb89935 100644 --- a/inc/devicenetworkcardinjection.class.php +++ b/inc/devicenetworkcardinjection.class.php @@ -78,9 +78,9 @@ public function getOptions($primary_type = '') /** - * @param $values - * @param $add (true by default) - * @param $rights array + * @param mixed $values + * @param boolean $add (true by default) + * @param array|null $rights array */ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) { diff --git a/inc/deviceprocessorinjection.class.php b/inc/deviceprocessorinjection.class.php index 51f77af..abdf4ea 100644 --- a/inc/deviceprocessorinjection.class.php +++ b/inc/deviceprocessorinjection.class.php @@ -78,9 +78,9 @@ public function getOptions($primary_type = '') /** - * @param $values - * @param $add (true by default) - * @param $rights array + * @param mixed $values + * @param boolean $add (true by default) + * @param array|null $rights array **/ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) { diff --git a/inc/dropdown.class.php b/inc/dropdown.class.php index 874b182..47d4fad 100644 --- a/inc/dropdown.class.php +++ b/inc/dropdown.class.php @@ -70,7 +70,7 @@ public static function floatFormats() /** - * @param $format + * @param string $format **/ public static function getFloatFormat($format) { @@ -157,7 +157,7 @@ public static function portUnicityValues() /** - * @param $value + * @param mixed $value **/ public static function getPortUnicityValues($value) { diff --git a/inc/engine.class.php b/inc/engine.class.php index ac03bec..0eb4cb7 100644 --- a/inc/engine.class.php +++ b/inc/engine.class.php @@ -44,9 +44,9 @@ class PluginDatainjectionEngine /** - * @param $model - * @param $infos array - * @param $entity (default 0) + * @param mixed $model + * @param array $infos array + * @param mixed $entity (default 0) */ public function __construct($model, $infos = [], $entity = 0) { @@ -66,8 +66,8 @@ public function __construct($model, $infos = [], $entity = 0) /** * Inject one line of data * - * @param $line one line of data to import - * @param $index the line number is the file + * @param mixed $line one line of data to import + * @param int $index the line number is the file **/ public function injectLine($line, $index) { @@ -155,7 +155,7 @@ public function injectLine($line, $index) //Add injected line number to the result array $results['line'] = $index; - if ($results['status'] != PluginDatainjectionCommonInjectionLib::SUCCESS) { /** @phpstan-ignore-line */ + if ($results['status'] != PluginDatainjectionCommonInjectionLib::SUCCESS) { $this->error_lines[] = $line; } return $results; @@ -165,8 +165,8 @@ public function injectLine($line, $index) /** * Add fields needed for injection * - * @param $itemtype the itemtype to inject - * @param $fields_toinject array the list of fields representing the object + * @param string $itemtype the itemtype to inject + * @param array $fields_toinject array the list of fields representing the object * * @return void nothing */ diff --git a/inc/entityinjection.class.php b/inc/entityinjection.class.php index 678679e..1c4a2db 100644 --- a/inc/entityinjection.class.php +++ b/inc/entityinjection.class.php @@ -101,9 +101,9 @@ public static function getRootEntityName() /** - * @param $input array - * @param $add (true by default) - * @param $rights array + * @param array $input array + * @param boolean $add (true by default) + * @param array|null $rights array **/ public function customimport($input = [], $add = true, $rights = []) { @@ -203,9 +203,9 @@ public function updateExistingEntity($id, $input) /** - * @param $injectionClass - * @param $values - * @param $options + * @param PluginDatainjectionInjectionInterface $injectionClass + * @param mixed $values + * @param array $options **/ public function customDataAlreadyInDB($injectionClass, $values, $options) { diff --git a/inc/group_userinjection.class.php b/inc/group_userinjection.class.php index 68c1cc5..a60293e 100644 --- a/inc/group_userinjection.class.php +++ b/inc/group_userinjection.class.php @@ -103,8 +103,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/info.class.php b/inc/info.class.php index a18735c..54dd305 100644 --- a/inc/info.class.php +++ b/inc/info.class.php @@ -68,8 +68,8 @@ public function getInfosType() } /** - * @param $model PluginDatainjectionModel object - * @param $canedit (false by default) + * @param PluginDatainjectionModel $model PluginDatainjectionModel object + * @param boolean $canedit (false by default) **/ public static function showAddInfo(PluginDatainjectionModel $model, $canedit = false) { @@ -199,8 +199,8 @@ public static function showFormInfos(PluginDatainjectionModel $model) /** - * @param $models_id - * @param $infos array + * @param int $models_id + * @param array $infos array **/ public static function manageInfos($models_id, $infos = []) { @@ -240,7 +240,7 @@ public static function manageInfos($models_id, $infos = []) /** - * @param $model PluginDatainjectionModel object + * @param PluginDatainjectionModel $model PluginDatainjectionModel object **/ public static function showAdditionalInformationsForm(PluginDatainjectionModel $model) { @@ -308,8 +308,8 @@ public static function showAdditionalInformationsForm(PluginDatainjectionModel $ /** - * @param $info PluginDatainjectionInfo object - * @param $values array + * @param PluginDatainjectionInfo $info PluginDatainjectionInfo object + * @param mixed $values array */ public static function displayAdditionalInformation(PluginDatainjectionInfo $info, $values = []) { @@ -332,9 +332,9 @@ public static function displayAdditionalInformation(PluginDatainjectionInfo $inf /** * Display command additional informations * - * @param $info - * @param $option - * @param $injectionClass + * @param PluginDatainjectionInfo $info + * @param array $option + * @param PluginDatainjectionInjectionInterface $injectionClass * * @return void */ @@ -443,8 +443,8 @@ public static function showAdditionalInformation( /** - * @param $info PluginDatainjectionInfo object - * @param $value + * @param PluginDatainjectionInfo $info PluginDatainjectionInfo object + * @param mixed $value **/ public static function keepInfo(PluginDatainjectionInfo $info, $value) { @@ -480,8 +480,8 @@ public static function keepInfo(PluginDatainjectionInfo $info, $value) /** - * @param $name - * @param $table + * @param string $name + * @param string $table **/ public static function dropdownTemplates($name, $table) { diff --git a/inc/infocollection.class.php b/inc/infocollection.class.php index 4cfec86..266620f 100644 --- a/inc/infocollection.class.php +++ b/inc/infocollection.class.php @@ -45,7 +45,7 @@ public function __construct() /** * Load all the mappings for a specified model * - * @param $model_id the model ID + * @param integer $models_id the model ID **/ public function load($models_id) { diff --git a/inc/infocominjection.class.php b/inc/infocominjection.class.php index a4947e9..bb8b61f 100644 --- a/inc/infocominjection.class.php +++ b/inc/infocominjection.class.php @@ -124,8 +124,8 @@ public function getOptions($primary_type = '') /** - * @param $info array - * @param $option array + * @param array $info array + * @param array $option array **/ public function showAdditionalInformation($info = [], $option = []) { @@ -148,7 +148,7 @@ public function showAdditionalInformation($info = [], $option = []) /** - * @param $values array + * @param mixed $values array **/ public function reformat(&$values = []) { diff --git a/inc/injectioninterface.class.php b/inc/injectioninterface.class.php index 706267c..875acc2 100644 --- a/inc/injectioninterface.class.php +++ b/inc/injectioninterface.class.php @@ -56,7 +56,7 @@ public function connectedTo(); /** * Function which calls getSearchOptions and add more parameters specific to display * - * @param $primary_type (default '') + * @param mixed $primary_type (default '') * * @return array of search options, as defined in each commondbtm object **/ @@ -66,7 +66,7 @@ public function getOptions($primary_type = ''); /** * Manage display of additional informations * - * @param $info array which contains the additional information values + * @param array $info array which contains the additional information values * * This method is optionnal ! Implement it if the itemtype to display special information **/ @@ -76,8 +76,8 @@ public function getOptions($primary_type = ''); /** * Standard method to add an object into glpi * - * @param $values array fields to add into glpi - * @param $options array options used during creation + * @param mixed $values array fields to add into glpi + * @param array $options array options used during creation * * @return array of IDs of newly created objects: * for example array(Computer=>1, Networkport=>10) @@ -90,7 +90,7 @@ public function addOrUpdateObject($values = [], $options = []); * Check values to inject * This method is optionnal ! Implement it if the itemtype need special checks * - * @param $fields_name field to add to glpi + * @param array $fields_name field to add to glpi * @param $data value to add * @param $mandatory is this value mandatory or not ? * @@ -103,7 +103,7 @@ public function addOrUpdateObject($values = [], $options = []); * Reformat data if itemtypes needs it * This method is optionnal ! Implement it if the itemtype need special reformat * - * @param $values array + * @param mixed $values array **/ //function reformat(&$values=[]); @@ -111,8 +111,8 @@ public function addOrUpdateObject($values = [], $options = []); /** * Add itemtype specific checks to see if object is already in DB or not * - * @param $fields_toinject array the fields to be injected into GLPI DB - * @param $options array more informations needed + * @param array $fields_toinject array the fields to be injected into GLPI DB + * @param array $options array more informations needed * **/ //function checkPresent($fields_toinject=[], $options=[]); @@ -122,10 +122,10 @@ public function addOrUpdateObject($values = [], $options = []); * Get value for a field (for example specific dropdowns for an itemtype) * This method is optionnal ! Implement it if the itemtype need special field values * - * @param $itemtype - * @param $searchOption + * @param string $itemtype + * @param array $searchOption * @pram $field - * @param $value + * @param mixed $value **/ //function getSpecificFieldValue($itemtype, $searchOption, $field, $value); diff --git a/inc/injectiontype.class.php b/inc/injectiontype.class.php index 14685f2..7a6594b 100644 --- a/inc/injectiontype.class.php +++ b/inc/injectiontype.class.php @@ -36,7 +36,7 @@ class PluginDatainjectionInjectionType /** * Return all injectable types * - * @param $only_primary return only primary types (false by default) + * @param boolean $only_primary return only primary types (false by default) * * @return array which contains array(itemtype => itemtype name) **/ @@ -50,14 +50,14 @@ public static function getItemtypes($only_primary = false) $plugin = new Plugin(); $values = []; foreach ($INJECTABLE_TYPES as $type => $from) { - $injectionclass = new $type(); + $injectionclass = (object) new $type(); if ( class_exists($type) && (!$only_primary - || ($only_primary && $injectionclass->isPrimaryType()))/** @phpstan-ignore-line */ + || ($injectionclass->isPrimaryType())) ) { - $instance = new $type(); + $instance = (object) new $type(); //If user has no right to create an object of this type, do not display type in the list if (!$instance->canCreate()) { continue; @@ -80,8 +80,8 @@ class_exists($type) /** * Display a list of all importable types using datainjection plugin * - * @param $value the selected value (default '') - * @param $only_primary (false by default) + * @param mixed $value the selected value (default '') + * @param boolean $only_primary (false by default) **/ public static function dropdown($value = '', $only_primary = false) { @@ -97,12 +97,12 @@ public static function dropdown($value = '', $only_primary = false) /** * Get all types linked with a primary type * - * @param $mapping_or_info - * @param $options array + * @param mixed $mapping_or_info + * @param array $options array **/ public static function dropdownLinkedTypes($mapping_or_info, $options = []) { - /** @var array $INJECTABLE_TYPES */ + /** @var array[mixed] $INJECTABLE_TYPES */ /** @var array $CFG_GLPI */ global $INJECTABLE_TYPES, $CFG_GLPI; @@ -167,7 +167,7 @@ public static function dropdownLinkedTypes($mapping_or_info, $options = []) /** - * @param $options array + * @param array $options array **/ public static function dropdownFields($options = []) { @@ -258,8 +258,8 @@ public static function dropdownFields($options = []) /** * Incidates if the name given corresponds to the current searchOption * - * @param $option array the current searchOption (field definition) - * @param $mapping + * @param array $option array the current searchOption (field definition) + * @param array $mapping * * @return boolean the value matches the searchOption or not **/ @@ -287,8 +287,8 @@ public static function isEqual($option, $mapping) /** - * @param $name - * @param $option array + * @param string $name + * @param array $option array **/ public static function testBasicEqual($name, $option = []) { @@ -306,7 +306,7 @@ public static function testBasicEqual($name, $option = []) /** - * @param $options array + * @param array $options array **/ public static function showMandatoryCheckbox($options = []) { @@ -340,7 +340,7 @@ public static function showMandatoryCheckbox($options = []) /** - * @param $options array + * @param array $options array **/ public static function getUsedMappingsOrInfos($options = []) { diff --git a/inc/interfacetypeinjection.class.php b/inc/interfacetypeinjection.class.php index 668f086..ff3848d 100644 --- a/inc/interfacetypeinjection.class.php +++ b/inc/interfacetypeinjection.class.php @@ -77,8 +77,8 @@ public function getOptions($primary_type = '') /** * Standard method to add an object into glpi * - * @param $values array fields to add into glpi - * @param $options array options used during creation + * @param mixed $values array fields to add into glpi + * @param array $options array options used during creation * * @return array of IDs of newly created objects: * for example array(Computer=>1, Networkport=>10) diff --git a/inc/item_operatingsysteminjection.class.php b/inc/item_operatingsysteminjection.class.php index feea25e..d722699 100644 --- a/inc/item_operatingsysteminjection.class.php +++ b/inc/item_operatingsysteminjection.class.php @@ -123,8 +123,8 @@ public function customDataAlreadyInDB($injectionClass, $values, $options) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/item_softwarelicenseinjection.class.php b/inc/item_softwarelicenseinjection.class.php index 148e9c0..ebdd3f9 100644 --- a/inc/item_softwarelicenseinjection.class.php +++ b/inc/item_softwarelicenseinjection.class.php @@ -129,8 +129,8 @@ public function addSpecificMandatoryFields() /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/item_softwareversioninjection.class.php b/inc/item_softwareversioninjection.class.php index 1f9cc5e..ad2a94a 100644 --- a/inc/item_softwareversioninjection.class.php +++ b/inc/item_softwareversioninjection.class.php @@ -131,8 +131,8 @@ public function addSpecificMandatoryFields() /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) diff --git a/inc/mapping.class.php b/inc/mapping.class.php index c8cf536..e4910c4 100644 --- a/inc/mapping.class.php +++ b/inc/mapping.class.php @@ -33,8 +33,8 @@ class PluginDatainjectionMapping extends CommonDBTM public static $rightname = "plugin_datainjection_model"; /** - * @param $field - * @param $value + * @param string $field + * @param mixed $value **/ public function equal($field, $value) { @@ -94,7 +94,7 @@ public function getItemtype() /** - * @param $model PluginDatainjectionModel object + * @param PluginDatainjectionModel $model PluginDatainjectionModel object **/ public static function showFormMappings(PluginDatainjectionModel $model) { @@ -163,7 +163,7 @@ public static function showFormMappings(PluginDatainjectionModel $model) /** * For multitext only ! Check it there's more than one value to inject in a field * - * @param $models_id the model ID + * @param int $models_id the model ID * * @return array true if more than one value to inject, false if not **/ @@ -189,7 +189,7 @@ public static function getSeveralMappedField($models_id) /** - * @param $models_id + * @param int $models_id **/ public static function getMappingsSortedByRank($models_id) { diff --git a/inc/mappingcollection.class.php b/inc/mappingcollection.class.php index b92dfaa..0a9dfff 100644 --- a/inc/mappingcollection.class.php +++ b/inc/mappingcollection.class.php @@ -43,7 +43,7 @@ public function __construct() /** * Load all the mappings for a specified model * - * @param $model_ids the model ID + * @param int $models_id the model ID **/ public function load($models_id) { @@ -82,7 +82,7 @@ public function getAllMappings() /** * Get a PluginDatainjectionMapping by giving the mapping name * - * @param $name + * @param string $name * * @return PluginDatainjectionMapping the PluginDatainjectionMapping object associated or null **/ @@ -96,7 +96,7 @@ public function getMappingByName($name) /** * Get a PluginDatainjectionMapping by giving the mapping rank * - * @param $rank + * @param int $rank * * @return PluginDatainjectionMapping the PluginDatainjectionMapping object associated or null **/ @@ -110,8 +110,8 @@ public function getMappingByRank($rank) /** * Find a mapping by looking for a specific field * - * @param $field the field to look for - * @param $value the value of the field + * @param string $field the field to look for + * @param mixed $value the value of the field * * @return PluginDatainjectionMapping|null the PluginDatainjectionMapping object associated or null **/ @@ -160,7 +160,7 @@ public function deleteMappingsFromDB($model_id) /** * Add a new mapping to this model (don't write in to DB) * - * @param $mapping the new PluginDatainjectionMapping to add + * @param mixed $mapping the new PluginDatainjectionMapping to add **/ public function addNewMapping($mapping) { @@ -172,7 +172,7 @@ public function addNewMapping($mapping) /** * Replace all the mappings for a model * - * @param $mappins the array of PluginDatainjectionMapping objects + * @param array $mappings the array of PluginDatainjectionMapping objects **/ public function replaceMappings($mappings) { diff --git a/inc/model.class.php b/inc/model.class.php index 7af02cb..f01f6da 100644 --- a/inc/model.class.php +++ b/inc/model.class.php @@ -270,7 +270,7 @@ public function getSpecificModel() /** - * @param $options array + * @param array $options array * * @return boolean **/ @@ -342,10 +342,10 @@ public static function dropdown($options = []) /** - * @param $user_id - * @param $order (default 'name') - * @param $entity (default -1) - * @param $all (false by default) + * @param int $user_id + * @param string $order (default 'name') + * @param mixed $entity (default -1) + * @param boolean $all (false by default) **/ public static function getModels($user_id, $order = "name", $entity = -1, $all = false) { @@ -529,9 +529,9 @@ public function rawSearchOptions() /** * @since version 2.3.0 * - * @param $field - * @param $values - * @param $options array + * @param string $field + * @param mixed $values + * @param array $options array **/ public static function getSpecificValueToDisplay($field, $values, array $options = []) { @@ -559,10 +559,10 @@ public static function getSpecificValueToDisplay($field, $values, array $options /** * @since version 2.3.0 * - * @param $field - * @param $name (default '') - * @param $values (defaut '') - * @param $options array + * @param string $field + * @param string $name (default '') + * @param mixed $values (defaut '') + * @param array $options array **/ public static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = []) { @@ -808,8 +808,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) $tabs[3] = __('File to inject', 'datainjection'); } $tabs[4] = __('Mappings', 'datainjection'); - /** @phpstan-ignore-next-line */ - if ($item->fields['step'] > self::MAPPING_STEP) { + if ($item->fields['step'] > self::MAPPING_STEP) { /** @phpstan-ignore-line */ $tabs[5] = __('Additional Information', 'datainjection'); if ($canedit && $item->fields['step'] != self::READY_TO_USE_STEP) { /** @phpstan-ignore-line */ $tabs[6] = __('Validation'); @@ -882,7 +881,7 @@ public function cleanDBonPurge() /** * Clean all model which match some criteria * - * @param $crit array of criteria (ex array('itemtype'=>'PluginAppliancesAppliance')) + * @param array $crit array of criteria (ex array('itemtype'=>'PluginAppliancesAppliance')) **/ public static function clean($crit = []) { @@ -901,8 +900,8 @@ public static function clean($crit = []) /** - * @param $models_id - * @param $step + * @param int $models_id + * @param mixed $step **/ public static function changeStep($models_id, $step) { @@ -975,7 +974,7 @@ public function prepareInputForUpdate($input) /** * Get the backend implementation by type * - * @param $type + * @param string $type **/ public static function getInstance($type) { @@ -1000,7 +999,7 @@ public static function getInstanceByModelID($models_id) /** - * @param $options array + * @param array $options array **/ public function readUploadedFile($options = []) { @@ -1090,7 +1089,7 @@ public function loadSpecificModel() /** * Once file is uploaded, process it * - * @param $options array of possible options: + * @param array $options array of possible options: * - file_encoding * - mode * @@ -1276,7 +1275,7 @@ public function isFileCorrect() /** - * @param $fields + * @param array $fields **/ public function checkMandatoryFields($fields) { @@ -1329,7 +1328,7 @@ public function populateSeveraltimesMappedFields() /** - * @param $models_id + * @param int $models_id **/ public static function checkRightOnModel($models_id) { @@ -1377,7 +1376,7 @@ public static function cleanSessionVariables() /** - * @param $models_id + * @param int $models_id **/ public static function showPreviewMappings($models_id) { @@ -1419,7 +1418,7 @@ public static function showPreviewMappings($models_id) /** - * @param $models_id + * @param int $models_id **/ public static function prepareLogResults($models_id) { @@ -1504,7 +1503,7 @@ public static function prepareLogResults($models_id) /** - * @param $models_id + * @param int $models_id **/ public static function showLogResults($models_id) { diff --git a/inc/modelcsv.class.php b/inc/modelcsv.class.php index f914ee4..c8a60fc 100644 --- a/inc/modelcsv.class.php +++ b/inc/modelcsv.class.php @@ -82,7 +82,7 @@ public function haveSample() /** * Display Sample * - * @param $model PluginDatainjectionModel object + * @param PluginDatainjectionModel $model PluginDatainjectionModel object **/ public function showSample(PluginDatainjectionModel $model) { @@ -110,7 +110,7 @@ public function showSample(PluginDatainjectionModel $model) /** * Check if filename ends with .csv * - * @param $filename the filename + * @param string $filename the filename * * @return boolean true if name is correct, false is not **/ @@ -125,7 +125,7 @@ public function checkFileName($filename) * Get CSV's specific ID for a model * If row doesn't exists, it creates it * - * @param $models_id the model ID + * @param int $models_id the model ID * * @return int the ID of the row in glpi_plugin_datainjection_modelcsv **/ @@ -138,8 +138,7 @@ public function getFromDBByModelID($models_id) FROM `" . $this->getTable() . "` WHERE `models_id` = '" . $models_id . "'"; - /** @phpstan-ignore-next-line */ - $results = $DB->query($query); // phpcs:ignore + $results = $DB->doQuery($query); $id = 0; if ($DB->numrows($results) > 0) { @@ -158,8 +157,8 @@ public function getFromDBByModelID($models_id) /** - * @param $model PluginDatainjectionModel object - * @param $options array + * @param PluginDatainjectionModel $model PluginDatainjectionModel object + * @param array $options array **/ public function showAdditionnalForm(PluginDatainjectionModel $model, $options = []) { @@ -182,7 +181,7 @@ public function showAdditionnalForm(PluginDatainjectionModel $model, $options = /** - * @param $fields + * @param array $fields **/ public function saveFields($fields) { diff --git a/inc/monitorinjection.class.php b/inc/monitorinjection.class.php index d93f6fd..8afee2c 100644 --- a/inc/monitorinjection.class.php +++ b/inc/monitorinjection.class.php @@ -97,8 +97,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/netpointinjection.class.php b/inc/netpointinjection.class.php index 915aa3f..506958d 100644 --- a/inc/netpointinjection.class.php +++ b/inc/netpointinjection.class.php @@ -96,8 +96,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/networkequipmentinjection.class.php b/inc/networkequipmentinjection.class.php index 438a120..00197d3 100644 --- a/inc/networkequipmentinjection.class.php +++ b/inc/networkequipmentinjection.class.php @@ -109,9 +109,9 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $values - * @param $add (true by default) - * @param $rights array + * @param mixed $values + * @param boolean $add (true by default) + * @param array|null $rights array */ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) { diff --git a/inc/networknameinjection.class.php b/inc/networknameinjection.class.php index 5fc14d5..c06f425 100644 --- a/inc/networknameinjection.class.php +++ b/inc/networknameinjection.class.php @@ -89,8 +89,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { @@ -103,9 +103,9 @@ public function addSpecificNeededFields($primary_type, $values) /** - * @param $values - * @param $add (true by default) - * @param $rights array + * @param mixed $values + * @param boolean $add (true by default) + * @param array|null $rights array */ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) { diff --git a/inc/networkport_vlaninjection.class.php b/inc/networkport_vlaninjection.class.php index 6eed470..df659e7 100644 --- a/inc/networkport_vlaninjection.class.php +++ b/inc/networkport_vlaninjection.class.php @@ -88,8 +88,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/networkportinjection.class.php b/inc/networkportinjection.class.php index 8946f12..679288a 100644 --- a/inc/networkportinjection.class.php +++ b/inc/networkportinjection.class.php @@ -121,8 +121,8 @@ public function getOptions($primary_type = '') /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { @@ -137,8 +137,8 @@ public function addSpecificNeededFields($primary_type, $values) /** - * @param $info array - * @param $option array + * @param array $info array + * @param array $option array **/ public function showAdditionalInformation($info = [], $option = []) { @@ -180,8 +180,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $fields_toinject array - * @param $options array + * @param array $fields_toinject array + * @param array $options array **/ public function checkPresent($fields_toinject = [], $options = []) { @@ -191,8 +191,8 @@ public function checkPresent($fields_toinject = [], $options = []) /** - * @param $fields_toinject - * @param $options + * @param array $fields_toinject + * @param array $options **/ public function checkParameters($fields_toinject, $options) { @@ -241,8 +241,8 @@ public function checkParameters($fields_toinject, $options) /** * Build where sql request to look for a network port * - * @param $fields_toinject array the fields to insert into DB - * @param $options array + * @param array $fields_toinject array the fields to insert into DB + * @param array $options array * * @return string the sql where clause **/ @@ -298,7 +298,7 @@ public function getUnicityRequest($fields_toinject = [], $options = []) /** * Check if at least mac or ip is defined otherwise block import * - * @param $values array the values to inject + * @param mixed $values array the values to inject * * @return boolean true if check ok, false if not ok **/ @@ -318,9 +318,9 @@ public function lastCheck($values = []) /** - * @param $values - * @param $add (true by default) - * @param $rights array + * @param mixed $values + * @param boolean $add (true by default) + * @param array|null $rights array **/ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) { @@ -356,8 +356,7 @@ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) if ($use_mac) { $sql .= " AND `glpi_networkports`.`mac` = '" . $values['NetworkPort']["netmac"] . "'"; } - /** @phpstan-ignore-next-line */ - $res = $DB->query($sql); // phpcs:ignore + $res = $DB->doQuery($sql); //if at least one parameter is given $nb = $DB->numrows($res); diff --git a/inc/notepadinjection.class.php b/inc/notepadinjection.class.php index dc4cfca..0c0cc5d 100644 --- a/inc/notepadinjection.class.php +++ b/inc/notepadinjection.class.php @@ -101,8 +101,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/peripheralinjection.class.php b/inc/peripheralinjection.class.php index 9c18002..3007886 100644 --- a/inc/peripheralinjection.class.php +++ b/inc/peripheralinjection.class.php @@ -95,8 +95,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/phoneinjection.class.php b/inc/phoneinjection.class.php index edf020c..033b893 100644 --- a/inc/phoneinjection.class.php +++ b/inc/phoneinjection.class.php @@ -96,8 +96,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/printerinjection.class.php b/inc/printerinjection.class.php index f972c5d..2c4cd14 100644 --- a/inc/printerinjection.class.php +++ b/inc/printerinjection.class.php @@ -98,8 +98,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { @@ -119,7 +119,7 @@ public function addSpecificNeededFields($primary_type, $values) /** * Play printers dictionnary * - * @param $values + * @param mixed $values **/ public function processDictionnariesIfNeeded(&$values) { diff --git a/inc/profile.class.php b/inc/profile.class.php index 48290bf..9147454 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -52,7 +52,7 @@ public static function getAllRights() /** * Clean profiles_id from plugin's profile table * - * @param $ID + * @param int $ID **/ public function cleanProfiles($ID) { @@ -61,16 +61,14 @@ public function cleanProfiles($ID) $query = "DELETE FROM `glpi_profiles` WHERE `profiles_id`='$ID' AND `name` LIKE '%plugin_datainjection%'"; - /** @phpstan-ignore-next-line */ - $DB->query($query); // phpcs:ignore + $DB->doQuery($query); } public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if ($item->getType() == 'Profile') { - /** @phpstan-ignore-next-line */ - if ($item->getField('interface') == 'central') { + if ($item->getField('interface') == 'central') { /** @phpstan-ignore-line */ return __('Data injection', 'datainjection'); } return ''; @@ -84,12 +82,10 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ if ($item->getType() == 'Profile') { $profile = new self(); - /** @phpstan-ignore-next-line */ - $ID = $item->getField('id'); + $ID = $item->getField('id'); /** @phpstan-ignore-line */ //In case there's no right datainjection for this profile, create it self::addDefaultProfileInfos( - /** @phpstan-ignore-next-line */ - $item->getID(), + $item->getID(), /** @phpstan-ignore-line */ ['plugin_datainjection_model' => 0] ); $profile->showForm($ID); @@ -98,7 +94,8 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ } /** - * @param $profile + * @param int $profiles_id + * @param mixed $rights **/ public static function addDefaultProfileInfos($profiles_id, $rights) { @@ -123,7 +120,7 @@ public static function addDefaultProfileInfos($profiles_id, $rights) } /** - * @param $ID integer + * @param int $profiles_id integer */ public static function createFirstAccess($profiles_id) { @@ -150,8 +147,7 @@ public static function migrateProfiles() $profiles = getAllDataFromTable('glpi_plugin_datainjection_profiles'); foreach ($profiles as $id => $profile) { $query = "SELECT `id` FROM `glpi_profiles` WHERE `name`='" . $profile['name'] . "'"; - /** @phpstan-ignore-next-line */ - $result = $DB->query($query); // phpcs:ignore + $result = $DB->doQuery($query); if ($DB->numrows($result) == 1) { $id = $DB->result($result, 0, 'id'); switch ($profile['model']) { diff --git a/inc/profile_userinjection.class.php b/inc/profile_userinjection.class.php index fbd29ec..becd93f 100644 --- a/inc/profile_userinjection.class.php +++ b/inc/profile_userinjection.class.php @@ -97,8 +97,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { diff --git a/inc/profileinjection.class.php b/inc/profileinjection.class.php index 4cdd952..ee88caf 100644 --- a/inc/profileinjection.class.php +++ b/inc/profileinjection.class.php @@ -67,9 +67,9 @@ public function getOptions($primary_type = '') /** - * @param $field_name - * @param $data - * @param $mandatory + * @param string $field_name + * @param mixed $data + * @param mixed $mandatory **/ public function checkType($field_name, $data, $mandatory) { diff --git a/inc/session.class.php b/inc/session.class.php index bbd62ab..8a42b67 100644 --- a/inc/session.class.php +++ b/inc/session.class.php @@ -33,7 +33,7 @@ class PluginDatainjectionSession /** * Get a parameter from the HTTP session * - * @param $param the parameter to get + * @param mixed $param the parameter to get * * @return mixed the param's value **/ @@ -54,8 +54,8 @@ public static function getParam($param) /** * Set a parameter in the HTTP session * - * @param $param the parameter - * @param $results the value to store + * @param mixed $param the parameter + * @param mixed $results the value to store * * @return void **/ diff --git a/inc/softwareinjection.class.php b/inc/softwareinjection.class.php index 0b5a80d..053d17c 100644 --- a/inc/softwareinjection.class.php +++ b/inc/softwareinjection.class.php @@ -86,7 +86,7 @@ public function getOptions($primary_type = '') /** * Play software dictionnary * - * @param $values + * @param mixed $values **/ public function processDictionnariesIfNeeded(&$values) { diff --git a/inc/softwarelicenseinjection.class.php b/inc/softwarelicenseinjection.class.php index 2a8ff36..a3bb12a 100644 --- a/inc/softwarelicenseinjection.class.php +++ b/inc/softwarelicenseinjection.class.php @@ -97,8 +97,8 @@ public function getOptions($primary_type = '') /** - * @param $info array - * @param $option array + * @param array $info array + * @param array $option array **/ public function showAdditionalInformation($info = [], $option = []) { @@ -143,7 +143,7 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $fields_toinject array + * @param array $fields_toinject array **/ public function getValueForAdditionalMandatoryFields($fields_toinject = []) { @@ -164,8 +164,7 @@ public function getValueForAdditionalMandatoryFields($fields_toinject = []) $fields_toinject['SoftwareLicense']['entities_id'], true ); - /** @phpstan-ignore-next-line */ - $result = $DB->query($query); // phpcs:ignore + $result = $DB->doQuery($query); if ($DB->numrows($result) > 0) { $id = $DB->result($result, 0, 'id'); @@ -181,8 +180,8 @@ public function getValueForAdditionalMandatoryFields($fields_toinject = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { @@ -196,8 +195,8 @@ public function addSpecificNeededFields($primary_type, $values) /** - * @param $fields_toinject array - * @param $options array + * @param array $fields_toinject array + * @param array $options array **/ public function checkPresent($fields_toinject = [], $options = []) { diff --git a/inc/softwareversioninjection.class.php b/inc/softwareversioninjection.class.php index d11ffca..a093aa6 100644 --- a/inc/softwareversioninjection.class.php +++ b/inc/softwareversioninjection.class.php @@ -93,8 +93,8 @@ public function getOptions($primary_type = '') /** - * @param $info array - * @param $option array + * @param array $info array + * @param array $option array **/ public function showAdditionalInformation($info = [], $option = []) { @@ -138,7 +138,7 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $fields_toinject array + * @param array $fields_toinject array **/ public function getValueForAdditionalMandatoryFields($fields_toinject = []) { @@ -159,8 +159,7 @@ public function getValueForAdditionalMandatoryFields($fields_toinject = []) $fields_toinject['SoftwareVersion']['entities_id'], true ); - /** @phpstan-ignore-next-line */ - $result = $DB->query($query); // phpcs:ignore + $result = $DB->doQuery($query); if ($DB->numrows($result) > 0) { $id = $DB->result($result, 0, 'id'); @@ -176,8 +175,8 @@ public function getValueForAdditionalMandatoryFields($fields_toinject = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { @@ -191,8 +190,8 @@ public function addSpecificNeededFields($primary_type, $values) /** - * @param $fields_toinject array - * @param $options array + * @param array $fields_toinject array + * @param array $options array **/ public function checkPresent($fields_toinject = [], $options = []) { diff --git a/inc/userinjection.class.php b/inc/userinjection.class.php index 9447426..12af3d2 100644 --- a/inc/userinjection.class.php +++ b/inc/userinjection.class.php @@ -127,8 +127,8 @@ public function addOrUpdateObject($values = [], $options = []) /** - * @param $primary_type - * @param $values + * @param mixed $primary_type + * @param mixed $values **/ public function addSpecificNeededFields($primary_type, $values) { @@ -143,9 +143,9 @@ public function addSpecificNeededFields($primary_type, $values) /** - * @param $values - * @param $add (true by default) - * @param $rights array + * @param mixed $values + * @param boolean $add (true by default) + * @param array|null $rights array */ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) { @@ -182,16 +182,15 @@ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) $query = "UPDATE `glpi_users` SET `password` = '" . $password . "' WHERE `id` = '" . $values['User']['id'] . "'"; - /** @phpstan-ignore-next-line */ - $DB->query($query); // phpcs:ignore + $DB->doQuery($query); } } /** - * @param $itemtype - * @param $field - * @param $value + * @param string $itemtype + * @param string $field + * @param mixed $value **/ protected function addSpecificOptionalInfos($itemtype, $field, $value) {