Skip to content

Commit

Permalink
Fix class name in typing of htdocs/modulebuilder/index.php
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Nov 10, 2024
1 parent 9fe6cd9 commit 0ec3a57
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
1 change: 0 additions & 1 deletion dev/tools/phan/baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ return [
'htdocs/hrm/skill_card.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/hrm/skill_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/imports/emptyexample.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/imports/import.php' => ['PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch'],
'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/install/fileconf.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/install/inc.php' => ['PhanPluginUndeclaredVariableIsset'],
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/member/modules_cards.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function liste_modeles($db, $maxfilenamelength = 0)
* Cree un fichier de cartes de visites en fonction du modele de ADHERENT_CARDS_ADDON_PDF
*
* @param DoliDB $db Database handler
* @param array<string,mixed> $arrayofmembers Array of members
* @param array<array{textleft:string,textheader:string,textfooter:string,textright:string,id:int,ref:string,photo:string}> $arrayofmembers Array of members
* @param string $modele Force modele to use ('' to not force)
* @param Translate $outputlangs Object langs to use for translation
* @param string $outputdir Output directory
Expand Down
8 changes: 4 additions & 4 deletions htdocs/imports/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -2407,7 +2407,7 @@
/**
* Function to put the movable box of a source field
*
* @param array<int,array{label:string,example1:string,required:bool,bool|int<0,1>,position:int}> $fieldssource List of source fields
* @param array<int|string,array{label?:string,example1?:string,required?:bool,imported?:bool|int<0,1>,position?:int}> $fieldssource List of source fields
* @param int $pos Pos
* @param string $key Key
* @return void
Expand Down Expand Up @@ -2517,10 +2517,10 @@ function getnewkey(&$fieldssource, &$listofkey)
/**
* Return array with element inserted in it at position $position
*
* @param array<int,array{label:string,example1:string,required:bool,bool,position:int}> $array Array of field source
* @param array<int|string,array{label?:string,example1?:string,required?:bool,imported?:bool|int<0,1>,position?:int}> $array Array of field source
* @param int $position key of position to insert to
* @param array{label:string,example1:string,required:bool,bool,position:int} $insertArray Array to insert
* @return array<int,array{label:string,example1:string,required:bool,bool,position:int}>
* @param array{label?:string,example1?:string,required?:bool,imported?:bool|int<0,1>,position?:int} $insertArray Array to insert
* @return array<int|string,array{label?:string,example1?:string,required?:bool,imported?:bool|int<0,1>,position?:int}>
*/
function arrayInsert($array, $position, $insertArray)
{
Expand Down
31 changes: 19 additions & 12 deletions htdocs/modulebuilder/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
// Search modules to edit
$textforlistofdirs = '<!-- Directory scanned -->'."\n";
$listofmodules = array();
'@phan-var-force array<string,array{modulenamewithcase:string,moduledescriptorrelpath:string,moduledescriptorfullpath:string,moduledescriptorrootpath,moduletype?:string}> $listofmodules';
$i = 0;
foreach ($dirsrootforscan as $tmpdirread) {
$moduletype = 'external';
Expand Down Expand Up @@ -1981,7 +1982,7 @@ function getLicenceHeader($user, $langs, $now)
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
Expand Down Expand Up @@ -2065,12 +2066,17 @@ function getLicenceHeader($user, $langs, $now)
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
dol_print_error($db, $e->getMessage());
}
} else {
$error++;
$langs->load("errors");
dol_print_error($db, $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module));
exit;
}
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';

Expand Down Expand Up @@ -2249,7 +2255,7 @@ function getLicenceHeader($user, $langs, $now)
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
Expand Down Expand Up @@ -2319,7 +2325,7 @@ function getLicenceHeader($user, $langs, $now)
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
Expand Down Expand Up @@ -2597,7 +2603,7 @@ function getLicenceHeader($user, $langs, $now)
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
Expand Down Expand Up @@ -2772,7 +2778,7 @@ function getLicenceHeader($user, $langs, $now)
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
Expand Down Expand Up @@ -2837,7 +2843,7 @@ function getLicenceHeader($user, $langs, $now)
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
Expand Down Expand Up @@ -2996,7 +3002,7 @@ function getLicenceHeader($user, $langs, $now)
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
Expand Down Expand Up @@ -3101,7 +3107,7 @@ function getLicenceHeader($user, $langs, $now)
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
Expand Down Expand Up @@ -3265,7 +3271,7 @@ function getLicenceHeader($user, $langs, $now)
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
Expand Down Expand Up @@ -6626,13 +6632,14 @@ function updateInputField() {
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
'@phan-var-force DolibarrMOdules $moduleobj';
'@phan-var-force DolibarrModules $moduleobj';
/** @var DolibarrModules $moduleobj */
} catch (Exception $e) {
$error++;
dol_print_error($db, $e->getMessage());
}
} else {
}
if ($moduleobj === null) {
$error++;
$langs->load("errors");
dol_print_error($db, $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module));
Expand Down

0 comments on commit 0ec3a57

Please sign in to comment.