From aee0509473977eba71b255f719c047e19b3ad9be Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 12:56:55 +0100 Subject: [PATCH] Qual: Force typing on variable fixing several phan notices (#28740) * Qual: Force typing on variable fixing several phan notices # Qual: Force typing on variable fixing several phan notices Forcing DolibarrModules on $objMod after assignment to fix typing checks * Qual: Fix typing on import_label/export_label --- htdocs/admin/modulehelp.php | 8 ++++++-- htdocs/core/modules/DolibarrModules.class.php | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index dd91a52a04d..68db7450055 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -77,7 +77,7 @@ print ''."\n".''; -$arrayofnatures = array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers")); +$arrayofnatures = array('core' => $langs->transnoentitiesnoconv("Core"), 'external' => $langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers")); // Search modules dirs $modulesdir = dolGetModulesDirs(); @@ -116,6 +116,7 @@ foreach ($modulesdir as $dir) { if (class_exists($modName)) { try { $objMod = new $modName($db); + '@phan-var-force DolibarrModules $objMod'; $modNameLoaded[$modName] = $dir; if (!$objMod->numero > 0 && $modName != 'modUser') { @@ -235,7 +236,10 @@ foreach ($orders as $tmpkey => $tmpvalue) { } $value = $orders[$key]; $tab = explode('_', $value); -$familyposition = $tab[0]; $familykey = $tab[1]; $module_position = $tab[2]; $numero = $tab[3]; +$familyposition = $tab[0]; +$familykey = $tab[1]; +$module_position = $tab[2]; +$numero = $tab[3]; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 9b273e4f1b4..3a73f89ffd9 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -247,7 +247,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it public $export_code; /** - * @var string Module export label + * @var string[] Module export label */ public $export_label; @@ -279,7 +279,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it public $import_code; /** - * @var string Module import label + * @var string[] Module import label */ public $import_label;