diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt
index 295fc4eda2e..1d05ced1d52 100644
--- a/dev/tools/phan/baseline.txt
+++ b/dev/tools/phan/baseline.txt
@@ -9,26 +9,26 @@
*/
return [
// # Issue statistics:
- // PhanPluginUnknownPropertyType : 1620+ occurrences
- // PhanPossiblyUndeclaredGlobalVariable : 1160+ occurrences
- // PhanTypeMismatchArgumentProbablyReal : 1050+ occurrences
- // PhanUndeclaredProperty : 780+ occurrences
- // PhanUndeclaredGlobalVariable : 700+ occurrences
- // PhanPluginUnknownObjectMethodCall : 550+ occurrences
- // PhanPluginUnknownArrayMethodReturnType : 510+ occurrences
- // PhanPluginUnknownArrayMethodParamType : 470+ occurrences
+ // PhanPluginUnknownPropertyType : 1560+ occurrences
+ // PhanPossiblyUndeclaredGlobalVariable : 1090+ occurrences
+ // PhanTypeMismatchArgumentProbablyReal : 1000+ occurrences
+ // PhanUndeclaredProperty : 770+ occurrences
+ // PhanUndeclaredGlobalVariable : 690+ occurrences
+ // PhanPluginUnknownObjectMethodCall : 540+ occurrences
+ // PhanPluginUnknownArrayMethodReturnType : 480+ occurrences
+ // PhanPluginUnknownArrayMethodParamType : 430+ occurrences
// PhanPossiblyUndeclaredVariable : 350+ occurrences
// PhanPluginUnknownArrayFunctionReturnType : 230+ occurrences
// PhanTypeMismatchProperty : 210+ occurrences
// PhanPluginUnknownArrayFunctionParamType : 170+ occurrences
// PhanTypeExpectedObjectPropAccess : 150+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 120+ occurrences
- // PhanPluginUnknownArrayPropertyType : 85+ occurrences
+ // PhanPluginUnknownArrayPropertyType : 80+ occurrences
// PhanPluginUndeclaredVariableIsset : 70+ occurrences
// PhanPluginEmptyStatementIf : 65+ occurrences
// PhanRedefineFunction : 55+ occurrences
+ // PhanTypeSuspiciousNonTraversableForeach : 50+ occurrences
// PhanTypeMismatchDimFetch : 45+ occurrences
- // PhanTypeSuspiciousNonTraversableForeach : 45+ occurrences
// PhanPossiblyNullTypeMismatchProperty : 20+ occurrences
// PhanEmptyForeach : 15+ occurrences
// PhanTypeComparisonFromArray : 15+ occurrences
@@ -50,22 +50,7 @@ return [
'file_suppressions' => [
'htdocs/accountancy/class/accountancycategory.class.php' => ['PhanPluginUnknownArrayPropertyType'],
'htdocs/accountancy/class/accountancyexport.class.php' => ['PhanUndeclaredProperty'],
- 'htdocs/adherents/admin/member.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/adherents/canvas/actions_adherentcard_common.class.php' => [/* Traverses Adherent as array, ignore */ 'PhanTypeSuspiciousNonTraversableForeach'],
- 'htdocs/adherents/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/adherents/class/adherent.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/adherents/class/adherent_type.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/adherents/class/adherentstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
- 'htdocs/adherents/class/api_members.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
- 'htdocs/adherents/class/api_subscriptions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
- 'htdocs/adherents/class/subscription.class.php' => ['PhanPossiblyUndeclaredVariable'],
- 'htdocs/adherents/list.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
- 'htdocs/adherents/note.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
- 'htdocs/adherents/stats/geo.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
- 'htdocs/adherents/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
- 'htdocs/adherents/subscription.php' => ['PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/adherents/subscription/list.php' => ['PhanEmptyForeach'],
- 'htdocs/adherents/type.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/admin/agenda_extsites.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/admin/agenda_other.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'],
'htdocs/admin/agenda_reminder.php' => ['PhanUndeclaredGlobalVariable'],
@@ -178,8 +163,8 @@ return [
'htdocs/bookcal/calendar_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/bookcal/calendar_document.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/bookcal/calendar_list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/bookcal/class/availabilities.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredMethod', /* Missing getNextValue class, ignored */ 'PhanUndeclaredProperty'],
- 'htdocs/bookcal/class/calendar.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredMethod', /* Missing getNextValue class, ignored */ 'PhanUndeclaredProperty'],
+ 'htdocs/bookcal/class/availabilities.class.php' => ['PhanUndeclaredMethod', /* Missing getNextValue class, ignored */ 'PhanUndeclaredProperty'],
+ 'htdocs/bookcal/class/calendar.class.php' => ['PhanUndeclaredMethod', /* Missing getNextValue class, ignored */ 'PhanUndeclaredProperty'],
'htdocs/bookcal/lib/bookcal.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/bookcal/lib/bookcal_availabilities.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/bookcal/lib/bookcal_calendar.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
@@ -336,11 +321,8 @@ return [
'htdocs/contrat/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contrat/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/contrat/class/api_contracts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
- 'htdocs/contrat/class/contrat.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/contrat/index.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contrat/messaging.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contrat/services_list.php' => ['PhanEmptyForeach', 'PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/contrat/ticket.php' => ['PhanPluginUnknownObjectMethodCall'],
'htdocs/contrat/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'],
'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'],
'htdocs/core/actions_builddoc.inc.php' => ['PhanUndeclaredProperty'],
@@ -349,7 +331,7 @@ return [
'htdocs/core/actions_extrafields.inc.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/actions_lineupdown.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_linkedfiles.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
- 'htdocs/core/actions_massactions.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
+ 'htdocs/core/actions_massactions.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/actions_printing.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/actions_setmoduleoptions.inc.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable'],
@@ -418,7 +400,7 @@ return [
'htdocs/core/class/emailsenderprofile.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/core/class/evalmath.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/class/events.class.php' => ['PhanPluginUnknownPropertyType'],
- 'htdocs/core/class/extrafields.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodParamType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'],
+ 'htdocs/core/class/extrafields.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'],
'htdocs/core/class/extralanguages.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/core/class/fediverseparser.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/core/class/fileupload.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch'],
@@ -450,8 +432,8 @@ return [
'htdocs/core/class/rssparser.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeExpectedObjectPropAccess'],
'htdocs/core/class/smtps.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchDimFetch'],
'htdocs/core/class/socialnetworkmanager.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
- 'htdocs/core/class/stats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch'],
- 'htdocs/core/class/timespent.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
+ 'htdocs/core/class/stats.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch'],
+ 'htdocs/core/class/timespent.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/core/class/translate.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/core/class/utils.class.php' => ['PhanPluginConstantVariableNull', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/class/validate.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall'],
@@ -572,8 +554,8 @@ return [
'htdocs/core/modules/fichinter/mod_pacific.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
- 'htdocs/core/modules/import/import_csv.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
- 'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
+ 'htdocs/core/modules/import/import_csv.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
+ 'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/core/modules/import/modules_import.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchDimFetch'],
'htdocs/core/modules/mailings/advthirdparties.modules.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/core/modules/mailings/contacts1.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'],
@@ -687,7 +669,7 @@ return [
'htdocs/debugbar/class/DataCollector/DolibarrCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/debugbar/class/TraceableDB.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/delivery/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
- 'htdocs/delivery/class/delivery.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
+ 'htdocs/delivery/class/delivery.class.php' => ['PhanUndeclaredProperty'],
'htdocs/delivery/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'],
'htdocs/document.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/don/admin/donation.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal'],
@@ -724,7 +706,7 @@ return [
'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/eventorganization/conferenceorboothattendee_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/eventorganization/conferenceorboothattendee_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/eventorganization/core/actions_massactions_mail.inc.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
+ 'htdocs/eventorganization/core/actions_massactions_mail.inc.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'],
'htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/eventorganization/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall'],
'htdocs/expedition/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
@@ -756,7 +738,7 @@ return [
'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/fichinter/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'],
- 'htdocs/fichinter/class/fichinter.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall'],
+ 'htdocs/fichinter/class/fichinter.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall'],
'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/fichinter/class/fichinterstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'],
'htdocs/fichinter/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
@@ -836,7 +818,6 @@ return [
'htdocs/install/step5.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/install/upgrade.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/install/upgrade2.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/intracommreport/admin/intracommreport.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/intracommreport/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/intracommreport/class/intracommreport.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/intracommreport/lib/intracommreport.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
@@ -921,9 +902,8 @@ return [
'htdocs/product/inventory/list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
- 'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/product/reassortlot.php' => ['PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'],
+ 'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'],
+ 'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray'],
'htdocs/product/stats/commande.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/product/stats/commande_fournisseur.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/product/stats/facture.php' => ['PhanTypeMismatchArgumentProbablyReal'],
@@ -985,7 +965,7 @@ return [
'htdocs/projet/tasks/comment.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/projet/tasks/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/projet/tasks/document.php' => ['PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/projet/tasks/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
+ 'htdocs/projet/tasks/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/projet/tasks/note.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/projet/tasks/task.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/projet/tasks/time.php' => ['PhanEmptyForeach', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
@@ -1154,7 +1134,6 @@ return [
'htdocs/user/class/usergroup.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/user/group/card.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/user/group/perms.php' => ['PhanPluginUnknownObjectMethodCall'],
- 'htdocs/user/list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/user/param_ihm.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/user/passwordforgotten.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/user/perms.php' => ['PhanPluginUnknownObjectMethodCall'],
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index a201003d083..fe705fa99b8 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -72,6 +72,8 @@ if (isModEnabled('mailmanspip')) {
$langs->load('mailmanspip');
$mailmanspip = new MailmanSpip($db);
+} else {
+ $mailmanspip = null;
}
$object = new Adherent($db);
@@ -114,6 +116,7 @@ if ($id > 0 || !empty($ref)) {
// Define variables to determine what the current user can do on the members
$canaddmember = $user->hasRight('adherent', 'creer');
+$caneditfieldmember = false;
// Define variables to determine what the current user can do on the properties of a member
if ($id) {
$caneditfieldmember = $user->hasRight('adherent', 'creer');
@@ -533,6 +536,7 @@ if (empty($reshook)) {
} else {
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'";
$result = $db->query($sql);
+ $num = 0;
if ($result) {
$num = $db->num_rows($result);
}
@@ -848,18 +852,20 @@ if (empty($reshook)) {
}
// SPIP Management
- if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_del_spip' && $confirm == 'yes') {
- if (!count($object->errors)) {
- if (!$mailmanspip->del_to_spip($object)) {
- setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors');
+ if (is_object($mailmanspip)) {
+ if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_del_spip' && $confirm == 'yes') {
+ if (!count($object->errors)) {
+ if (!$mailmanspip->del_to_spip($object)) {
+ setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors');
+ }
}
}
- }
- if ($user->hasRight('adherent', 'creer') && $action == 'confirm_add_spip' && $confirm == 'yes') {
- if (!count($object->errors)) {
- if (!$mailmanspip->add_to_spip($object)) {
- setEventMessages($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, null, 'errors');
+ if ($user->hasRight('adherent', 'creer') && $action == 'confirm_add_spip' && $confirm == 'yes') {
+ if (!count($object->errors)) {
+ if (!$mailmanspip->add_to_spip($object)) {
+ setEventMessages($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, null, 'errors');
+ }
}
}
}
@@ -980,7 +986,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' ';
}
- print dol_get_fiche_head('');
+ print dol_get_fiche_head(array());
print '
';
print '';
@@ -1201,10 +1207,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$obj = $db->fetch_object($resql);
} else {
dol_print_error($db);
+ $obj = null;
+ }
+ if (is_object($obj)) {
+ $object->country_id = $obj->rowid;
+ $object->country_code = $obj->code;
+ $object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label;
}
- $object->country_id = $obj->rowid;
- $object->country_code = $obj->code;
- $object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label;
}
$head = member_prepare_head($object);
@@ -1397,7 +1406,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Default language
if (getDolGlobalInt('MAIN_MULTILANGS')) {
print ''.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).' '."\n";
- print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1);
+ print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language($object->default_lang, 'default_lang', 0, array(), 1);
print ' ';
print ' ';
}
@@ -1920,7 +1929,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable);
print '';
if ($action == 'editlogin') {
- $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
+ $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', array());
} else {
if ($object->user_id) {
$linkeduser = new User($db);
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 9acc5a1fe78..b5413c0384e 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -294,7 +294,7 @@ class Adherent extends CommonObject
public $last_subscription_amount;
/**
- * @var array
+ * @var Subscription[]
*/
public $subscriptions = array();
@@ -305,6 +305,9 @@ class Adherent extends CommonObject
// Fields loaded by fetchPartnerships() from partnership table
+ /**
+ * @var array>
+ */
public $partnerships = array();
/**
@@ -403,20 +406,20 @@ class Adherent extends CommonObject
/**
* Function sending an email to the current member with the text supplied in parameter.
*
- * @param string $text Content of message (not html entities encoded)
- * @param string $subject Subject of message
- * @param array $filename_list Array of attached files
- * @param array $mimetype_list Array of mime types of attached files
- * @param array $mimefilename_list Array of public names of attached files
- * @param string $addr_cc Email cc
- * @param string $addr_bcc Email bcc
- * @param int $deliveryreceipt Ask a delivery receipt
- * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
- * @param string $errors_to errors to
- * @param string $moreinheader Add more html headers
+ * @param string $text Content of message (not html entities encoded)
+ * @param string $subject Subject of message
+ * @param string[] $filename_list Array of attached files
+ * @param string[] $mimetype_list Array of mime types of attached files
+ * @param string[] $mimefilename_list Array of public names of attached files
+ * @param string $addr_cc Email cc
+ * @param string $addr_bcc Email bcc
+ * @param int $deliveryreceipt Ask a delivery receipt
+ * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
+ * @param string $errors_to errors to
+ * @param string $moreinheader Add more html headers
* @deprecated since V18
* @see sendEmail()
- * @return int Return integer <0 if KO, >0 if OK
+ * @return int Return integer <0 if KO, >0 if OK
*/
public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
{
@@ -429,19 +432,19 @@ class Adherent extends CommonObject
/**
* Function sending an email to the current member with the text supplied in parameter.
*
- * @param string $text Content of message (not html entities encoded)
- * @param string $subject Subject of message
- * @param array $filename_list Array of attached files
- * @param array $mimetype_list Array of mime types of attached files
- * @param array $mimefilename_list Array of public names of attached files
- * @param string $addr_cc Email cc
- * @param string $addr_bcc Email bcc
- * @param int $deliveryreceipt Ask a delivery receipt
- * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
- * @param string $errors_to errors to
- * @param string $moreinheader Add more html headers
+ * @param string $text Content of message (not html entities encoded)
+ * @param string $subject Subject of message
+ * @param string[] $filename_list Array of attached files
+ * @param string[] $mimetype_list Array of mime types of attached files
+ * @param string[] $mimefilename_list Array of public names of attached files
+ * @param string $addr_cc Email cc
+ * @param string $addr_bcc Email bcc
+ * @param int $deliveryreceipt Ask a delivery receipt
+ * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
+ * @param string $errors_to errors to
+ * @param string $moreinheader Add more html headers
* @since V18
- * @return int Return integer <0 if KO, >0 if OK
+ * @return int Return integer <0 if KO, >0 if OK
*/
public function sendEmail($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
{
@@ -1741,7 +1744,7 @@ class Adherent extends CommonObject
$dateop = $paymentdate;
- $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, '', $user, $emetteur_nom, $emetteur_banque);
+ $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, 0, $user, $emetteur_nom, $emetteur_banque);
if ($insertid > 0) {
$inserturlid = $acct->add_url_line($insertid, $this->id, DOL_URL_ROOT.'/adherents/card.php?rowid=', $this->getFullName($langs), 'member');
if ($inserturlid > 0) {
@@ -1864,7 +1867,7 @@ class Adherent extends CommonObject
}
//print xx".$vattouse." - ".$mysoc." - ".$customer;exit;
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
- $result = $invoice->addline($label, 0, 1, $vattouse, 0, 0, $idprodsubscription, 0, $datesubscription, '', 0, 0, '', 'TTC', $amount, 1);
+ $result = $invoice->addline($label, 0, 1, $vattouse, 0, 0, $idprodsubscription, 0, $datesubscription, '', 0, 0, 0, 'TTC', $amount, 1);
if ($result <= 0) {
$this->error = $invoice->error;
$this->errors = $invoice->errors;
@@ -2243,9 +2246,9 @@ class Adherent extends CommonObject
/**
* getTooltipContentArray
- * @param array $params params to construct tooltip data
+ * @param array $params params to construct tooltip data
* @since v18
- * @return array
+ * @return array{picto:string,ref?:string,refsupplier?:string,label?:string,date?:string,date_echeance?:string,amountht?:string,total_ht?:string,totaltva?:string,amountlt1?:string,amountlt2?:string,amountrevenustamp?:string,totalttc?:string}|array{optimize:string}
*/
public function getTooltipContentArray($params)
{
@@ -2398,7 +2401,7 @@ class Adherent extends CommonObject
} elseif ($mode == 'ref') {
$result .= $this->ref;
} else {
- $result .= $this->getFullName($langs, '', ($mode == 'firstname' ? 2 : ($mode == 'lastname' ? 4 : -1)), $maxlen);
+ $result .= $this->getFullName($langs, 0, ($mode == 'firstname' ? 2 : ($mode == 'lastname' ? 4 : -1)), $maxlen);
}
if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$result .= '';
@@ -2611,13 +2614,13 @@ class Adherent extends CommonObject
/**
* Create a document onto disk according to template module.
*
- * @param string $modele Force template to use ('' to not force)
- * @param Translate $outputlangs object lang a utiliser pour traduction
- * @param int $hidedetails Hide details of lines
- * @param int $hidedesc Hide description
- * @param int $hideref Hide ref
- * @param null|array $moreparams Array to provide more information
- * @return int 0 if KO, 1 if OK
+ * @param string $modele Force template to use ('' to not force)
+ * @param Translate $outputlangs object lang a utiliser pour traduction
+ * @param int<0,1> $hidedetails Hide details of lines
+ * @param int<0,1> $hidedesc Hide description
+ * @param int<0,1> $hideref Hide ref
+ * @param ?array $moreparams Array to provide more information
+ * @return int<0,1> 0 if KO, 1 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{
@@ -2716,11 +2719,11 @@ class Adherent extends CommonObject
/**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*
- * @param array $info Info array loaded by _load_ldap_info
- * @param int $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
- * 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
- * 2=Return key only (uid=qqq)
- * @return string DN
+ * @param array $info Info array loaded by _load_ldap_info
+ * @param int<0,2> $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
+ * 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
+ * 2=Return key only (uid=qqq)
+ * @return string DN
*/
public function _load_ldap_dn($info, $mode = 0)
{
@@ -2745,7 +2748,7 @@ class Adherent extends CommonObject
/**
* Initialise tableau info (tableau des attributes LDAP)
*
- * @return array Tableau info des attributes
+ * @return array Tableau info des attributes
*/
public function _load_ldap_info()
{
@@ -3074,7 +3077,7 @@ class Adherent extends CommonObject
while ($i < $num_rows) {
$obj = $this->db->fetch_object($resql);
- $adherent->fetch($obj->rowid, '', '', '', true, true);
+ $adherent->fetch($obj->rowid, '', 0, '', true, true);
if (empty($adherent->email)) {
$nbko++;
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index 497d4e4d8dc..8c1d1f90ec0 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -136,7 +136,7 @@ class AdherentType extends CommonObject
public $email;
/**
- * @var array multilangs
+ * @var array multilangs
*/
public $multilangs = array();
@@ -178,9 +178,9 @@ class AdherentType extends CommonObject
$this->description = $obj->description;
$this->email = $obj->email;
}
- $this->multilangs["$obj->lang"]["label"] = $obj->label;
- $this->multilangs["$obj->lang"]["description"] = $obj->description;
- $this->multilangs["$obj->lang"]["email"] = $obj->email;
+ $this->multilangs[(string) $obj->lang]["label"] = $obj->label;
+ $this->multilangs[(string) $obj->lang]["description"] = $obj->description;
+ $this->multilangs[(string) $obj->lang]["email"] = $obj->email;
}
return 1;
} else {
@@ -638,7 +638,7 @@ class AdherentType extends CommonObject
if ($mode < 2) {
$memberstatic = new Adherent($this->db);
if ($mode == 1) {
- $memberstatic->fetch($obj->rowid, '', '', '', false, false);
+ $memberstatic->fetch($obj->rowid, '', 0, '', false, false);
} else {
$memberstatic->fetch($obj->rowid);
}
@@ -681,9 +681,9 @@ class AdherentType extends CommonObject
/**
* getTooltipContentArray
- * @param array $params params to construct tooltip data
+ * @param array $params params to construct tooltip data
* @since v18
- * @return array
+ * @return array{picto:string,ref?:string,refsupplier?:string,label?:string,date?:string,date_echeance?:string,amountht?:string,total_ht?:string,totaltva?:string,amountlt1?:string,amountlt2?:string,amountrevenustamp?:string,totalttc?:string}|array{optimize:string}
*/
public function getTooltipContentArray($params)
{
@@ -818,7 +818,7 @@ class AdherentType extends CommonObject
/**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*
- * @param array $info Info array loaded by _load_ldap_info
+ * @param array $info Info array loaded by _load_ldap_info
* @param int<0,2> $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
* 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
* 2=Return key only (uid=qqq)
@@ -846,7 +846,7 @@ class AdherentType extends CommonObject
/**
* Initialize the info array (array of LDAP values) that will be used to call LDAP functions
*
- * @return array Tableau info des attributes
+ * @return array Info table with attributes
*/
public function _load_ldap_info()
{
@@ -871,7 +871,7 @@ class AdherentType extends CommonObject
$valueofldapfield = array();
foreach ($this->members as $key => $val) { // This is array of users for group into dolibarr database.
$member = new Adherent($this->db);
- $member->fetch($val->id, '', '', '', false, false);
+ $member->fetch($val->id, '', 0, '', false, false);
$info2 = $member->_load_ldap_info();
$valueofldapfield[] = $member->_load_ldap_dn($info2);
}
diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php
index c515188aa20..27173334e7d 100644
--- a/htdocs/adherents/class/adherentstats.class.php
+++ b/htdocs/adherents/class/adherentstats.class.php
@@ -99,9 +99,9 @@ class AdherentStats extends Stats
/**
* Return the number of proposition by month for a given year
*
- * @param int $year Year
+ * @param int $year Year
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
- * @return array Array of nb each month
+ * @return array,array{0:int<1,12>,1:int}> Array of nb each month
*/
public function getNbByMonth($year, $format = 0)
{
@@ -118,7 +118,7 @@ class AdherentStats extends Stats
/**
* Return the number of subscriptions by year
*
- * @return array Array of nb each year
+ * @return array Array of nb each year
*/
public function getNbByYear()
{
@@ -136,7 +136,7 @@ class AdherentStats extends Stats
*
* @param int $year Year
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
- * @return array Array of amount each month
+ * @return array,array{0:int<1,12>,1:int|float}> Array of values by month
*/
public function getAmountByMonth($year, $format = 0)
{
@@ -153,8 +153,8 @@ class AdherentStats extends Stats
/**
* Return average amount each month
*
- * @param int $year Year
- * @return array Array of average each month
+ * @param int $year Year
+ * @return array,array{0:int<1,12>,1:int|float}> Array of average each month
*/
public function getAverageByMonth($year)
{
@@ -172,7 +172,7 @@ class AdherentStats extends Stats
/**
* Return nb, total and average
*
- * @return array Array with nb, total amount, average for each year
+ * @return array Array with nb, total amount, average for each year
*/
public function getAllByYear()
{
diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php
index 7d147435108..6f09b14c933 100644
--- a/htdocs/adherents/class/api_members.class.php
+++ b/htdocs/adherents/class/api_members.class.php
@@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
class Members extends DolibarrApi
{
/**
- * @var array $FIELDS Mandatory fields, checked when create and update object
+ * @var string[] $FIELDS Mandatory fields, checked when create and update object
*/
public static $FIELDS = array(
'morphy',
@@ -214,6 +214,8 @@ class Members extends DolibarrApi
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
* @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0*
* @return array Array of member objects
+ * @phan-return array>
+ * @phpstan-return array>
*
* @throws RestException 400 Error on SQL filters
* @throws RestException 403 Access denied
@@ -304,7 +306,7 @@ class Members extends DolibarrApi
/**
* Create member object
*
- * @param array $request_data Request data
+ * @param array $request_data Request data
* @return int ID of member
*
* @throws RestException 403 Access denied
@@ -339,6 +341,8 @@ class Members extends DolibarrApi
*
* @param int $id ID of member to update
* @param array $request_data Datas
+ * @phan-param ?array $request_data
+ * @phpstan-param ?array $request_data
* @return Object Updated object
*
* @throws RestException 403 Access denied
@@ -414,6 +418,8 @@ class Members extends DolibarrApi
*
* @param int $id member ID
* @return array
+ * @phan-return array
+ * @phpstan-return array
*
* @throws RestException 403 Access denied
* @throws RestException 404 Member not found
@@ -451,8 +457,9 @@ class Members extends DolibarrApi
/**
* Validate fields before creating an object
*
- * @param array|null $data Data to validate
- * @return array Return array with validated mandatory fields and their value
+ * @param array $data Data to validate
+ * @return array Return array with validated mandatory fields and their value
+ * @phan-return array Return array with validated mandatory fields and their value
*
* @throws RestException
*/
@@ -553,6 +560,8 @@ class Members extends DolibarrApi
*
* @param int $id ID of member
* @return array Array of subscription objects
+ * @phan-return Object[]
+ * @phpstan-return Object[]
*
* @url GET {id}/subscriptions
*
@@ -690,6 +699,8 @@ class Members extends DolibarrApi
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
* @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0*
* @return array Array of member type objects
+ * @phan-return array>
+ * @phpstan-return array>
*
* @url GET /types/
*
@@ -772,6 +783,8 @@ class Members extends DolibarrApi
* Create member type object
*
* @param array $request_data Request data
+ * @phan-param ?array $request_data
+ * @phpstan-param ?array $request_data
* @return int ID of member type
*
* @url POST /types/
@@ -808,6 +821,8 @@ class Members extends DolibarrApi
*
* @param int $id ID of member type to update
* @param array $request_data Datas
+ * @phan-param ?array $request_data
+ * @phpstan-param ?array $request_data
* @return Object Updated object
*
* @url PUT /types/{id}
@@ -866,6 +881,8 @@ class Members extends DolibarrApi
*
* @param int $id member type ID
* @return array
+ * @phan-return array
+ * @phpstan-return array
*
* @url DELETE /types/{id}
*
@@ -904,8 +921,8 @@ class Members extends DolibarrApi
/**
* Validate fields before creating an object
*
- * @param array|null $data Data to validate
- * @return array
+ * @param ?array $data Data to validate
+ * @return array
*
* @throws RestException
*/
diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php
index 9bf7b04d91c..88b60506280 100644
--- a/htdocs/adherents/class/api_subscriptions.class.php
+++ b/htdocs/adherents/class/api_subscriptions.class.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
class Subscriptions extends DolibarrApi
{
/**
- * @var array $FIELDS Mandatory fields, checked when create and update object
+ * @var string[] $FIELDS Mandatory fields, checked when create and update object
*/
public static $FIELDS = array(
'fk_adherent',
@@ -85,6 +86,8 @@ class Subscriptions extends DolibarrApi
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
* @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0*
* @return array Array of subscription objects
+ * @phan-return array{data:Subscription[],pagination:array{total:int,page:int,page_count:int,limit:int}}|array
+ * @phpstan-return array{data:Subscription[],pagination:array{total:int,page:int,page_count:int,limit:int}}|array
*
* @throws RestException 403 Access denied
* @throws RestException 404 No Subscription found
@@ -165,6 +168,8 @@ class Subscriptions extends DolibarrApi
* Create subscription object
*
* @param array $request_data Request data
+ * @phan-param array $request_data
+ * @phpstan-param array $request_data
* @return int ID of subscription
*
* @throws RestException 403 Access denied
@@ -198,7 +203,9 @@ class Subscriptions extends DolibarrApi
* Update subscription
*
* @param int $id ID of subscription to update
- * @param array $request_data Datas
+ * @param array $request_data Data
+ * @phan-param array $request_data
+ * @phpstan-param array $request_data
* @return Object Updated object
*
* @throws RestException 403 Access denied
@@ -242,6 +249,8 @@ class Subscriptions extends DolibarrApi
*
* @param int $id ID of subscription to delete
* @return array
+ * @phan-return array
+ * @phpstan-return array
*
* @throws RestException 403 Access denied
* @throws RestException 404 No Subscription found
@@ -278,8 +287,8 @@ class Subscriptions extends DolibarrApi
/**
* Validate fields before creating an object
*
- * @param array|null $data Data to validate
- * @return array
+ * @param ?array $data Data to validate
+ * @return array
*
* @throws RestException
*/
diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php
index 5f56609fd0d..dee174fb5db 100644
--- a/htdocs/adherents/class/subscription.class.php
+++ b/htdocs/adherents/class/subscription.class.php
@@ -344,9 +344,9 @@ class Subscription extends CommonObject
/**
* Delete a subscription
*
- * @param User $user User that delete
- * @param int $notrigger 0=launch triggers after, 1=disable triggers
- * @return int Return integer <0 if KO, 0 if not found, >0 if OK
+ * @param User $user User that delete
+ * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers
+ * @return int Return integer <0 if KO, 0 if not found, >0 if OK
*/
public function delete($user, $notrigger = 0)
{
@@ -357,6 +357,8 @@ class Subscription extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline = new AccountLine($this->db);
$result = $accountline->fetch($this->fk_bank);
+ } else {
+ $accountline = null;
}
$this->db->begin();
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index c38e698ec7e..f9ccf9e4af9 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -229,6 +229,10 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
$massaction = '';
}
+$permissiontoread = 0;
+$permissiontodelete = 0;
+$permissiontoadd = 0;
+
$parameters = array('socid' => isset($socid) ? $socid : null, 'arrayfields' => &$arrayfields);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
@@ -1238,12 +1242,15 @@ while ($i < $imaxinloop) {
if ($memberstatic->thirdparty->id > 0) {
$companyname = $memberstatic->thirdparty->name;
$companynametoshow = $memberstatic->thirdparty->getNomUrl(1);
+ } else {
+ $companyname = null;
+ $companynametoshow = null;
}
} else {
$companyname = $obj->company;
$companynametoshow = $obj->company;
}
- $memberstatic->company = $companyname;
+ $memberstatic->company = (string) $companyname;
$object = $memberstatic;
diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php
index 3a176747716..297b0ea6284 100644
--- a/htdocs/adherents/note.php
+++ b/htdocs/adherents/note.php
@@ -3,6 +3,7 @@
* Copyright (C) 2004-2014 Laurent Destailleur
* Copyright (C) 2015 Frederic France
* Copyright (C) 2024 Alexandre Spangaro
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -49,6 +50,8 @@ $result = $object->fetch($id);
if ($result > 0) {
$adht = new AdherentType($db);
$result = $adht->fetch($object->typeid);
+} else {
+ $adht = null;
}
@@ -107,7 +110,7 @@ llxHeader("", $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-card_not
$form = new Form($db);
-if ($id) {
+if (is_object($adht)) {
$head = member_prepare_head($object);
print dol_get_fiche_head($head, 'note', $langs->trans("Member"), -1, 'user');
diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php
index 78cd1ec763b..30e958d7b83 100644
--- a/htdocs/adherents/stats/geo.php
+++ b/htdocs/adherents/stats/geo.php
@@ -85,14 +85,16 @@ llxHeader('', $title, $help_url, '', 0, 0, $arrayjs, '', '', 'mod-member page-st
print load_fiche_titre($title, '', $memberstatic->picto);
//dol_mkdir($dir);
+$data = array();
+$tab = null;
if ($mode) {
// Define sql
+ $sql = null;
if ($mode == 'memberbycountry') {
$label = $langs->trans("Country");
$tab = 'statscountry';
- $data = array();
$sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
@@ -160,7 +162,12 @@ if ($mode) {
// Define $data array
dol_syslog("Count member", LOG_DEBUG);
- $resql = $db->query($sql);
+ if ($sql != null) {
+ $resql = $db->query($sql);
+ } else {
+ $resql = false;
+ dol_syslog(__FILE__.":No SQL, invalid mode '$mode'", LOG_ERR);
+ }
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
@@ -314,7 +321,6 @@ if ($mode) {
print '';
foreach ($data as $val) {
- $year = isset($val['year']) ? $val['year'] : '';
print '';
print ''.$val['label'].' ';
if (isset($label2)) {
diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php
index 6a06fa470e3..b886379854f 100644
--- a/htdocs/adherents/stats/index.php
+++ b/htdocs/adherents/stats/index.php
@@ -128,6 +128,7 @@ $mesg = $px2->isGraphKo();
if (!$mesg) {
$px2->SetData($data);
$i = $startyear;
+ $legend = array();
while ($i <= $endyear) {
$legend[] = $i;
$i++;
@@ -189,7 +190,7 @@ print ' ';
$oldyear = 0;
foreach ($data as $val) {
- $year = $val['year'];
+ $year = (int) $val['year'];
while ($oldyear > $year + 1) { // If we have empty year
$oldyear--;
print '';
diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index c7eda4dbaf3..a1ccc1a2616 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -7,6 +7,7 @@
* Copyright (C) 2018-2024 Frédéric France
* Copyright (C) 2019 Thibault FOUCART
* Copyright (C) 2023 Waël Almoman
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -661,7 +662,7 @@ if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) {
print '
';
print '';
if ($action == 'editlogin') {
- $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
+ $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', array());
} else {
if ($object->user_id) {
$linkeduser = new User($db);
@@ -947,7 +948,7 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h
print ' ';
print ' ';
- print dol_get_fiche_head('');
+ print dol_get_fiche_head(array());
print '';
print '
'."\n";
diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php
index 732f1ea8b50..3d69be5edf3 100644
--- a/htdocs/adherents/subscription/list.php
+++ b/htdocs/adherents/subscription/list.php
@@ -3,6 +3,7 @@
* Copyright (C) 2003 Jean-Louis Bergamo
* Copyright (C) 2004-2023 Laurent Destailleur
* Copyright (C) 2024 Alexandre Spangaro
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -385,6 +386,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) {
$setupstring = '';
+ // @phan-suppress-next-line PhanEmptyForeach
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";";
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index 1e0c3498453..ea47097002e 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -92,7 +92,7 @@ $comment = GETPOST("comment", 'restricthtml');
$mail_valid = GETPOST("mail_valid", 'restricthtml');
$caneditamount = GETPOSTINT("caneditamount");
-// Initialize a technical objects
+// Initialize a technical object
$object = new AdherentType($db);
$extrafields = new ExtraFields($db);
$hookmanager->initHooks(array('membertypecard', 'globalcard'));
@@ -108,7 +108,7 @@ $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
* Actions
*/
-if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
+if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_ref = "";
$search_lastname = "";
$search_login = "";
@@ -168,7 +168,7 @@ if ($action == 'add' && $user->hasRight('adherent', 'configurer')) {
if ($num) {
$error++;
$langs->load("errors");
- setEventMessages($langs->trans("ErrorLabelAlreadyExists", $login), null, 'errors');
+ setEventMessages($langs->trans("ErrorLabelAlreadyExists", $object->label), null, 'errors');
}
}
@@ -443,8 +443,6 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
// Creation
if ($action == 'create') {
- $object = new AdherentType($db);
-
print load_fiche_titre($langs->trans("NewMemberType"), '', 'members');
print '