Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement phpstan 5 #399

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 91 additions & 103 deletions composer.lock

Large diffs are not rendered by default.

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();
}

Session::setActiveTab('PluginDatainjectionModel', 'PluginDatainjectionModel$5');
Html::back();
9 changes: 4 additions & 5 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function plugin_datainjection_install()

include_once Plugin::getPhpDir('datainjection') . "/inc/profile.class.php";

$migration = new Migration(null);
$migration = new Migration(PLUGIN_DATAINJECTION_VERSION);

$default_charset = DBConnection::getDefaultCharset();
$default_collation = DBConnection::getDefaultCollation();
Expand Down 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 All @@ -1990,7 +1990,6 @@ function plugin_datainjection_addDefaultWhere($itemtype)
} else {
return "1 = 0"; //no model available -> force WHERE clause to get no result
}
return false;
default:
break;
}
Expand Down
6 changes: 3 additions & 3 deletions inc/autoupdatesysteminjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ 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 an array of IDs of newly created objects : for example array(Computer=>1, Networkport=>10)
* @return array of IDs of newly created objects : for example array(Computer=>1, Networkport=>10)
**/
public function addOrUpdateObject($values = [], $options = [])
{
Expand Down
10 changes: 5 additions & 5 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 Expand Up @@ -105,7 +105,7 @@ public static function toUTF8($string)
{

if (!self::is_utf8($string)) {
return utf8_encode($string);
return mb_convert_encoding($string, 'UTF-8');
}
return $string;
}
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;

//Overall injection results
private $global_results;


/**
* 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