From 0ac595364bcff45c438849a18892ef47c699c1e7 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 25 Oct 2024 21:00:02 +0200 Subject: [PATCH] Qual: Fix phan/phpstan notices in class files (part 1) (#31501) * Ignore phpstan configuration for spelling * Qual: Fix phan notices in class files --- dev/tools/phan/baseline.txt | 63 +++++++------------ dev/tools/phan/config.php | 1 + htdocs/accountancy/journal/bankjournal.php | 18 +++--- .../class/assetaccountancycodes.class.php | 7 ++- .../class/assetdepreciationoptions.class.php | 8 +-- htdocs/asset/class/assetmodel.class.php | 2 +- .../tpl/depreciation_options_view.tpl.php | 3 +- htdocs/asset/tpl/depreciation_view.tpl.php | 4 +- htdocs/bom/class/bom.class.php | 6 +- .../comm/action/class/cactioncomm.class.php | 17 ++--- htdocs/comm/action/class/ical.class.php | 35 ++++++----- .../mailing/class/advtargetemailing.class.php | 29 ++++----- .../html.formadvtargetemailing.class.php | 16 ++--- htdocs/comm/mailing/class/mailing.class.php | 6 +- htdocs/comm/propal/class/propal.class.php | 34 +++++----- htdocs/comm/propal/list.php | 2 +- htdocs/compta/bank/bankentries_list.php | 18 +++--- htdocs/compta/bank/class/account.class.php | 45 +++++++++---- htdocs/compta/bank/class/bankcateg.class.php | 4 +- .../deplacement/class/deplacement.class.php | 11 +++- .../facture/class/facturestats.class.php | 18 ++++++ .../facture/class/paymentterm.class.php | 28 +++++++++ .../compta/localtax/class/localtax.class.php | 17 ++++- .../cheque/class/remisecheque.class.php | 35 ++++++++++- .../compta/paiement/class/cpaiement.class.php | 21 +++++-- .../compta/paiement/class/paiement.class.php | 22 ++++--- .../class/rejetprelevement.class.php | 21 +++++-- .../sociales/class/cchargesociales.class.php | 35 ++++++++--- .../class/paymentsocialcontribution.class.php | 2 +- htdocs/compta/tva/class/paymentvat.class.php | 2 +- htdocs/compta/tva/class/tva.class.php | 4 +- .../actions_contactcard_common.class.php | 34 +++++++--- htdocs/contact/class/contact.class.php | 48 ++++++++++---- htdocs/core/class/ccountry.class.php | 15 ++++- htdocs/core/class/cgenericdic.class.php | 6 ++ htdocs/core/class/commonhookactions.class.php | 4 +- .../class/commonstickergenerator.class.php | 14 +++-- htdocs/core/class/html.formactions.class.php | 13 ++-- htdocs/core/lib/format_cards.lib.php | 2 +- .../modules/cheque/modules_chequereceipts.php | 12 ++++ .../member/doc/pdf_standard_member.class.php | 5 +- .../doc/pdf_standardlabel.class.php | 8 ++- .../printsheet/doc/pdf_tcpdflabel.class.php | 8 ++- phpstan.neon.dist | 2 + pyproject.toml | 2 +- 45 files changed, 481 insertions(+), 226 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 581e6260bedcc..c9506b8fe3917 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -14,39 +14,40 @@ return [ // PhanPossiblyUndeclaredGlobalVariable : 580+ occurrences // PhanTypeMismatchArgumentProbablyReal : 400+ occurrences // PhanUndeclaredGlobalVariable : 350+ occurrences - // PhanPluginUnknownArrayMethodReturnType : 300+ occurrences - // PhanPluginUnknownArrayMethodParamType : 240+ occurrences + // PhanPluginUnknownArrayMethodReturnType : 290+ occurrences + // PhanPluginUnknownArrayMethodParamType : 220+ occurrences // PhanPossiblyUndeclaredVariable : 200+ occurrences - // PhanTypeMismatchProperty : 160+ occurrences + // PhanTypeMismatchProperty : 170+ occurrences // PhanPluginUnknownArrayFunctionParamType : 95+ occurrences // PhanPluginUndeclaredVariableIsset : 65+ occurrences // PhanTypeMismatchArgumentNullableInternal : 65+ occurrences - // PhanPluginUnknownArrayPropertyType : 55+ occurrences // PhanPluginUnknownArrayFunctionReturnType : 50+ occurrences // PhanRedefineFunction : 50+ occurrences // PhanPluginEmptyStatementIf : 45+ occurrences + // PhanPluginUnknownArrayPropertyType : 40+ occurrences // PhanTypeExpectedObjectPropAccess : 40+ occurrences // PhanTypeInvalidDimOffset : 35+ occurrences // PhanTypeMismatchDimFetch : 30+ occurrences // PhanPluginUnknownObjectMethodCall : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences - // PhanUndeclaredMethod : 15+ occurrences // PhanEmptyForeach : 10+ occurrences // PhanPluginConstantVariableNull : 10+ occurrences // PhanPossiblyNullTypeMismatchProperty : 10+ occurrences // PhanTypeArraySuspiciousNull : 10+ occurrences // PhanTypeComparisonFromArray : 10+ occurrences // PhanTypeMismatchDimFetchNullable : 10+ occurrences + // PhanUndeclaredMethod : 10+ occurrences + // PhanPluginSuspiciousParamPosition : 9 occurrences // PhanPluginBothLiteralsBinaryOp : 8 occurrences - // PhanPluginSuspiciousParamPosition : 8 occurrences // PhanPluginDuplicateExpressionBinaryOp : 7 occurrences - // PhanPossiblyNullTypeMismatchProperty : 6 occurrences + // PhanPossiblyNullTypeMismatchProperty : 7 occurrences // PhanParamTooMany : 5 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences // PhanEmptyFQSENInClasslike : 3 occurrences // PhanInvalidFQSENInClasslike : 3 occurrences // PhanTypeExpectedObjectPropAccessButGotNull : 2 occurrences // PhanAccessMethodProtected : 1 occurrence + // PhanParamTooFew : 1 occurrence // PhanTypeConversionFromArray : 1 occurrence // Currently, file_suppressions and directory_suppressions are the only supported suppressions @@ -62,8 +63,7 @@ return [ 'htdocs/api/class/api_status.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/asset/admin/setup.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset'], - 'htdocs/asset/class/assetaccountancycodes.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], - 'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanTypeInvalidDimOffset'], + 'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'], 'htdocs/asset/depreciation.php' => ['PhanPluginEmptyStatementIf'], 'htdocs/asset/disposal.php' => ['PhanPluginEmptyStatementIf'], @@ -78,7 +78,6 @@ return [ 'htdocs/bom/bom_card.php' => ['PhanUndeclaredProperty'], 'htdocs/bom/bom_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bom/class/api_boms.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/bom/class/bom.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/bom/tpl/objectline_edit.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/bom/tpl/objectline_view.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/bookcal/availabilities_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], @@ -99,7 +98,6 @@ return [ 'htdocs/comm/action/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/comm/action/class/api_agendaevents.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeMismatchProperty'], 'htdocs/comm/action/class/cactioncomm.class.php' => ['PhanPluginUnknownArrayPropertyType'], - 'htdocs/comm/action/class/ical.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/comm/action/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/comm/action/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], 'htdocs/comm/action/info.php' => ['PhanUndeclaredProperty'], @@ -108,14 +106,10 @@ return [ 'htdocs/comm/action/peruser.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeComparisonFromArray'], 'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/comm/mailing/cibles.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/comm/mailing/class/advtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'], - 'htdocs/comm/mailing/class/html.formadvtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/comm/mailing/class/mailing.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'], 'htdocs/comm/propal/card.php' => ['PhanTypeMismatchProperty'], 'htdocs/comm/propal/class/api_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/comm/propal/class/propal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/comm/propal/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/comm/propal/list.php' => ['PhanUndeclaredProperty'], 'htdocs/comm/propal/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/commande/class/api_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/commande/class/commande.class.php' => ['PhanUndeclaredProperty'], @@ -128,9 +122,8 @@ return [ 'htdocs/compta/bank/annuel.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/bank/bankentries_list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/bank/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/bank/class/account.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], + 'htdocs/compta/bank/class/account.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/bank/class/api_bankaccounts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/bank/class/bankcateg.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/compta/bank/graph.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/bank/line.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/bank/releve.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -144,15 +137,12 @@ return [ 'htdocs/compta/cashcontrol/cashcontrol_list.php' => ['PhanTypeMismatchProperty'], 'htdocs/compta/charges/index.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/deplacement/class/deplacement.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/compta/deplacement/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginEmptyStatementIf'], 'htdocs/compta/facture/card.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/facture/class/facturestats.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/compta/facture/class/paymentterm.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/compta/facture/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/invoicetemplate_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], @@ -164,23 +154,19 @@ return [ 'htdocs/compta/journal/purchasesjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/journal/sellsjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/localtax/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/localtax/class/localtax.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/localtax/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/localtax/index.php' => ['PhanRedefineFunction'], 'htdocs/compta/localtax/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/paiement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetch'], 'htdocs/compta/paiement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/paiement/cheque/card.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/compta/paiement/cheque/class/remisecheque.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod'], - 'htdocs/compta/paiement/cheque/list.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/compta/paiement/class/cpaiement.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/compta/paiement/class/paiement.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/paiement/cheque/list.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/paiement/class/paiement.class.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/compta/paiement/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/paiement_charge.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/paiement_vat.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/payment_vat/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/prelevement/class/rejetprelevement.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], 'htdocs/compta/prelevement/demandes.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/factures.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/line.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -190,8 +176,6 @@ return [ 'htdocs/compta/resultat/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/resultat/result.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/sociales/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], - 'htdocs/compta/sociales/class/cchargesociales.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], - 'htdocs/compta/sociales/class/paymentsocialcontribution.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/sociales/list.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/compta/sociales/payments.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/stats/byratecountry.php' => ['PhanPluginEmptyStatementIf'], @@ -203,15 +187,12 @@ return [ 'htdocs/compta/stats/supplier_turnover_by_prodserv.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/stats/supplier_turnover_by_thirdparty.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/tva/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/compta/tva/class/tva.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/tva/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/tva/index.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/tva/payments.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/tva/quadri_detail.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchProperty'], - 'htdocs/contact/canvas/actions_contactcard_common.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], 'htdocs/contact/card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], - 'htdocs/contact/class/contact.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], 'htdocs/contact/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contact/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contact/perso.php' => ['PhanTypeMismatchProperty'], @@ -258,14 +239,13 @@ return [ 'htdocs/core/boxes/box_task.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/boxes/box_validated_projects.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/canvas.class.php' => ['PhanParamTooMany', 'PhanUndeclaredMethod'], - 'htdocs/core/class/ccountry.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/cgenericdic.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'], + 'htdocs/core/class/ccountry.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/class/cgenericdic.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'], 'htdocs/core/class/commonorder.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/commonpeople.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/commonsocialnetworks.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/class/commonstickergenerator.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/conf.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchProperty'], 'htdocs/core/class/ctypent.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/ctyperesource.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], @@ -354,7 +334,7 @@ return [ 'htdocs/core/modules/barcode/modules_barcode.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/cheque/doc/pdf_blochet.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/cheque/modules_chequereceipts.php' => ['PhanUndeclaredMethod'], + 'htdocs/core/modules/cheque/modules_chequereceipts.php' => ['PhanParamTooFew', 'PhanPluginSuspiciousParamPosition'], 'htdocs/core/modules/commande/doc/pdf_einstein.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/commande/modules_commande.php' => ['PhanPluginUnknownPropertyType'], @@ -377,7 +357,7 @@ return [ 'htdocs/core/modules/mailings/modules_mailings.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/core/modules/mailings/thirdparties.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/member/doc/doc_generic_member_odt.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/member/doc/pdf_standard_member.class.php' => ['PhanPluginUnknownArrayMethodParamType'], + 'htdocs/core/modules/member/doc/pdf_standard_member.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchProperty'], 'htdocs/core/modules/member/modules_cards.php' => ['PhanPluginUnknownArrayFunctionParamType'], 'htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], @@ -385,8 +365,8 @@ return [ 'htdocs/core/modules/oauth/github_oauthcallback.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/modules/printing/modules_printing.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/printing/printgcp.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], - 'htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php' => ['PhanPluginUnknownArrayMethodParamType'], + 'htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchProperty'], + 'htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchProperty'], 'htdocs/core/modules/printsheet/modules_labels.php' => ['PhanParamTooMany'], 'htdocs/core/modules/product/doc/pdf_standard.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php' => ['PhanUndeclaredProperty'], @@ -781,6 +761,7 @@ return [ 'htdocs/societe/class/api_contacts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/societe/class/api_thirdparties.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/societe/class/client.class.php' => ['PhanPluginUnknownArrayPropertyType'], + 'htdocs/societe/class/societe.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/societe/class/societeaccount.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 712e14e87b7fa..476b3a85580b7 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -223,6 +223,7 @@ 'simplify_ast' => true, 'analyzed_file_extensions' => ['php','inc'], 'globals_type_map' => [ + '_Avery_Labels' => 'array', 'action' => 'string', 'actioncode' => 'string', 'badgeStatus0' => 'string', diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index b80276bb527e1..3b782f92c901a 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -400,12 +400,12 @@ if ($links[$key]['type'] == 'payment') { $paymentstatic->id = $links[$key]['url_id']; - $paymentstatic->ref = $links[$key]['url_id']; + $paymentstatic->ref = (string) $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this $tabpay[$obj->rowid]["paymentid"] = $paymentstatic->id; } elseif ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; - $paymentsupplierstatic->ref = $links[$key]['url_id']; + $paymentsupplierstatic->ref = (string) $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsupplierstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentsupplierid"] = $paymentsupplierstatic->id; } elseif ($links[$key]['type'] == 'company') { @@ -451,7 +451,7 @@ } } elseif ($links[$key]['type'] == 'sc') { $chargestatic->id = $links[$key]['url_id']; - $chargestatic->ref = $links[$key]['url_id']; + $chargestatic->ref = (string) $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2); $reg = array(); @@ -486,14 +486,14 @@ } } elseif ($links[$key]['type'] == 'payment_donation') { $paymentdonstatic->id = $links[$key]['url_id']; - $paymentdonstatic->ref = $links[$key]['url_id']; + $paymentdonstatic->ref = (string) $links[$key]['url_id']; $paymentdonstatic->fk_donation = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id; $tabtp[$obj->rowid][$account_pay_donation] = isset($tabtp[$obj->rowid][$account_pay_donation]) ? $tabtp[$obj->rowid][$account_pay_donation] + $amounttouse : $amounttouse; } elseif ($links[$key]['type'] == 'member') { $paymentsubscriptionstatic->id = $links[$key]['url_id']; - $paymentsubscriptionstatic->ref = $links[$key]['url_id']; + $paymentsubscriptionstatic->ref = (string) $links[$key]['url_id']; $paymentsubscriptionstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id; @@ -501,14 +501,14 @@ $tabtp[$obj->rowid][$account_pay_subscription] = isset($tabtp[$obj->rowid][$account_pay_subscription]) ? $tabtp[$obj->rowid][$account_pay_subscription] + $amounttouse : $amounttouse; } elseif ($links[$key]['type'] == 'payment_vat') { // Payment VAT $paymentvatstatic->id = $links[$key]['url_id']; - $paymentvatstatic->ref = $links[$key]['url_id']; + $paymentvatstatic->ref = (string) $links[$key]['url_id']; $paymentvatstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id; $tabtp[$obj->rowid][$account_pay_vat] = isset($tabtp[$obj->rowid][$account_pay_vat]) ? $tabtp[$obj->rowid][$account_pay_vat] + $amounttouse : $amounttouse; } elseif ($links[$key]['type'] == 'payment_salary') { $paymentsalstatic->id = $links[$key]['url_id']; - $paymentsalstatic->ref = $links[$key]['url_id']; + $paymentsalstatic->ref = (string) $links[$key]['url_id']; $paymentsalstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsalstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id; @@ -556,7 +556,7 @@ $tabpay[$obj->rowid]["paymentexpensereport"] = $paymentexpensereportstatic->id; } elseif ($links[$key]['type'] == 'payment_various') { $paymentvariousstatic->id = $links[$key]['url_id']; - $paymentvariousstatic->ref = $links[$key]['url_id']; + $paymentvariousstatic->ref = (string) $links[$key]['url_id']; $paymentvariousstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentvariousstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id; @@ -567,7 +567,7 @@ $tabtp[$obj->rowid][$account_subledger] = isset($tabtp[$obj->rowid][$account_subledger]) ? $tabtp[$obj->rowid][$account_subledger] + $amounttouse : $amounttouse; } elseif ($links[$key]['type'] == 'payment_loan') { $paymentloanstatic->id = $links[$key]['url_id']; - $paymentloanstatic->ref = $links[$key]['url_id']; + $paymentloanstatic->ref = (string) $links[$key]['url_id']; $paymentloanstatic->fk_loan = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentloanstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id; diff --git a/htdocs/asset/class/assetaccountancycodes.class.php b/htdocs/asset/class/assetaccountancycodes.class.php index 88c71d8688917..7dd2ad2ef80b5 100644 --- a/htdocs/asset/class/assetaccountancycodes.class.php +++ b/htdocs/asset/class/assetaccountancycodes.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 @@ -29,7 +30,7 @@ class AssetAccountancyCodes extends CommonObject { /** - * @var array Array with all accountancy codes info by mode. + * @var array>> Array with all accountancy codes info by mode. * Note : 'economic' mode is mandatory and is the primary accountancy codes * 'depreciation_asset' and 'depreciation_expense' is mandatory and is used for write depreciation in bookkeeping */ @@ -64,7 +65,7 @@ class AssetAccountancyCodes extends CommonObject ); /** - * @var array Array with all accountancy codes by mode. + * @var array> Array with all accountancy codes by mode. */ public $accountancy_codes = array(); @@ -81,7 +82,7 @@ public function __construct(DoliDB $db) /** * Fill accountancy_codes property of object (using for data sent by forms) * - * @return array Array of values + * @return array> Array of values */ public function setAccountancyCodesFromPost() { diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index eefaf8e3a2b8a..6a6bfed6ef266 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -70,8 +70,8 @@ class AssetDepreciationOptions extends CommonObject public $fields = array(); /** - * @var array Array with all deprecation options info by mode. - * Note : economic mode is mandatory and is the primary options + * @var array|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}>}> + * Note : economic mode is mandatory and is the primary option */ public $deprecation_options_fields = array( 'economic' => array( @@ -119,7 +119,7 @@ class AssetDepreciationOptions extends CommonObject public $fk_user_modif; /** - * @var array Array with all deprecation options by mode. + * @var array> Array with all deprecation options by mode. */ public $deprecation_options = array(); @@ -174,7 +174,7 @@ public function __construct(DoliDB $db) * Set object infos for a mode * * @param string $mode Depreciation mode (economic, accelerated_depreciation, ...) - * @param int $class_type Type (0:asset, 1:asset model) + * @param int<0,1> $class_type Type (0:asset, 1:asset model) * @param bool $all_field Get all fields * @return int Return integer <0 if KO, >0 if OK */ diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index 5e9e32e7fa523..ac9dc8c778c62 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -383,7 +383,7 @@ public function fetchLines() * @param string $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return AssetModel[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { diff --git a/htdocs/asset/tpl/depreciation_options_view.tpl.php b/htdocs/asset/tpl/depreciation_options_view.tpl.php index a99d0ec3090d2..e065f7890e04f 100644 --- a/htdocs/asset/tpl/depreciation_options_view.tpl.php +++ b/htdocs/asset/tpl/depreciation_options_view.tpl.php @@ -77,7 +77,8 @@ } } // Discard if extrafield is a hidden field on form - if (abs($field_info['visible']) != 1 && abs($field_info['visible']) != 3 && abs($field_info['visible']) != 4 && abs($field_info['visible']) != 5) { + $isVisibleAbs = array_key_exists('visible', $field_info) ? abs((int) $field_info['visible']) : 0; + if (!in_array($isVisibleAbs, array(1, 3, 4, 5))) { continue; } if (array_key_exists('enabled', $field_info) && isset($field_info['enabled']) && !verifCond($field_info['enabled'])) { diff --git a/htdocs/asset/tpl/depreciation_view.tpl.php b/htdocs/asset/tpl/depreciation_view.tpl.php index 3480a91b0b5dd..1c5ebdfcba42e 100644 --- a/htdocs/asset/tpl/depreciation_view.tpl.php +++ b/htdocs/asset/tpl/depreciation_view.tpl.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 @@ -77,7 +78,8 @@ } } // Discard if extrafield is a hidden field on form - if (abs($field_info['visible']) != 1 && abs($field_info['visible']) != 3 && abs($field_info['visible']) != 4 && abs($field_info['visible']) != 5) { + $isVisibleAbs = array_key_exists('visible', $field_info) ? abs((int) $field_info['visible']) : 0; + if (!in_array($isVisibleAbs, array(1, 3, 4, 5))) { continue; } if (array_key_exists('enabled', $field_info) && isset($field_info['enabled']) && !verifCond($field_info['enabled'])) { diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index ac615c7875186..30de29d295ba9 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -590,7 +590,7 @@ public function delete(User $user, $notrigger = 1) * @param ?int $fk_bom_child Id of BOM Child * @param ?string $import_key Import Key * @param int $fk_unit Unit - * @param array $array_options extrafields array + * @param array $array_options extrafields array * @param ?int $fk_default_workstation Default workstation * @return int<-3,max> Return integer <0 if KO, Id of created object if OK */ @@ -698,7 +698,7 @@ public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_chang * @param int<-1,max> $position Position of BOM-Line in BOM-Lines * @param ?string $import_key Import Key * @param int $fk_unit Unit of line - * @param array $array_options extrafields array + * @param array $array_options extrafields array * @param ?int $fk_default_workstation Default workstation * @return int<-3,max> Return integer <0 if KO, Id of updated BOM-Line if OK */ @@ -1299,7 +1299,7 @@ public function getLinesArray() * @param int<0,1> $hidedetails Hide details of lines * @param int<0,1> $hidedesc Hide description * @param int<0,1> $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @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) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 7054b13febe57..57d266226bdf0 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2014 Laurent Destailleur + * 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 @@ -55,7 +56,7 @@ class CActionComm /** * @var string label - * @deprecated + * @deprecated Use $label * @see $label */ public $libelle; @@ -87,7 +88,7 @@ class CActionComm /** - * @var array Used to return value by some methods + * @var array{id:array,code:array,all:array} Used to return value by some methods */ public $liste_array; @@ -148,13 +149,13 @@ public function fetch($id) /** * Return list of event types: array(id=>label) or array(code=>label) * - * @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter) - * @param string $idorcode 'id' or 'code' or 'all' - * @param string $excludetype Type to exclude ('system' or 'systemauto') - * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1 or -2=Keep details and add a combined line per calendar (Default, Auto, BoothConf, ...) + * @param ''|int<0,1> $active 1 or 0 to filter on event state active or not ('' by default = no filter) + * @param 'id'|'code'|'all' $idorcode 'id' or 'code' or 'all' + * @param string $excludetype Type to exclude ('system' or 'systemauto') + * @param int<-2,1> $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1 or -2=Keep details and add a combined line per calendar (Default, Auto, BoothConf, ...) * @param string $morefilter Add more SQL filter - * @param int $shortlabel 1=Get short label instead of long label - * @return array|int Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. + * @param int<0,1> $shortlabel 1=Get short label instead of long label + * @return int<-1,-1>|array{id:array,code:array,all:array,AC_OTH_AUTO?:mixed} Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. */ public function liste_array($active = '', $idorcode = 'id', $excludetype = '', $onlyautoornot = 0, $morefilter = '', $shortlabel = 0) { diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index c6ee7f7908698..da00314965723 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -45,7 +45,7 @@ class ICal public $file_text; /** - * @var array Array to save iCalendar parse data + * @var array>>>|array>>>|array>>|array>> Array to save iCalendar parse data */ public $cal; @@ -138,7 +138,7 @@ public function get_todo_count() * @param string $uri Url * @param string $usecachefile Full path of a cache file to use a cache file * @param int $delaycache Delay in seconds for cache (by default 3600 secondes) - * @return array|string + * @return string|array>>>|array>>>|array>>|array>> */ public function parse($uri, $usecachefile = '', $delaycache = 3600) { @@ -277,12 +277,15 @@ public function add_to_array($type, $key, $value) $key = $this->last_key; switch ($type) { case 'VEVENT': + // @phan-suppress-next-line PhanTypeMismatchDimFetch $value = $this->cal[$type][$this->event_count][$key].$value; break; case 'VFREEBUSY': + // @phan-suppress-next-line PhanTypeMismatchDimFetch $value = $this->cal[$type][$this->freebusy_count][$key].$value; break; case 'VTODO': + // @phan-suppress-next-line PhanTypeMismatchDimFetch $value = $this->cal[$type][$this->todo_count][$key].$value; break; } @@ -303,18 +306,22 @@ public function add_to_array($type, $key, $value) switch ($type) { case "VTODO": + // @phan-suppress-next-line PhanTypeMismatchReturn $this->cal[$type][$this->todo_count][$key] = $value; break; case "VEVENT": + // @phan-suppress-next-line PhanTypeMismatchReturn $this->cal[$type][$this->event_count][$key] = $value; break; case "VFREEBUSY": + // @phan-suppress-next-line PhanTypeMismatchReturn $this->cal[$type][$this->freebusy_count][$key] = $value; break; default: + // @phan-suppress-next-line PhanTypeMismatchProperty $this->cal[$type][$key] = $value; break; } @@ -326,7 +333,7 @@ public function add_to_array($type, $key, $value) * Parse text "XXXX:value text some with : " and return array($key = "XXXX", $value="value"); * * @param string $text Text - * @return array + * @return array{0:string,1:string} */ public function retun_key_value($text) { @@ -351,7 +358,7 @@ public function retun_key_value($text) * Parse RRULE return array * * @param string $value string - * @return array + * @return array */ public function ical_rrule($value) { @@ -425,14 +432,14 @@ public function ical_dt_date($key, $value) /** * Return sorted eventlist as array or false if calendar is empty * - * @return array|false + * @return array>|false */ public function get_sort_event_list() { // phpcs:enable $temp = $this->get_event_list(); if (!empty($temp)) { - usort($temp, array(&$this, "ical_dtstart_compare")); + usort($temp, array($this, "ical_dtstart_compare")); // false-positive @phpstan-ignore-line return $temp; } else { return false; @@ -443,9 +450,9 @@ public function get_sort_event_list() /** * Compare two unix timestamp * - * @param array $a Operand a - * @param array $b Operand b - * @return integer + * @param array{DTSTART:array{unixtime:string}} $a Operand a + * @param array{DTSTART:array{unixtime:string}} $b Operand b + * @return int */ public function ical_dtstart_compare($a, $b) { @@ -457,7 +464,7 @@ public function ical_dtstart_compare($a, $b) /** * Return eventlist array (not sorted eventlist array) * - * @return array + * @return array> */ public function get_event_list() { @@ -469,7 +476,7 @@ public function get_event_list() /** * Return freebusy array (not sort eventlist array) * - * @return array + * @return array> */ public function get_freebusy_list() { @@ -481,7 +488,7 @@ public function get_freebusy_list() /** * Return to do array (not sorted todo array) * - * @return array + * @return array> */ public function get_todo_list() { @@ -493,7 +500,7 @@ public function get_todo_list() /** * Return base calendar data * - * @return array + * @return array> */ public function get_calender_data() { @@ -505,7 +512,7 @@ public function get_calender_data() /** * Return array with all data * - * @return array + * @return array>>>|array>>>|array>>|array>> */ public function get_all_data() { diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 47f23fac914eb..cb7ea75452b00 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -2,6 +2,7 @@ /* Advance Targeting Emailing for mass emailing module * Copyright (C) 2013 Florian Henry * Copyright (C) 2024 Frédéric France + * 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 @@ -85,12 +86,12 @@ class AdvanceTargetingMailing extends CommonObject public $fk_user_mod; /** - * @var array select target type + * @var array select target type */ public $select_target_type = array(); /** - * @var array type status comm prospect + * @var array type status comm prospect */ public $type_statuscommprospect = array(); @@ -129,7 +130,7 @@ public function __construct($db) $customerStatic->loadCacheOfProspStatus(); if (!empty($customerStatic->cacheprospectstatus)) { foreach ($customerStatic->cacheprospectstatus as $dataProspectSt) { - $this->type_statuscommprospect[$dataProspectSt['id']]=$dataProspectSt['label']; + $this->type_statuscommprospect[$dataProspectSt['id']] = $dataProspectSt['label']; } } else { $this->type_statuscommprospect = array( @@ -398,9 +399,9 @@ public function fetch_by_element($id = 0, $type_element = 'mailing') /** * Update object into database * - * @param User $user User that modifies - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int Return integer <0 if KO, >0 if OK + * @param User $user User that modifies + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int Return integer <0 if KO, >0 if OK */ public function update($user, $notrigger = 0) { @@ -461,9 +462,9 @@ public function update($user, $notrigger = 0) /** * Delete object in database * - * @param User $user User that deletes - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int Return integer <0 if KO, >0 if OK + * @param User $user User that deletes + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int Return integer <0 if KO, >0 if OK */ public function delete($user, $notrigger = 0) { @@ -503,7 +504,7 @@ public function delete($user, $notrigger = 0) * Save query in database to retrieve it * * @param User $user User that deletes - * @param array $arrayquery All element to Query + * @param array $arrayquery All element to Query * @return int Return integer <0 if KO, >0 if OK */ public function savequery($user, $arrayquery) @@ -531,7 +532,7 @@ public function savequery($user, $arrayquery) /** * Load object in memory from database * - * @param array $arrayquery All element to Query + * @param array $arrayquery All element to Query * @return int Return integer <0 if KO, >0 if OK */ public function query_thirdparty($arrayquery) @@ -638,7 +639,7 @@ public function query_thirdparty($arrayquery) } } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') { if ($arrayquery['options_'.$key] > 0) { - $sqlwhere[]= " (te.".$key." = ".((int) $arrayquery["options_".$key]).")"; + $sqlwhere[] = " (te.".$key." = ".((int) $arrayquery["options_".$key]).")"; } } else { if (is_array($arrayquery['options_'.$key])) { @@ -685,8 +686,8 @@ public function query_thirdparty($arrayquery) /** * Load object in memory from database * - * @param array $arrayquery All element to Query - * @param int $withThirdpartyFilter add contact with tridparty filter + * @param array $arrayquery All element to Query + * @param int $withThirdpartyFilter add contact with third party filter * @return int Return integer <0 if KO, >0 if OK */ public function query_contact($arrayquery, $withThirdpartyFilter = 0) diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index b66f031449064..8061c973877ef 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -53,7 +53,7 @@ public function __construct($db) /** * Affiche un champs select contenant une liste * - * @param array $selected_array à preselectionner + * @param string[] $selected_array à preselectionner * @param string $htmlname select field * @return string select field */ @@ -92,7 +92,7 @@ public function multiselectProspectionStatus($selected_array = array(), $htmlnam * Return combo list of activated countries, into language of user * * @param string $htmlname of html select object - * @param array $selected_array or Code or Label of preselected country + * @param string[] $selected_array or Code or Label of preselected country * @return string HTML string with select */ public function multiselectState($htmlname = 'state_id', $selected_array = array()) @@ -153,7 +153,7 @@ public function multiselectState($htmlname = 'state_id', $selected_array = array * Return combo list of activated countries, into language of user * * @param string $htmlname of html select object - * @param array $selected_array or Code or Label of preselected country + * @param string[] $selected_array or Code or Label of preselected country * @return string HTML string with select */ public function multiselectCountry($htmlname = 'country_id', $selected_array = array()) @@ -213,7 +213,7 @@ public function multiselectCountry($htmlname = 'country_id', $selected_array = a * Return select list for categories (to use in form search selectors) * * @param string $htmlname control name - * @param array $selected_array array of data + * @param string[] $selected_array array of data * @param User $user User action * @return string combo list code */ @@ -259,7 +259,7 @@ public function multiselectselectSalesRepresentatives($htmlname, $selected_array * Return select list for categories (to use in form search selectors) * * @param string $htmlname of combo list (example: 'search_sale') - * @param array $selected_array selected array + * @param string[] $selected_array selected array * @return string combo list code */ public function multiselectselectLanguage($htmlname = '', $selected_array = array()) @@ -351,7 +351,7 @@ public function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), * Return combo list with people title * * @param string $htmlname Name of HTML select combo field - * @param array $selected_array Array + * @param string[] $selected_array Array * @return string HTML combo */ public function multiselectCivility($htmlname = 'civilite_id', $selected_array = array()) @@ -391,8 +391,8 @@ public function multiselectCivility($htmlname = 'civilite_id', $selected_array = * Return multiselect list of entities. * * @param string $htmlname select - * @param array $options_array to manage - * @param array $selected_array to manage + * @param array $options_array to manage + * @param string[] $selected_array to manage * @param int $showempty show empty * @return string HTML combo */ diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 70d219562f12a..320aac575a463 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -150,17 +150,17 @@ class Mailing extends CommonObject public $extraparams = array(); /** - * @var array statut dest + * @var array statut dest */ public $statut_dest = array(); /** - * @var array substitutionarray + * @var array substitutionarray */ public $substitutionarray; /** - * @var array substitutionarrayfortest + * @var array substitutionarrayfortest */ public $substitutionarrayfortest; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 8a5c4eecf0148..a39c207144c88 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -205,18 +205,21 @@ class Propal extends CommonObject public $author; /** - * @deprecated + * @var float + * @deprecated See $total_ht * @see $total_ht */ public $price; /** - * @deprecated + * @var float + * @deprecated See $total_tva * @see $total_tva */ public $tva; /** - * @deprecated + * @var float + * @deprecated See $total_ttc * @see $total_ttc */ public $total; @@ -293,6 +296,9 @@ class Propal extends CommonObject */ public $availability; + /** + * @var int|string + */ public $duree_validite; /** @@ -619,11 +625,11 @@ public function insert_discount($idremise) * @param string $label ??? * @param int|string $date_start Start date of the line * @param int|string $date_end End date of the line - * @param array $array_options extrafields array + * @param array $array_options extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one * @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'.... * @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id - * @param double $pu_ht_devise Unit price in currency + * @param float $pu_ht_devise Unit price in currency * @param int $fk_remise_except Id discount if line is from a discount * @param int $noupdateafterinsertline No update after insert of line * @return int >0 if OK, <0 if KO @@ -868,11 +874,11 @@ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txloca * @param int $type 0/1=Product/service * @param int|string $date_start Start date of the line * @param int|string $date_end End date of the line - * @param array $array_options extrafields array + * @param array $array_options extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one - * @param double $pu_ht_devise Unit price in currency + * @param float $pu_ht_devise Unit price in currency * @param int $notrigger disable line update trigger - * @param integer $rang line rank + * @param int $rang line rank * @return int 0 if OK, <0 if KO */ public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = array(), $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $rang = 0) @@ -2975,7 +2981,7 @@ public function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $so /** * Returns an array with the numbers of related invoices * - * @return array Array of invoices + * @return CommonInvoice[] Array of invoices */ public function getInvoiceArrayList() { @@ -2987,7 +2993,7 @@ public function getInvoiceArrayList() * Returns an array with id and ref of related invoices * * @param int $id Id propal - * @return array|int Array of invoices id + * @return CommonInvoice[]|int Array of invoices id */ public function InvoiceArrayList($id) { @@ -3917,10 +3923,10 @@ public function getLinesArray($sqlforgedfilters = '') * * @param string $modele Force model to use ('' to not force) * @param Translate $outputlangs Object langs to use for output - * @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 + * @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 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 78b69f1308224..e609fc209956f 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -2027,7 +2027,7 @@ // Availability if (!empty($arrayfields['ava.rowid']['checked'])) { print ''; - $form->form_availability('', $obj->availability, 'none', 1); + $form->form_availability(0, $obj->availability, 'none', 1); print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index cb23d053bf1a4..8a131436effd3 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1494,7 +1494,7 @@ } $banklinestatic->id = $objp->rowid; - $banklinestatic->ref = $objp->rowid; + $banklinestatic->ref = (string) $objp->rowid; print ''; @@ -1551,25 +1551,25 @@ print $banktransferstatic->getNomUrl(0).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment') { $paymentstatic->id = $links[$key]['url_id']; - $paymentstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment + $paymentstatic->ref = (string) $links[$key]['url_id']; // FIXME This is id, not ref of payment $paymentstatic->date = $db->jdate($objp->do); print $paymentstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; - $paymentsupplierstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment + $paymentsupplierstatic->ref = (string) $links[$key]['url_id']; // FIXME This is id, not ref of payment print $paymentsupplierstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_sc') { $paymentscstatic->id = $links[$key]['url_id']; - $paymentscstatic->ref = $links[$key]['url_id']; + $paymentscstatic->ref = (string) $links[$key]['url_id']; $paymentscstatic->label = $links[$key]['label']; print $paymentscstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_vat') { $paymentvatstatic->id = $links[$key]['url_id']; - $paymentvatstatic->ref = $links[$key]['url_id']; + $paymentvatstatic->ref = (string) $links[$key]['url_id']; print $paymentvatstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_salary') { $paymentsalstatic->id = $links[$key]['url_id']; - $paymentsalstatic->ref = $links[$key]['url_id']; + $paymentsalstatic->ref = (string) $links[$key]['url_id']; $paymentsalstatic->label = $links[$key]['label']; print $paymentsalstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_loan') { @@ -1578,15 +1578,15 @@ print ''.($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_donation') { $paymentdonationstatic->id = $links[$key]['url_id']; - $paymentdonationstatic->ref = $links[$key]['url_id']; + $paymentdonationstatic->ref = (string) $links[$key]['url_id']; print $paymentdonationstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_expensereport') { $paymentexpensereportstatic->id = $links[$key]['url_id']; - $paymentexpensereportstatic->ref = $links[$key]['url_id']; + $paymentexpensereportstatic->ref = (string) $links[$key]['url_id']; print $paymentexpensereportstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'payment_various') { $paymentvariousstatic->id = $links[$key]['url_id']; - $paymentvariousstatic->ref = $links[$key]['url_id']; + $paymentvariousstatic->ref = (string) $links[$key]['url_id']; print $paymentvariousstatic->getNomUrl(2).($labeltoshow ? ' ' : ''); } elseif ($links[$key]['type'] == 'banktransfert') { // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 91f1a0644cdef..17971d298bac5 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -56,8 +56,8 @@ class Account extends CommonObject public $picto = 'account'; /** - * @var int Use id instead of rowid - * @deprecated + * @var int + * @deprecated Use $id instead of $rowid * @see $id */ public $rowid; @@ -71,7 +71,7 @@ class Account extends CommonObject /** * Bank account type. Check TYPE_ constants * @var int - * @deprecated + * @deprecated Use $type * @see $type */ public $courant; @@ -149,7 +149,7 @@ class Account extends CommonObject * IBAN number * * @var string - * @deprecated see $iban + * @deprecated See $iban */ public $iban_prefix; @@ -162,7 +162,7 @@ class Account extends CommonObject /** * Name of account holder * @var string - * @deprecated + * @deprecated Use $owner_name * @see $owner_name */ public $proprio; @@ -190,13 +190,19 @@ class Account extends CommonObject * @var string */ public $owner_town; + /** + * @var int + */ public $owner_country_id; + /** + * @var string + */ public $owner_country_code; /** * Address of the bank account * @var string - * @deprecated + * @deprecated See $address * @see $address */ public $domiciliation; @@ -206,15 +212,27 @@ class Account extends CommonObject * @var string */ public $address; + /** + * @var int + */ public $state_id; + /** + * @var string + */ public $state_code; + /** + * @var string + */ public $state; + /** + * @var int + */ public $country_id; /** * Variable containing all account types with their respective translated label. * Defined in __construct - * @var array + * @var array */ public $type_lib = array(); @@ -517,7 +535,7 @@ public function add_url_line($line_id, $url_id, $url, $label, $type) * @param int $fk_bank To search using bank transaction id * @param int $url_id To search using link to * @param string $type To search using type - * @return array|int Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error + * @return int<-1,-1>|array Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error */ public function get_url($fk_bank = 0, $url_id = 0, $type = '') { @@ -1850,8 +1868,8 @@ public function info($id) * * Some countries show less or more bank account properties to the user * - * @param int $includeibanbic 1=Return also key for IBAN and BIC - * @return array Array of fields to show + * @param int<0,1> $includeibanbic 1=Return also key for IBAN and BIC + * @return string[] Array of fields to show * @see useDetailedBBAN() */ public function getFieldsToShow($includeibanbic = 0) @@ -1891,7 +1909,7 @@ public function getFieldsToShow($includeibanbic = 0) * - BankAccountNumberKey * - DeskCode * - * @return array + * @return string[] */ public static function getAccountNumberOrder() { @@ -1957,14 +1975,14 @@ public function initAsSpecimen() $this->owner_address = 'Owner address'; $this->owner_zip = 'Owner zip'; $this->owner_town = 'Owner town'; - $this->owner_country_id = 'Owner country_id'; + $this->owner_country_id = 1; $this->country_id = 1; return 1; } /** - * Function used to replace a thirdparty id with another one. + * Function used to replace a third party id with another one. * * @param DoliDB $dbs Database handler * @param int $origin_id Old thirdparty id @@ -2171,6 +2189,7 @@ class AccountLine extends CommonObjectLine /** * User author of the reconciliation * TODO: variable used only by method info() => is it the same as $fk_user_rappro ? + * @var int */ public $user_rappro; diff --git a/htdocs/compta/bank/class/bankcateg.class.php b/htdocs/compta/bank/class/bankcateg.class.php index 1e28275239ca9..c97fb2e4416f4 100644 --- a/htdocs/compta/bank/class/bankcateg.class.php +++ b/htdocs/compta/bank/class/bankcateg.class.php @@ -58,12 +58,12 @@ class BankCateg // extends CommonObject public $error; /** - * @var array errors + * @var string[] errors */ public $errors; /** - * @var array context + * @var array context */ public $context; diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index e61d302f6befd..d976c63c5f5f2 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -53,8 +53,17 @@ class Deplacement extends CommonObject */ public $fk_element = ''; + /** + * @var int + */ public $fk_soc; + /** + * @var int|string + */ public $date; + /** + * @var string + */ public $type; /** @@ -408,7 +417,7 @@ public function getNomUrl($withpicto = 0) * List of types * * @param int $active Active or not - * @return array + * @return array */ public function listOfTypes($active = 1) { diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 9750fff5f5b8f..e6d8b689ac2b7 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -34,7 +34,13 @@ */ class FactureStats extends Stats { + /** + * @var int + */ public $socid; + /** + * @var int + */ public $userid; /** @@ -42,9 +48,21 @@ class FactureStats extends Stats */ public $table_element; + /** + * @var string + */ public $from; + /** + * @var string + */ public $field; + /** + * @var string + */ public $where = ''; + /** + * @var string + */ public $join; diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index c79e400db93e3..7cd3648e7718f 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * 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 @@ -45,6 +46,9 @@ class PaymentTerm // extends CommonObject //public $element='c_payment_term'; //!< Id that identify managed objects //public $table_element='c_payment_term'; //!< Name of table without prefix where object is stored + /** + * @var array + */ public $context = array(); /** @@ -58,13 +62,37 @@ class PaymentTerm // extends CommonObject */ public $entity; + /** + * @var string + */ public $code; + /** + * @var string + */ public $sortorder; + /** + * @var string + */ public $active; + /** + * @var string + */ public $libelle; + /** + * @var string + */ public $libelle_facture; + /** + * @var string + */ public $type_cdr; + /** + * @var string + */ public $nbjour; + /** + * @var string + */ public $decalage; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 18d443d596f7d..398c7f443ccf7 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -45,10 +45,22 @@ class Localtax extends CommonObject */ public $picto = 'payment'; + /** + * @var int + */ public $ltt; + /** + * @var int|string + */ public $datep; + /** + * @var int|string + */ public $datev; + /** + * @var string + */ public $amount; /** @@ -61,6 +73,9 @@ class Localtax extends CommonObject */ public $fk_type; + /** + * @var string + */ public $paymenttype; /** @@ -535,7 +550,7 @@ public function addPayment($user) dol_print_error($this->db); } - $bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs((float) $this->amount), '', '', $user); + $bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs((float) $this->amount), '', 0, $user); // Update fk_bank into llx_localtax so we know the line of localtax used to generate the bank entry. if ($bank_line_id > 0) { diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 0eb1559c2c65c..17527a265914a 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -50,18 +50,47 @@ class RemiseCheque extends CommonObject */ public $picto = 'payment'; + /** + * @var string + */ public $num; + /** + * @var string + */ public $intitule; - //! Numero d'erreur Plage 1024-1279 + /** + * @var int<-1033,-1024>|int<-18,-18>|int<-2,0> Error number from 1024 to 1279 + */ public $errno; + /** + * @var string + */ public $type = 'CHQ'; // 'CHQ', 'TRA', ... + /** + * @var float + */ public $amount; + /** + * @var int|string + */ public $date_bordereau; + /** + * @var int + */ public $account_id; + /** + * @var string + */ public $account_label; + /** + * @var int + */ public $author_id; + /** + * @var int + */ public $nbcheque; /** @@ -143,7 +172,7 @@ public function fetch($id, $ref = '') * @param User $user User making creation * @param int $account_id Bank account for cheque receipt * @param int $limit Limit ref of cheque to this - * @param array $toRemise array with cheques to remise + * @param int[] $toRemise array with cheques to remise * @return int Return integer <0 if KO, >0 if OK */ public function create($user, $account_id, $limit, $toRemise) @@ -268,7 +297,7 @@ public function create($user, $account_id, $limit, $toRemise) } else { $this->errno = -1; $this->error = $this->db->lasterror(); - $this->errno = $this->db->lasterrno(); + // $this->errno = $this->db->lasterrno(); } if (!$this->errno && (getDolGlobalString('MAIN_DISABLEDRAFTSTATUS') || getDolGlobalString('MAIN_DISABLEDRAFTSTATUS_CHEQUE'))) { diff --git a/htdocs/compta/paiement/class/cpaiement.class.php b/htdocs/compta/paiement/class/cpaiement.class.php index a8a49ca43d3e0..ad4cb13dfdb64 100644 --- a/htdocs/compta/paiement/class/cpaiement.class.php +++ b/htdocs/compta/paiement/class/cpaiement.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2023-2024 Frédéric France + * 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 @@ -46,14 +47,26 @@ class Cpaiement extends CommonDict /** * @var string - * @deprecated + * @deprecated Use $label * @see $label */ public $libelle; + /** + * @var string + */ public $type; + /** + * @var int<0,1> + */ public $active; + /** + * @var string + */ public $accountancy_code; + /** + * @var string + */ public $module; @@ -225,9 +238,9 @@ public function fetch($id, $ref = null) /** * Update object into database * - * @param User $user User that modifies - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int Return integer <0 if KO, >0 if OK + * @param User $user User that modifies + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int Return integer <0 if KO, >0 if OK */ public function update(User $user, $notrigger = 0) { diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 03512da69a326..3230ce19918fc 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -79,14 +79,16 @@ class Paiement extends CommonObject public $date; /** - * @deprecated + * @deprecated Use $amount, $amounts * @see $amount, $amounts + * @var float */ public $total; /** - * @deprecated + * @deprecated Use $amount, $amounts * @see $amount, $amounts + * @var float */ public $montant; @@ -101,7 +103,7 @@ class Paiement extends CommonObject public $multicurrency_amount; /** - * @var float[] array: invoice ID => amount for that invoice (in the main currency) + * @var array array: invoice ID => amount for that invoice (in the main currency) */ public $amounts = array(); @@ -125,6 +127,9 @@ class Paiement extends CommonObject */ public $pos_change = 0.0; + /** + * @var int + */ public $author; /** @@ -774,12 +779,12 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom $label, $totalamount, // Sign must be positive when we receive money (customer payment), negative when you give money (supplier invoice or credit note) $this->num_payment, - '', + 0, $user, $emetteur_nom, $emetteur_banque, $accountancycode, - null, + 0, '', $totalamount_main_currency ); @@ -969,9 +974,6 @@ public function update_date($date) $this->error = 'Error -1 '.$this->db->error(); } - if (!$error) { - } - if (!$error) { $this->datepaye = $date; $this->date = $date; @@ -1104,7 +1106,7 @@ public function info($id) * Return list of invoices the payment is related to. * * @param string $filter Filter - * @return int|array Return integer <0 if KO or array of invoice id + * @return int|int[] Return integer <0 if KO or array of invoice id * @see getAmountsArray() */ public function getBillsArray($filter = '') @@ -1138,7 +1140,7 @@ public function getBillsArray($filter = '') /** * Return list of amounts of payments. * - * @return int|array Array of amount of payments + * @return int|array Array of amount of payments * @see getBillsArray() */ public function getAmountsArray() diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 0db8f92ffef5e..41c80211eb02f 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -42,9 +42,21 @@ class RejetPrelevement */ public $db; + /** + * @var 'direct-debit'|'bank-transfer' + */ public $type; //prelevement or bank transfer + /** + * @var int + */ public $bon_id; + /** + * @var User + */ public $user; + /** + * @var int|string + */ public $date_rejet; /** @@ -70,7 +82,7 @@ class RejetPrelevement * * @param DoliDB $db Database handler * @param User $user Object user - * @param string $type Type ('direct-debit' for direct debit or 'bank-transfer' for credit transfer) + * @param 'direct-debit'|'bank-transfer' $type Type ('direct-debit' for direct debit or 'bank-transfer' for credit transfer) */ public function __construct($db, $user, $type) { @@ -105,7 +117,7 @@ public function __construct($db, $user, $type) * @param string $motif Motif * @param int $date_rejet Date reject * @param int $bonid Bon id - * @param int $facturation 1=Bill the reject + * @param int<0,1> $facturation 1=Bill the reject * @return int Return >=0 if OK, <0 if KO */ public function create($user, $id, $motif, $date_rejet, $bonid, $facturation = 0) @@ -304,8 +316,9 @@ private function _send_email($fac) /** * Retrieve the list of invoices * - * @param int $amounts If you want to get the amount of the order for each invoice - * @return array Array List of invoices related to the withdrawal line + * @param int<0,1> $amounts If you want to get the amount of the order for each invoice + + * @return array Array List of invoices related to the withdrawal line * @todo A withdrawal line is today linked to one and only one invoice. So the function should return only one object ? */ private function getListInvoices($amounts = 0) diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index b532bf4209552..d6cb25828ce67 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France + * 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 @@ -35,8 +36,14 @@ */ class Cchargesociales { + /** + * @var DoliDB + */ public $db; + /** + * @var int + */ public $id; /** @@ -51,7 +58,7 @@ class Cchargesociales /** * @var string Label - * @deprecated + * @deprecated Use $label */ public $libelle; @@ -60,8 +67,17 @@ class Cchargesociales */ public $label; + /** + * @var string + */ public $deductible; + /** + * @var string + */ public $active; + /** + * @var string + */ public $code; /** @@ -73,10 +89,13 @@ class Cchargesociales * @var string module */ public $module; + /** + * @var string + */ public $accountancy_code; /** - * @var array array of errors + * @var string[] array of errors */ public $errors = array(); @@ -151,13 +170,13 @@ public function create(User $user, $notrigger = 0) $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); //if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_CREATE',$user); - //if ($result < 0) $error++; - //// End call triggers + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_CREATE',$user); + //if ($result < 0) $error++; + //// End call triggers //} } diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 712175abb4a19..1d9910fec7d7a 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -598,7 +598,7 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom $label, $total, $this->num_payment, - '', + 0, $user, $emetteur_nom, $emetteur_banque diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index 5f2098ce80e34..f6cee6a578415 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -597,7 +597,7 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom $label, $total, $this->num_payment, - '', + 0, $user, $emetteur_nom, $emetteur_banque diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index f8a06cf0837fd..9ed504b6a138d 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -679,9 +679,9 @@ public function addPayment($user) } if ($this->amount > 0) { - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs((float) $this->amount), $this->num_payment, '', $user); + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs((float) $this->amount), $this->num_payment, 0, $user); } else { - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs((float) $this->amount), $this->num_payment, '', $user); + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs((float) $this->amount), $this->num_payment, 0, $user); } // Update fk_bank into llx_tva. So we know vat line used to generate bank transaction diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 7aac94c5ba614..28a9186b4e647 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -33,14 +33,31 @@ abstract class ActionsContactCardCommon */ public $db; + /** + * @var string + */ public $dirmodule; + /** + * @var string + */ public $targetmodule; + /** + * @var string + */ public $canvas; + /** + * @var string + */ public $card; - //! Template container + /** + * @var array Template container + */ public $tpl = array(); - //! Object container + //! + /** + * @var Contact Object container + */ public $object; /** @@ -295,13 +312,13 @@ private function assign_post() $this->object->zip = GETPOST("zipcode"); $this->object->town = GETPOST("town"); $this->object->country_id = GETPOST("country_id") ? GETPOST("country_id") : $mysoc->country_id; - $this->object->state_id = GETPOST("state_id"); + $this->object->state_id = GETPOSTINT("state_id"); $this->object->phone_pro = GETPOST("phone_pro"); $this->object->phone_perso = GETPOST("phone_perso"); $this->object->phone_mobile = GETPOST("phone_mobile"); $this->object->fax = GETPOST("fax"); $this->object->email = GETPOST("email"); - $this->object->priv = GETPOST("priv"); + $this->object->priv = GETPOSTINT("priv"); $this->object->note = GETPOST("note", "restricthtml"); $this->object->canvas = GETPOST("canvas"); @@ -309,14 +326,17 @@ private function assign_post() if ($this->object->country_id) { $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".((int) $this->object->country_id); $resql = $this->db->query($sql); + $obj = null; if ($resql) { $obj = $this->db->fetch_object($resql); } else { dol_print_error($this->db); } - $this->object->country_id = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label; - $this->object->country_code = $obj->code; - $this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label; + if ($obj !== null) { + $this->object->country_id = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label; + $this->object->country_code = $obj->code; + $this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label; + } } } } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 553cd49ddf521..08041134de3e4 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -129,8 +129,17 @@ class Contact extends CommonObject 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -1, 'position' => 1000), ); + /** + * @var string + */ public $civility_id; // In fact we store civility_code + /** + * @var string + */ public $civility_code; + /** + * @var string + */ public $civility; /** @@ -150,7 +159,7 @@ class Contact extends CommonObject /** * @var string The civilite code, not an integer - * @deprecated + * @deprecated Use $civility_code * @see $civility_code */ public $civilite; @@ -204,6 +213,9 @@ class Contact extends CommonObject * @var int Thirdparty ID */ public $socid; // both socid and fk_soc are used + /** + * @var int + */ public $fk_soc; // both socid and fk_soc are used /** @@ -216,6 +228,9 @@ class Contact extends CommonObject */ public $statut; + /** + * @var string + */ public $code; /** @@ -227,7 +242,7 @@ class Contact extends CommonObject /** * Email * @var string - * @deprecated + * @deprecated Use $email * @see $email */ public $mail; @@ -247,7 +262,7 @@ class Contact extends CommonObject /** * Array of social-networks - * @var array + * @var array */ public $socialnetworks; @@ -333,13 +348,16 @@ class Contact extends CommonObject * Old copy * @var static */ - public $oldcopy; // To contains a clone of this when we need to save old properties of object + public $oldcopy; // To contain a clone of this when we need to save old properties of object /** - * @var array roles + * @var array roles */ public $roles; + /** + * @var array + */ public $cacheprospectstatus = array(); /** @@ -347,8 +365,14 @@ class Contact extends CommonObject */ public $fk_prospectlevel; + /** + * @var int + */ public $stcomm_id; + /** + * @var string + */ public $statut_commercial; /** @@ -755,11 +779,11 @@ public function update($id, $user = null, $notrigger = 0, $action = 'update', $n /** * Return DN string complete in the LDAP directory for the object * - * @param array $info Info string 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) { @@ -782,7 +806,7 @@ public function _load_ldap_dn($info, $mode = 0) /** * Initialize info table (LDAP attributes table) * - * @return array Attributes info table + * @return array Attributes info table */ public function _load_ldap_info() { @@ -1867,7 +1891,7 @@ public function fetchRoles() * Get thirdparty contact roles of a given contact * * @param string $element Element type - * @return array|int Array of contact roles or -1 + * @return array|int<-1,-1> Array of contact roles or -1 * @throws Exception */ public function getContactRoles($element = '') diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 179eaaf2edbb8..43a4bee56b958 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.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 @@ -30,13 +31,25 @@ */ class Ccountry extends CommonDict { + /** + * @var string + */ public $element = 'ccountry'; //!< Id that identify managed objects + /** + * @var string + */ public $table_element = 'c_country'; //!< Name of table without prefix where object is stored + /** + * @var string + */ public $code_iso; + /** + * @var array|string,position:int,notnull?:int,visible:int<-2,5>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> + */ public $fields = array( - 'label' => array('type'=>'varchar(250)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>15, 'notnull'=>-1, 'showoncombobox'=>'1') + 'label' => array('type' => 'varchar(250)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'position' => 15, 'notnull' => -1, 'showoncombobox' => 1) ); diff --git a/htdocs/core/class/cgenericdic.class.php b/htdocs/core/class/cgenericdic.class.php index c39f8cbbf2378..fd4016f4dc511 100644 --- a/htdocs/core/class/cgenericdic.class.php +++ b/htdocs/core/class/cgenericdic.class.php @@ -48,6 +48,9 @@ class CGenericDic extends CommonDict */ public $lines = array(); + /** + * @var string + */ public $code; /** @@ -55,6 +58,9 @@ class CGenericDic extends CommonDict */ public $label; + /** + * @var int<0,1> + */ public $active; diff --git a/htdocs/core/class/commonhookactions.class.php b/htdocs/core/class/commonhookactions.class.php index 8b5067f03cf9a..dc22ca652fed4 100644 --- a/htdocs/core/class/commonhookactions.class.php +++ b/htdocs/core/class/commonhookactions.class.php @@ -50,8 +50,8 @@ abstract class CommonHookActions /** * Check context of hook - * @param array $parameters Hook parameters. - * @param array|string $allContexts Context to check + * @param array $parameters Hook parameters. + * @param string[]|string $allContexts Context to check * @return bool */ protected function isContext($parameters, $allContexts) diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index bb7330e6eccf9..4e722c21dc34c 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -68,6 +68,9 @@ abstract class CommonStickerGenerator extends CommonDocGenerator */ public $db; + /** + * @var string + */ public $code; // Code of format // phpcs:disable PEAR.NamingConventions.ValidVariableName.PublicUnderscore @@ -103,10 +106,13 @@ abstract class CommonStickerGenerator extends CommonDocGenerator protected $_COUNTX = 1; protected $_COUNTY = 1; protected $_First = 1; + /** + * @var array{name:string,paper-size:string,orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:float,custom_x:float,custom_y:float} + */ public $Tformat; /** - * @var array + * @var array */ public $_Avery_Labels; // phpcs:enable @@ -125,7 +131,7 @@ public function __construct($db) /** * Function to build PDF on disk, then output on HTTP stream. * - * @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) + * @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) * @param Translate $outputlangs Lang object for output language * @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $outputdir Output directory for pdf file @@ -137,9 +143,9 @@ abstract public function write_file($arrayofrecords, $outputlangs, $srctemplatep /** * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) * - * @param TCPDF $pdf PDF reference + * @param TCPDF $pdf PDF reference * @param Translate $outputlangs Output langs - * @param array $param Associative array containing label content and optional parameters + * @param array $param Associative array containing label content and optional parameters * @return void */ abstract public function addSticker(&$pdf, $outputlangs, $param); diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 9a213d994a67c..c8238d4770c35 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2010-2018 Juanjo Menent * Copyright (C) 2024 Frédéric France + * 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 @@ -357,13 +358,13 @@ public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = /** * Output html select list of type of event * - * @param array|string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx'). Can be an array too. + * @param string[]|string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx'). Can be an array too. * @param string $htmlname Name of select field * @param string $excludetype A type to exclude ('systemauto', 'system', '') - * @param integer $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual", -2=Combined line is disabled (not implemented yet) - * @param int $hideinfohelp 1=Do not show info help, 0=Show, -1=Show+Add info to tell how to set default value - * @param int $multiselect 1=Allow multiselect of action type - * @param int $nooutput 1=No output + * @param int<-2,1> $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual", -2=Combined line is disabled (not implemented yet) + * @param int<-1,1> $hideinfohelp 1=Do not show info help, 0=Show, -1=Show+Add info to tell how to set default value + * @param int<0,1> $multiselect 1=Allow multiselect of action type + * @param int<0,1> $nooutput 1=No output * @param string $morecss More css to add to SELECT component. * @param int<0,1>|string $showempty 0 or 1 or 'Placeholder string' * @return string @@ -391,7 +392,7 @@ public function select_type_actions($selected = '', $htmlname = 'actioncode', $e $selected = 'AC_OTH_AUTO'; } - if (getDolGlobalString('AGENDA_ALWAYS_HIDE_AUTO')) { + if (array_key_exists('AC_OTH_AUTO', $arraylist) && getDolGlobalString('AGENDA_ALWAYS_HIDE_AUTO')) { unset($arraylist['AC_OTH_AUTO']); } diff --git a/htdocs/core/lib/format_cards.lib.php b/htdocs/core/lib/format_cards.lib.php index 89a6a33126a61..2f3e48f8b83b7 100644 --- a/htdocs/core/lib/format_cards.lib.php +++ b/htdocs/core/lib/format_cards.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006-2012 Laurent Destailleur * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007 Patrick Raguin + * 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 @@ -42,7 +43,6 @@ $_Avery_Labels[$row['code']]['metric'] = $row['metric']; $_Avery_Labels[$row['code']]['marginLeft'] = $row['leftmargin']; $_Avery_Labels[$row['code']]['marginTop'] = $row['topmargin']; - $_Avery_Labels[$row['code']]['marginTop'] = $row['topmargin']; $_Avery_Labels[$row['code']]['NX'] = $row['nx']; $_Avery_Labels[$row['code']]['NY'] = $row['ny']; $_Avery_Labels[$row['code']]['SpaceX'] = $row['spacex']; diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php index d75805a1174bf..bf701ac64d40d 100644 --- a/htdocs/core/modules/cheque/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/modules_chequereceipts.php @@ -111,6 +111,18 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Fonction to generate document on disk + * + * @param RemiseCheque $object Object RemiseCheque + * @param string $_dir Directory + * @param string $number Number + * @param Translate $outputlangs Lang output object + * @return int<-1,1> 1=ok, 0=ko + */ + abstract public function write_file($object, $_dir, $number, $outputlangs); + // phpcs:enable } diff --git a/htdocs/core/modules/member/doc/pdf_standard_member.class.php b/htdocs/core/modules/member/doc/pdf_standard_member.class.php index 7664273c5429d..1842964ea5f96 100644 --- a/htdocs/core/modules/member/doc/pdf_standard_member.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard_member.class.php @@ -353,8 +353,9 @@ public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'mem $filename .= '.pdf'; // standard format or custom - if ($this->Tformat['paper-size'] != 'custom') { - $this->format = $this->Tformat['paper-size']; + $paper_size = $this->Tformat['paper-size']; + if (!is_string($paper_size) || $paper_size != 'custom') { + $this->format = $paper_size; } else { //custom $resolution = array($this->Tformat['custom_x'], $this->Tformat['custom_y']); diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index c87e770b5eb8e..01064493aad5c 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2015 Francis Appels + * 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 @@ -247,8 +248,9 @@ public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $out } $this->type = 'pdf'; // standard format or custom - if ($this->Tformat['paper-size'] != 'custom') { - $this->format = $this->Tformat['paper-size']; + $paper_size = $this->Tformat['paper-size']; + if (!is_string($paper_size) || $paper_size != 'custom') { + $this->format = $paper_size; } else { //custom $resolution = array($this->Tformat['custom_x'], $this->Tformat['custom_y']); @@ -337,7 +339,7 @@ public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $out dolChmod($file); - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; } diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php index e133a2309c4d3..5caf4e4e2b38d 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2015 Francis Appels + * 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 @@ -270,8 +271,9 @@ public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $out } $this->type = 'pdf'; // standard format or custom - if ($this->Tformat['paper-size'] != 'custom') { - $this->format = $this->Tformat['paper-size']; + $paper_size = $this->Tformat['paper-size']; + if (!is_string($paper_size) || $paper_size != 'custom') { + $this->format = $paper_size; } else { //custom $resolution = array($this->Tformat['custom_x'], $this->Tformat['custom_y']); @@ -360,7 +362,7 @@ public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $out dolChmod($file); - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 38cbbbd496b81..3eeba57f01d39 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -117,6 +117,8 @@ parameters: - '#function dolGetButtonAction expects array\{confirm\?: array.*confirm: true} given.#' - '#(?:make_substitutions expects array,) string given\.#' - '# (DolibarrApiAccess|Documents|Login|Setup|Status|Boms|Categories|AgendaEvents|Proposals|Orders|BankAccounts|Invoices|Contracts|Donations|Shipments|KnowledgeManagement|Mos|MultiCurrencies|Partnerships|Products|Tasks|Warehouses|Tickets|Workstation|WorkstationResource|WorkstationUserGroup|Zapier)::.* no value type specified in iterable type array\.#' + - '#Property RemiseCheque::\$account_id \(int\) does not accept string\.#' + - '#Property Contact::\$roles \(array\) does not accept non-empty-array\.#' internalErrorsCountLimit: 50 cache: diff --git a/pyproject.toml b/pyproject.toml index 198bd29465c84..a14e7614a89df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" # `codespell` can be run as a standalone program from the CLI # with the appropriate default options. -skip = "*/.*/*,*/langs/*,*/build/exe/*,**.log,*.pdf,*.PDF,*dev/resources/*,*.phar,*.z,*.gz,*.sql,*.svg,*htdocs/includes/*,*/textiso.txt,*.js,*README-*,*build/rpm/*spec,*build/pad/*ml,*htdocs/includes/phpoffice/*,*htdocs/includes/tecnickcom/*,*dev/initdemo/removeconfdemo.sh,*dev/tools/codespell/*,*dev/trans*/ignore_translation_keys.lst,*pyproject.toml,*build/exe/*,*fontawe*,*htdocs/theme/*/flags-sprite.inc.php,*dev/setup/codetemplates/codetemplates.xml,*/php.ini,*/html_cerfafr.*,*/lessc.class.php,*.asciidoc,*.xml,*opensurvey/css/style.css,*dev/tools/phan/stubs/*,*/documents" +skip = "*/.*/*,*/langs/*,*/build/exe/*,**.log,*.pdf,*.PDF,*dev/resources/*,*.phar,*.z,*.gz,*.sql,*.svg,*htdocs/includes/*,*/textiso.txt,*.js,*README-*,*build/rpm/*spec,*build/pad/*ml,*htdocs/includes/phpoffice/*,*htdocs/includes/tecnickcom/*,*dev/initdemo/removeconfdemo.sh,*dev/tools/codespell/*,*dev/trans*/ignore_translation_keys.lst,*pyproject.toml,*build/exe/*,*fontawe*,*htdocs/theme/*/flags-sprite.inc.php,*dev/setup/codetemplates/codetemplates.xml,*/php.ini,*/html_cerfafr.*,*/lessc.class.php,*.asciidoc,*.xml,*opensurvey/css/style.css,*dev/tools/phan/stubs/*,*/documents,phpstan.*" check-hidden = true quiet-level=2