diff --git a/composer.lock b/composer.lock index 6a1ae7b..447fa16 100644 --- a/composer.lock +++ b/composer.lock @@ -170,16 +170,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.67", + "version": "1.11.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493" + "reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/16ddbe776f10da6a95ebd25de7c1dbed397dc493", - "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e64220a05c1209fc856d58e789c3b7a32c0bb9a5", + "reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5", "shasum": "" }, "require": { @@ -224,29 +224,28 @@ "type": "github" } ], - "time": "2024-04-16T07:22:02+00:00" + "time": "2024-05-31T13:53:37+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", - "version": "1.1.4", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", - "reference": "089d8a8258ed0aeefdc7b68b6c3d25572ebfdbaa" + "reference": "fa8cce7720fa782899a0aa97b6a41225d1bb7b26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/089d8a8258ed0aeefdc7b68b6c3d25572ebfdbaa", - "reference": "089d8a8258ed0aeefdc7b68b6c3d25572ebfdbaa", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/fa8cce7720fa782899a0aa97b6a41225d1bb7b26", + "reference": "fa8cce7720fa782899a0aa97b6a41225d1bb7b26", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.10.3" + "phpstan/phpstan": "^1.11" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-php-parser": "^1.1", "phpstan/phpstan-phpunit": "^1.0", "phpunit/phpunit": "^9.5" }, @@ -270,9 +269,9 @@ "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", "support": { "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", - "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.1.4" + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.2.0" }, - "time": "2023-08-05T09:02:04+00:00" + "time": "2024-04-20T06:39:48+00:00" }, { "name": "psr/container", @@ -324,16 +323,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.2", + "version": "3.10.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", "shasum": "" }, "require": { @@ -400,20 +399,20 @@ "type": "open_collective" } ], - "time": "2024-04-23T20:25:34+00:00" + "time": "2024-05-22T21:24:41+00:00" }, { "name": "symfony/console", - "version": "v5.4.35", + "version": "v5.4.40", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931" + "reference": "aa73115c0c24220b523625bfcfa655d7d73662dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dbdf6adcb88d5f83790e1efb57ef4074309d3931", - "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931", + "url": "https://api.github.com/repos/symfony/console/zipball/aa73115c0c24220b523625bfcfa655d7d73662dd", + "reference": "aa73115c0c24220b523625bfcfa655d7d73662dd", "shasum": "" }, "require": { @@ -483,7 +482,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.35" + "source": "https://github.com/symfony/console/tree/v5.4.40" }, "funding": [ { @@ -499,20 +498,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:28:09+00:00" + "time": "2024-05-31T14:33:22+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "80d075412b557d41002320b96a096ca65aa2c98d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", + "reference": "80d075412b557d41002320b96a096ca65aa2c98d", "shasum": "" }, "require": { @@ -550,7 +549,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3" }, "funding": [ { @@ -566,20 +565,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-01-24T14:02:46+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", "shasum": "" }, "require": { @@ -593,9 +592,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -632,7 +628,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" }, "funding": [ { @@ -648,20 +644,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "875e90aeea2777b6f135677f618529449334a612" + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", - "reference": "875e90aeea2777b6f135677f618529449334a612", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", "shasum": "" }, "require": { @@ -672,9 +668,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -713,7 +706,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" }, "funding": [ { @@ -729,20 +722,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", "shasum": "" }, "require": { @@ -753,9 +746,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -797,7 +787,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" }, "funding": [ { @@ -813,20 +803,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -840,9 +830,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -880,7 +867,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -896,20 +883,20 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", "shasum": "" }, "require": { @@ -917,9 +904,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -959,7 +943,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0" }, "funding": [ { @@ -975,20 +959,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { @@ -996,9 +980,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -1042,7 +1023,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -1058,20 +1039,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a2329596ddc8fd568900e3fc76cba42489ecc7f3", + "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3", "shasum": "" }, "require": { @@ -1125,7 +1106,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.3" }, "funding": [ { @@ -1141,20 +1122,20 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2023-04-21T15:04:16+00:00" }, { "name": "symfony/string", - "version": "v5.4.35", + "version": "v5.4.40", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "c209c4d0559acce1c9a2067612cfb5d35756edc2" + "reference": "142877285aa974a6f7685e292ab5ba9aae86b143" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/c209c4d0559acce1c9a2067612cfb5d35756edc2", - "reference": "c209c4d0559acce1c9a2067612cfb5d35756edc2", + "url": "https://api.github.com/repos/symfony/string/zipball/142877285aa974a6f7685e292ab5ba9aae86b143", + "reference": "142877285aa974a6f7685e292ab5ba9aae86b143", "shasum": "" }, "require": { @@ -1211,7 +1192,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.35" + "source": "https://github.com/symfony/string/tree/v5.4.40" }, "funding": [ { @@ -1227,34 +1208,41 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-05-31T14:33:22+00:00" }, { "name": "twig/twig", - "version": "v3.8.0", + "version": "v3.10.3", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "9d15f0ac07f44dc4217883ec6ae02fd555c6f71d" + "reference": "67f29781ffafa520b0bbfbd8384674b42db04572" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/9d15f0ac07f44dc4217883ec6ae02fd555c6f71d", - "reference": "9d15f0ac07f44dc4217883ec6ae02fd555c6f71d", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/67f29781ffafa520b0bbfbd8384674b42db04572", + "reference": "67f29781ffafa520b0bbfbd8384674b42db04572", "shasum": "" }, "require": { "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-mbstring": "^1.3", "symfony/polyfill-php80": "^1.22" }, "require-dev": { "psr/container": "^1.0|^2.0", - "symfony/phpunit-bridge": "^5.4.9|^6.3|^7.0" + "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" }, "type": "library", "autoload": { + "files": [ + "src/Resources/core.php", + "src/Resources/debug.php", + "src/Resources/escaper.php", + "src/Resources/string_loader.php" + ], "psr-4": { "Twig\\": "src/" } @@ -1287,7 +1275,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.8.0" + "source": "https://github.com/twigphp/Twig/tree/v3.10.3" }, "funding": [ { @@ -1299,7 +1287,7 @@ "type": "tidelift" } ], - "time": "2023-11-21T18:54:41+00:00" + "time": "2024-05-16T10:04:27+00:00" } ], "aliases": [], diff --git a/front/info.form.php b/front/info.form.php index 0543be3..53a5543 100644 --- a/front/info.form.php +++ b/front/info.form.php @@ -44,6 +44,5 @@ } Html::back(); } - Session::setActiveTab('PluginDatainjectionModel', 'PluginDatainjectionModel$5'); Html::back(); diff --git a/hook.php b/hook.php index e12f570..4e448da 100644 --- a/hook.php +++ b/hook.php @@ -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(); @@ -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) { @@ -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; } diff --git a/inc/autoupdatesysteminjection.class.php b/inc/autoupdatesysteminjection.class.php index 57e701b..6c6a9af 100644 --- a/inc/autoupdatesysteminjection.class.php +++ b/inc/autoupdatesysteminjection.class.php @@ -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 = []) { diff --git a/inc/backend.class.php b/inc/backend.class.php index 91441d9..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) { @@ -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; } 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 6ddd5ba..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; - - //Overall injection results - private $global_results; - - /** * 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 d8d10e7..0ceeadc 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,13 +149,13 @@ 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 nothinActiong + * @return void nothing **/ public function __construct($injectionClass, $values = [], $injection_options = []) { @@ -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,9 +265,9 @@ 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 true if it's a dropdown type, false if not + * @return boolean true if it's a dropdown type, false if not **/ public static function isFieldADropdown($field_type) { @@ -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 the injection class instance + * @return PluginDatainjectionInjectionInterface the injection class instance */ public static function getInjectionClassInstance($itemtype) { @@ -354,9 +351,9 @@ public static function getInjectionClassInstance($itemtype) /** * Add blacklisted fields for an itemtype * - * @param $itemtype the itemtype + * @param string $itemtype the itemtype * - * @return the array of all blacklisted fields + * @return array the array of all blacklisted fields */ public static function getBlacklistedOptions($itemtype) { @@ -423,10 +420,10 @@ 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 the search option matching lookfor parameter or false it not found + * @return array the search option matching lookfor parameter or false it not found **/ public static function findSearchOption($options, $lookfor) { @@ -452,7 +449,7 @@ public static function findSearchOption($options, $lookfor) /** * Get date format used for injection * - * @return date format used + * @return string date format used **/ private function getDateFormat() { @@ -464,7 +461,7 @@ private function getDateFormat() /** * Get date format used for injection * - * @return date format used + * @return string date format used **/ private function getFloatFormat() { @@ -473,24 +470,10 @@ private function getFloatFormat() } - /** * Get itemtype associated to the injectionClass * - * @return an itemtype - **/ - private function getItemtype() - { - - $classname = get_class($this->injectionClass); - return self::getItemtypeByInjection($classname); - } - - - /** - * Get itemtype associated to the injectionClass - * - * @return an itemtype + * @return CommonDBTM an itemtype **/ private function getItemInstance() { @@ -503,7 +486,7 @@ private function getItemInstance() /** * Return injection results * - * @return an array which contains the reformat/check/injection logs + * @return array which contains the reformat/check/injection logs **/ public function getInjectionResults() { @@ -554,12 +537,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,9 +671,9 @@ private function getFieldValue( /** * Add additional parameters needed for dropdown import * - * @param itemtype dropdrown's itemtype + * @param string $itemtype dropdrown's itemtype * - * @return an array with additional options to be added + * @return array with additional options to be added **/ private function addExternalDropdownParameters($itemtype) { @@ -731,10 +714,10 @@ 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 the user ID if found or '' + * @return int|string the user ID if found or '' **/ private static function findUser($value, $entity) { @@ -746,8 +729,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,10 +747,10 @@ 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 the user ID if found or '' + * @return int|string the user ID if found or '' */ private static function findContact($value, $entity) { @@ -781,8 +763,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,12 +776,12 @@ 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 the id of the item found + * @return int|string the id of the item found **/ private static function findSingle($item, $searchOption, $entity, $value) { @@ -826,8 +807,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,9 +820,9 @@ private static function findSingle($item, $searchOption, $entity, $value) /** * Get values to inject for an itemtype * - * @param the itemtype + * @param string $itemtype * - * @return an array with all values for this itemtype + * @return mixed|false an array with all values for this itemtype **/ public function getValuesForItemtype($itemtype) { @@ -857,9 +837,9 @@ public function getValuesForItemtype($itemtype) /** * Get values to inject for an itemtype * - * @param the itemtype + * @param string $itemtype * - * @return an array with all values for this itemtype + * @return mixed|false an array with all values for this itemtype **/ private function getValueByItemtypeAndName($itemtype, $field) { @@ -875,7 +855,7 @@ private function getValueByItemtypeAndName($itemtype, $field) /** * Unset a value to inject for an itemtype * - * @param the itemtype + * @param string $itemtype * * @return void nothing **/ @@ -891,10 +871,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) { @@ -911,7 +891,7 @@ private function setValueForItemtype($itemtype, $field, $value, $fromdb = false) } else { $this->values[$itemtype][$field] = $this->values[$itemtype][$field] . "\n" . $value; } - } else if ( + } elseif ( ($fromdb && $value && !$this->rights['overwrite_notempty_fields']) || !$fromdb ) { @@ -931,10 +911,10 @@ 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 name of the template or false is no template found + * @return string|false name of the template or false is no template found **/ private static function getTemplateIDByName($itemtype, $name) { @@ -945,8 +925,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,8 +958,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'])) { - if (false) { + if (isset($searchOptions['datatype']) && self::isFieldADropdown($searchOptions['displaytype'])) { $this->values[$itemtype][$field] = self::EMPTY_VALUE; } } @@ -1074,10 +1052,10 @@ 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 the float modified as expected in GLPI + * @return float modified as expected in GLPI **/ private static function reformatFloat($value, $format) { @@ -1112,9 +1090,9 @@ 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 the date reformated, if needed + * @return string the date reformated, if needed **/ private static function reformatDate($original_date, $date_format) { @@ -1159,9 +1137,9 @@ 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 the mac address modified, if needed + * @return mixed the mac address modified, if needed **/ private static function reformatMacAddress($mac) { @@ -1243,9 +1221,9 @@ private function check() /** * Is a value a float ? * - * @param val the value to check + * @param mixed $val the value to check * - * @return true if it's a float, false otherwise + * @return boolean true if it's a float, false otherwise */ private function isFloat($val) { @@ -1256,9 +1234,9 @@ private function isFloat($val) /** * Is a value an integer ? * - * @param val the value to check + * @param mixed $val the value to check * - * @return true if it's an integer, false otherwise + * @return boolean true if it's an integer, false otherwise */ private function isInteger($val) { @@ -1269,10 +1247,13 @@ private function isInteger($val) /** * Check one data * - * @param the type of data waited - * @param data the data to import + * @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 true if the data is the correct type + * @return int the result of the check **/ private function checkType($injectionClass, $option, $field_name, $data, $mandatory) { @@ -1374,8 +1355,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 **/ @@ -1436,7 +1417,7 @@ private function lastCheckBeforeProcess($injectionClass, $values) /** * Process of inject data into GLPI * - * @return an array which contains the injection results + * @return array which contains the injection results **/ public function processAddOrUpdate() { @@ -1578,12 +1559,12 @@ 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 the id of the object added or updated + * @return int|string the id of the object added or updated **/ private function effectiveAddOrUpdate($injectionClass, $item, $values, $add = true) { @@ -1640,7 +1621,7 @@ private function effectiveAddOrUpdate($injectionClass, $item, $values, $add = tr $add, $this->rights ); - } else if ($item instanceof CommonDropdown && $add) { + } elseif ($item instanceof CommonDropdown && $add) { $newID = $item->import($toinject); } else { if ($add) { @@ -1697,9 +1678,9 @@ private function addOptionalInfos() /** * If an optional info need more processing (for example password) * - * @param itemtype being injected - * @param field the optional info field - * @param value the optional info value + * @param $itemtype being injected + * @param $field the optional info field + * @param $value the optional info value * @return void nothing */ protected function addSpecificOptionalInfos($itemtype, $field, $value) @@ -1764,8 +1745,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 **/ @@ -1810,7 +1791,7 @@ private function dataAlreadyInDB($injectionClass, $itemtype) if ($item instanceof CommonDevice) { $sql .= " WHERE `designation` = '" . $this->getValueByItemtypeAndName($itemtype, 'designation') . "'"; - } else if ($item instanceof CommonDBRelation) { + } elseif ($item instanceof CommonDBRelation) { //Type is a relation : check it this relation still exists //Define the side of the relation to use @@ -1916,9 +1897,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) { @@ -1936,7 +1915,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 **/ @@ -1993,9 +1972,8 @@ private function addTemplateFields($itemtype) /** * Log event into the history * - * @param device_type the type of the item to inject - * @param device_id the id of the inserted item - * @param the action_type the type of action(add or 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 **/ @@ -2019,9 +1997,9 @@ 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 label associated with the code + * @return string label associated with the code **/ public static function getActionLabel($action) { @@ -2041,9 +2019,9 @@ 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 label associated with the code + * @return string label associated with the code **/ public static function getLogLabel($type) { @@ -2212,8 +2190,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 **/ @@ -2247,7 +2225,9 @@ public static function addTemplateSearchOptions($injectionClass, &$tab) /** * If itemtype injection needs to process things after data is written in DB * - * @param add true if an item is created, false if it's an update + * @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 **/ private function processAfterInsertOrUpdate($injectionClass, $add = true) 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 9b83548..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) { @@ -105,7 +105,7 @@ public static function statusLabels() /** * Return current status of the model * - * @return nothing + * @return string **/ public static function getStatusLabel($step) { @@ -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 d3ce084..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) { @@ -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 */ @@ -222,7 +222,7 @@ public function addValueToInject( /** * Add additonal informations, as selected by the user which performs the CSV file import * - * @return additional informations to inject + * @return array additional informations to inject **/ public function addAdditionalInformations() { 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 d7bcf16..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) { @@ -67,7 +67,7 @@ public function load($models_id) /** * Return all the mappings for this model * - * @return the list of all the mappings for this model + * @return array the list of all the mappings for this model **/ public function getAllInfos() { 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 7e4e2a2..875acc2 100644 --- a/inc/injectioninterface.class.php +++ b/inc/injectioninterface.class.php @@ -40,7 +40,7 @@ interface PluginDatainjectionInjectionInterface /** * Tells datainjection is the type is a primary type or not * - * @return a boolean + * @return boolean a boolean **/ public function isPrimaryType(); @@ -48,7 +48,7 @@ public function isPrimaryType(); /** * Indicates to with other types it can be connected * - * @return an array of GLPI types + * @return array of GLPI types **/ public function connectedTo(); @@ -56,9 +56,9 @@ public function connectedTo(); /** * Function which calls getSearchOptions and add more parameters specific to display * - * @param $primary_type (default '') + * @param mixed $primary_type (default '') * - * @return an array of search options, as defined in each commondbtm object + * @return array of search options, as defined in each commondbtm object **/ public function getOptions($primary_type = ''); @@ -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,10 +76,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 mixed $values array fields to add into glpi + * @param array $options array options used during creation * - * @return an array of IDs of newly created objects: + * @return array of IDs of newly created objects: * for example array(Computer=>1, Networkport=>10) **/ public function addOrUpdateObject($values = [], $options = []); @@ -90,11 +90,11 @@ 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 ? * - * @return an array which indicates check status & errors + * @return array which indicates check status & errors **/ //function checkType($field_name, $data, $mandatory); @@ -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,10 +111,9 @@ 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 * - * @return nothing **/ //function checkPresent($fields_toinject=[], $options=[]); @@ -123,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 73a7ddb..857f75f 100644 --- a/inc/injectiontype.class.php +++ b/inc/injectiontype.class.php @@ -36,9 +36,9 @@ 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 an array which contains array(itemtype => itemtype name) + * @return array which contains array(itemtype => itemtype name) **/ public static function getItemtypes($only_primary = false) { @@ -55,7 +55,7 @@ public static function getItemtypes($only_primary = false) if ( class_exists($type) && (!$only_primary - || ($only_primary && $injectionclass->isPrimaryType())) + || ($injectionclass->isPrimaryType())) ) { $instance = new $type(); //If user has no right to create an object of this type, do not display type in the list @@ -80,10 +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) - * - * @return nothing + * @param mixed $value the selected value (default '') + * @param boolean $only_primary (false by default) **/ public static function dropdown($value = '', $only_primary = false) { @@ -99,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; @@ -169,7 +167,7 @@ public static function dropdownLinkedTypes($mapping_or_info, $options = []) /** - * @param $options array + * @param array $options array **/ public static function dropdownFields($options = []) { @@ -260,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 **/ @@ -289,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 = []) { @@ -308,7 +306,7 @@ public static function testBasicEqual($name, $option = []) /** - * @param $options array + * @param array $options array **/ public static function showMandatoryCheckbox($options = []) { @@ -342,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 17f48b2..ff3848d 100644 --- a/inc/interfacetypeinjection.class.php +++ b/inc/interfacetypeinjection.class.php @@ -77,10 +77,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 mixed $values array fields to add into glpi + * @param array $options array options used during creation * - * @return an array of IDs of newly created objects: + * @return array of IDs of newly created objects: * for example array(Computer=>1, Networkport=>10) **/ public function addOrUpdateObject($values = [], $options = []) 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 dc86718..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,9 +163,9 @@ 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 true if more than one value to inject, false if not + * @return array true if more than one value to inject, false if not **/ public static function getSeveralMappedField($models_id) { @@ -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 16f390b..0a9dfff 100644 --- a/inc/mappingcollection.class.php +++ b/inc/mappingcollection.class.php @@ -38,13 +38,12 @@ public function __construct() $this->mappingCollection = []; } - //---- Getter ----// /** * 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) { @@ -71,7 +70,7 @@ public function load($models_id) /** * Return all the mappings for this model * - * @return the list of all the mappings for this model + * @return array the list of all the mappings for this model **/ public function getAllMappings() { @@ -83,9 +82,9 @@ public function getAllMappings() /** * Get a PluginDatainjectionMapping by giving the mapping name * - * @param name + * @param string $name * - * @return the PluginDatainjectionMapping object associated or null + * @return PluginDatainjectionMapping the PluginDatainjectionMapping object associated or null **/ public function getMappingByName($name) { @@ -97,9 +96,9 @@ public function getMappingByName($name) /** * Get a PluginDatainjectionMapping by giving the mapping rank * - * @param rank + * @param int $rank * - * @return the PluginDatainjectionMapping object associated or null + * @return PluginDatainjectionMapping the PluginDatainjectionMapping object associated or null **/ public function getMappingByRank($rank) { @@ -111,10 +110,10 @@ public function getMappingByRank($rank) /** * Find a mapping by looking for a specific field * - * @param field the field to look for - * @param the value of the field + * @param string $field the field to look for + * @param mixed $value the value of the field * - * @return the PluginDatainjectionMapping object associated or null + * @return PluginDatainjectionMapping|null the PluginDatainjectionMapping object associated or null **/ public function getMappingsByField($field, $value) { @@ -138,7 +137,7 @@ public function saveAllMappings() foreach ($this->mappingCollection as $mapping) { if (isset($mapping->fields["id"])) { - $mapping->update($mapping->fields); + $mapping->update($mapping->fields); /** @phpstan-ignore-line */ } else { $mapping->fields["id"] = $mapping->add($mapping->fields); } @@ -161,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) { @@ -173,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 a00806b..25ed588 100644 --- a/inc/model.class.php +++ b/inc/model.class.php @@ -54,18 +54,18 @@ class PluginDatainjectionModel extends CommonDBTM public $severaltimes_mapped = []; //Private or public model - const MODEL_PRIVATE = 1; - const MODEL_PUBLIC = 0; + public const MODEL_PRIVATE = 1; + public const MODEL_PUBLIC = 0; //Step constants - const INITIAL_STEP = 1; - const FILE_STEP = 2; - const MAPPING_STEP = 3; - const OTHERS_STEP = 4; - const READY_TO_USE_STEP = 5; + public const INITIAL_STEP = 1; + public const FILE_STEP = 2; + public const MAPPING_STEP = 3; + public const OTHERS_STEP = 4; + public const READY_TO_USE_STEP = 5; - const PROCESS = 0; - const CREATION = 1; + public const PROCESS = 0; + public const CREATION = 1; @@ -270,7 +270,9 @@ public function getSpecificModel() /** - * @param $options array + * @param array $options array + * + * @return boolean **/ public static function dropdown($options = []) { @@ -340,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) { @@ -527,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 = []) { @@ -557,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 = []) { @@ -787,35 +789,31 @@ public function defineTabs($options = []) } - //Tabs management + /** + * Tabs management + * + * @return array|string + **/ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { $canedit = Session::haveRight('plugin_datainjection_model', UPDATE); - if (!$withtemplate) { - switch ($item->getType()) { - case __CLASS__: - $tabs[1] = __('Model'); - if (!$this->isNewID($item->fields['id'])) { - if ($canedit) { - $tabs[3] = __('File to inject', 'datainjection'); - } - $tabs[4] = __('Mappings', 'datainjection'); - - if ($item->fields['step'] > self::MAPPING_STEP) { - $tabs[5] = __('Additional Information', 'datainjection'); - - if ($canedit && $item->fields['step'] != self::READY_TO_USE_STEP) { - $tabs[6] = __('Validation'); - } - } + if (!$withtemplate && $item->getType() == __CLASS__ && $item instanceof CommonDBTM) { + $tabs[1] = __('Model'); + if (!$this->isNewID($item->fields['id'])) { + if ($canedit) { + $tabs[3] = __('File to inject', 'datainjection'); + } + $tabs[4] = __('Mappings', 'datainjection'); + if ($item->fields['step'] > self::MAPPING_STEP) { + $tabs[5] = __('Additional Information', 'datainjection'); + if ($canedit && $item->fields['step'] != self::READY_TO_USE_STEP) { + $tabs[6] = __('Validation'); } - return $tabs; - - default: - return ''; + } } + return $tabs; } return ''; @@ -825,7 +823,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { - if ($item->getType() == __CLASS__) { + if ($item->getType() == __CLASS__ && $item instanceof self) { switch ($tabnum) { case 1: $item->showAdvancedForm($item->getID()); @@ -877,7 +875,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 = []) { @@ -896,8 +894,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) { @@ -970,7 +968,7 @@ public function prepareInputForUpdate($input) /** * Get the backend implementation by type * - * @param $type + * @param string $type **/ public static function getInstance($type) { @@ -990,13 +988,12 @@ public static function getInstanceByModelID($models_id) $model->getFromDB($models_id); $specific = self::getInstance($model->getFiletype()); $specific->getFromDBByModelID($models_id); - $model->setSpecificModel($specific); return $model; } /** - * @param $options array + * @param array $options array **/ public function readUploadedFile($options = []) { @@ -1086,7 +1083,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 * @@ -1181,7 +1178,7 @@ public function processUploadedFile($options = []) /** * Try to parse an input file * - * @return true if the file is a CSV file + * @return array true if the file is a CSV file **/ public function isFileCorrect() { @@ -1272,7 +1269,7 @@ public function isFileCorrect() /** - * @param $fields + * @param array $fields **/ public function checkMandatoryFields($fields) { @@ -1325,7 +1322,7 @@ public function populateSeveraltimesMappedFields() /** - * @param $models_id + * @param int $models_id **/ public static function checkRightOnModel($models_id) { @@ -1373,7 +1370,7 @@ public static function cleanSessionVariables() /** - * @param $models_id + * @param int $models_id **/ public static function showPreviewMappings($models_id) { @@ -1415,7 +1412,7 @@ public static function showPreviewMappings($models_id) /** - * @param $models_id + * @param int $models_id **/ public static function prepareLogResults($models_id) { @@ -1500,7 +1497,7 @@ public static function prepareLogResults($models_id) /** - * @param $models_id + * @param int $models_id **/ public static function showLogResults($models_id) { @@ -1632,7 +1629,6 @@ public static function showLogResults($models_id) echo ""; } - public static function exportAsPDF($models_id) { @@ -1642,7 +1638,7 @@ public static function exportAsPDF($models_id) if (!empty($logresults)) { $pdf = new PluginPdfSimplePDF('a4', 'landscape'); /** @phpstan-ignore-line */ - $pdf->setHeader( + $pdf->setHeader(/** @phpstan-ignore-line */ sprintf( __('%1$s (%2$s)'), __('Data injection report', 'datainjection') . ' - ' . @@ -1650,22 +1646,22 @@ public static function exportAsPDF($models_id) $model->getName() ) ); - $pdf->newPage(); + $pdf->newPage();/** @phpstan-ignore-line */ if (isset($logresults[PluginDatainjectionCommonInjectionLib::SUCCESS])) { - $pdf->setColumnsSize(100); - $pdf->displayTitle('' . __('Array of successful injections', 'datainjection') . ''); - $pdf->setColumnsSize(6, 54, 20, 20); - $pdf->setColumnsAlign('center', 'center', 'center', 'center'); + $pdf->setColumnsSize(100);/** @phpstan-ignore-line */ + $pdf->displayTitle('' . __('Array of successful injections', 'datainjection') . '');/** @phpstan-ignore-line */ + $pdf->setColumnsSize(6, 54, 20, 20);/** @phpstan-ignore-line */ + $pdf->setColumnsAlign('center', 'center', 'center', 'center');/** @phpstan-ignore-line */ $col0 = '' . __('Line', 'datainjection') . ''; $col1 = '' . __('Data Import', 'datainjection') . ''; $col2 = '' . __('Injection type', 'datainjection') . ''; $col3 = '' . __('Object Identifier', 'datainjection') . ''; - $pdf->displayTitle($col0, $col1, $col2, $col3); + $pdf->displayTitle($col0, $col1, $col2, $col3);/** @phpstan-ignore-line */ $index = 0; foreach ($logresults[PluginDatainjectionCommonInjectionLib::SUCCESS] as $result) { - $pdf->displayLine( + $pdf->displayLine(/** @phpstan-ignore-line */ $result['line'], $result['status_message'], $result['type'], @@ -1675,22 +1671,22 @@ public static function exportAsPDF($models_id) } if (isset($logresults[PluginDatainjectionCommonInjectionLib::FAILED])) { - $pdf->setColumnsSize(100); - $pdf->displayTitle('' . __('Array of unsuccessful injections', 'datainjection') . ''); - $pdf->setColumnsSize(6, 16, 38, 20, 20); - $pdf->setColumnsAlign('center', 'center', 'center', 'center', 'center'); + $pdf->setColumnsSize(100);/** @phpstan-ignore-line */ + $pdf->displayTitle('' . __('Array of unsuccessful injections', 'datainjection') . '');/** @phpstan-ignore-line */ + $pdf->setColumnsSize(6, 16, 38, 20, 20);/** @phpstan-ignore-line */ + $pdf->setColumnsAlign('center', 'center', 'center', 'center', 'center');/** @phpstan-ignore-line */ $col0 = '' . __('Line', 'datainjection') . ''; $col1 = '' . __('Data check', 'datainjection') . ''; $col2 = '' . __('Data Import', 'datainjection') . ''; $col3 = '' . __('Injection type', 'datainjection') . ''; $col4 = '' . __('Object Identifier', 'datainjection') . ''; - $pdf->displayTitle($col0, $col1, $col2, $col3, $col4); + $pdf->displayTitle($col0, $col1, $col2, $col3, $col4);/** @phpstan-ignore-line */ $index = 0; foreach ($logresults[PluginDatainjectionCommonInjectionLib::FAILED] as $result) { - $pdf->setColumnsSize(6, 16, 38, 20, 20); - $pdf->setColumnsAlign('center', 'center', 'center', 'center', 'center'); - $pdf->displayLine( + $pdf->setColumnsSize(6, 16, 38, 20, 20);/** @phpstan-ignore-line */ + $pdf->setColumnsAlign('center', 'center', 'center', 'center', 'center');/** @phpstan-ignore-line */ + $pdf->displayLine(/** @phpstan-ignore-line */ $result['line'], $result['check_sumnary'], $result['status_message'], @@ -1699,7 +1695,7 @@ public static function exportAsPDF($models_id) ); if ($result['check_message']) { - $pdf->displayText( + $pdf->displayText(/** @phpstan-ignore-line */ '' . __('Data check', 'datainjection') . ' :', $result['check_message'], 1 @@ -1707,7 +1703,7 @@ public static function exportAsPDF($models_id) } } } - $pdf->render(); + $pdf->render();/** @phpstan-ignore-line */ } } 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 a6e216f..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,10 +241,10 @@ 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 the sql where clause + * @return string the sql where clause **/ public function getUnicityRequest($fields_toinject = [], $options = []) { @@ -298,9 +298,9 @@ 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 true if check ok, false if not ok + * @return boolean true if check ok, false if not ok **/ public function lastCheck($values = []) { @@ -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); @@ -366,7 +365,7 @@ public function processAfterInsertOrUpdate($values, $add = true, $rights = []) $netport = $DB->fetchArray($res); $netport_netport = new NetworkPort_NetworkPort(); //If this port already connected to another one ? - if (!$netport_netport->getOppositeContact($netport['id'])) { + if (!$netport_netport->getOppositeContact((int) $netport['id'])) { //No, add a new port to port connection $tmp['networkports_id_1'] = $values['NetworkPort']['id']; $tmp['networkports_id_2'] = $netport['id']; 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 36f4077..d2a63d9 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,15 +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') { - if ($item->getField('interface') == 'central') { + if ($item->getType() == 'Profile' && $item instanceof CommonDBTM) { + if ($item->fields['interface'] == 'central') { return __('Data injection', 'datainjection'); } return ''; @@ -81,9 +80,9 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { - if ($item->getType() == 'Profile') { + if ($item->getType() == 'Profile' && $item instanceof CommonDBTM) { $profile = new self(); - $ID = $item->getField('id'); + $ID = $item->fields['id']; //In case there's no right datainjection for this profile, create it self::addDefaultProfileInfos( $item->getID(), @@ -95,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) { @@ -120,7 +120,7 @@ public static function addDefaultProfileInfos($profiles_id, $rights) } /** - * @param $ID integer + * @param int $profiles_id integer */ public static function createFirstAccess($profiles_id) { @@ -147,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 ca435bc..8a42b67 100644 --- a/inc/session.class.php +++ b/inc/session.class.php @@ -33,9 +33,9 @@ class PluginDatainjectionSession /** * Get a parameter from the HTTP session * - * @param $param the parameter to get + * @param mixed $param the parameter to get * - * @return the param's value + * @return mixed the param's value **/ public static function getParam($param) { @@ -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) { diff --git a/phpstan.neon b/phpstan.neon index 3661c97..561bb08 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,7 @@ parameters: parallel: maximumNumberOfProcesses: 2 - level: 1 + level: 5 bootstrapFiles: - ../../inc/based_config.php paths: