Skip to content

Commit

Permalink
Set params types and remove useless phpstan ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
Lainow committed Jun 7, 2024
1 parent 4a9faef commit 23bad0b
Show file tree
Hide file tree
Showing 59 changed files with 326 additions and 355 deletions.
1 change: 0 additions & 1 deletion front/info.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,5 @@
}
Html::back();
}
/** @phpstan-ignore-next-line */
Session::setActiveTab('PluginDatainjectionModel', 'PluginDatainjectionModel$5');
Html::back();
1 change: 0 additions & 1 deletion front/mapping.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
$_POST['models_id'],
PluginDatainjectionModel::OTHERS_STEP
);
/** @phpstan-ignore-next-line */
Session::setActiveTab('PluginDatainjectionModel', 'PluginDatainjectionModel$5');
Session::addMessageAfterRedirect(
__(
Expand Down
2 changes: 0 additions & 2 deletions front/model.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"])) {
Expand Down Expand Up @@ -81,7 +80,6 @@
]
)
) {
/** @phpstan-ignore-next-line */
Session::setActiveTab('PluginDatainjectionModel', 'PluginDatainjectionModel$4');
} else {
Session::addMessageAfterRedirect(
Expand Down
6 changes: 3 additions & 3 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [])
{
Expand Down Expand Up @@ -1968,7 +1968,7 @@ function plugin_datainjection_needUpdateOrInstall()
/**
* Used for filter list of models
*
* @param $itemtype
* @param string $itemtype
**/
function plugin_datainjection_addDefaultWhere($itemtype)
{
Expand Down
4 changes: 2 additions & 2 deletions inc/autoupdatesysteminjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
**/
Expand Down
8 changes: 4 additions & 4 deletions inc/backend.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
{
Expand Down
16 changes: 8 additions & 8 deletions inc/backendcsv.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function isHeaderPresent()


/**
* @param $delimiter
* @param string $delimiter
**/
public function setDelimiter($delimiter)
{
Expand All @@ -67,7 +67,7 @@ public function setDelimiter($delimiter)


/**
* @param $present (true by default)
* @param boolean $present (true by default)
**/
public function setHeaderPresent($present = true)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/backendinterface.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface PluginDatainjectionBackendInterface
/**
* Read from file
*
* @param $numberOfLines (default 1)
* @param integer $numberOfLines (default 1)
**/
public function read($numberOfLines = 1);

Expand Down
21 changes: 7 additions & 14 deletions inc/clientinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -140,7 +133,7 @@ public function showForm($ID, $options = [])


/**
* @param $options array
* @param array $options
**/
public static function showUploadFileForm($options = [])
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
{
Expand All @@ -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)
{
Expand Down
Loading

0 comments on commit 23bad0b

Please sign in to comment.