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 11, 2024
1 parent 45fd2e0 commit 000d216
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 22 deletions.
9 changes: 4 additions & 5 deletions dev/tools/phan/baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ return [
'htdocs/fourn/paiement/document.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/ftp/admin/ftpclient.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/ftp/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/holiday/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/holiday/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/holiday/card_group.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/holiday/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/holiday/view_log.php' => ['PhanTypeMismatchDimFetch'],
Expand All @@ -453,7 +453,7 @@ 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/imports/import.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/install/fileconf.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/install/inc.php' => ['PhanPluginUndeclaredVariableIsset'],
Expand All @@ -467,9 +467,8 @@ return [
'htdocs/knowledgemanagement/class/knowledgerecord.class.php' => ['PhanUndeclaredProperty'],
'htdocs/knowledgemanagement/knowledgerecord_card.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/knowledgemanagement/knowledgerecord_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/loan/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/loan/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/loan/document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/schedule.php' => ['PhanUndeclaredGlobalVariable'],
Expand Down Expand Up @@ -514,7 +513,7 @@ return [
'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'],
'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray'],
'htdocs/product/stock/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/product/stock/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/product/stock/class/api_stockmovements.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/product/stock/class/api_warehouses.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/product/stock/class/entrepot.class.php' => ['PhanUndeclaredProperty'],
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/lib/functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -10198,14 +10198,19 @@ function dol_htmloutput_errors($mesgstring = '', $mesgarray = array(), $keepembe
* Advanced sort array by the value of a given key, which produces ascending (default) or descending
* output and uses optionally natural case insensitive sorting (which can be optionally case sensitive as well).
*
* @template T of array<string|int,mixed>
* @param array<string|int,mixed> $array Array to sort (array of array('key1'=>val1,'key2'=>val2,'key3'...) or array of objects)
* @phpstan-param T $array
* @phan-param T $array
* @param string $index Key in array to use for sorting criteria
* @param string $order Sort order ('asc' or 'desc')
* @param int<-1,1> $natsort If values are strings (I said value not type): 0=Use alphabetical order, 1=use "natural" sort (natsort), -1=Force alpha order
* If values are numeric (I said value not type): 0=Use numeric order (even if type is string) so use a "natural" sort, 1=use "natural" sort too (same than 0), -1=Force alphabetical order
* @param int<0,1> $case_sensitive 1=sort is case sensitive, 0=not case sensitive
* @param int<0,1> $keepindex If 0 and index key of array to sort is a numeric, then index will be rewritten. If 1 or index key is not numeric, key for index is kept after sorting.
* @return array<string|int,mixed> Return the sorted array (the source array is not modified !)
* @phpstan-return T
* @phan-return T
*/
function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sensitive = 0, $keepindex = 0)
{
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 000d216

Please sign in to comment.