diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 92e8952a6a91c..008c94b8dcefe 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -21470,6 +21470,11 @@ parameters: count: 1 path: ../../htdocs/opensurvey/class/opensurveysondage.class.php + - + message: "#^Property Opensurveysondage\\:\\:\\$status \\(int\\) in isset\\(\\) is not nullable\\.$#" + count: 1 + path: ../../htdocs/opensurvey/class/opensurveysondage.class.php + - message: "#^Left side of && is always true\\.$#" count: 1 diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index a92769855636f..a84e2e2826889 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,46 +9,49 @@ */ return [ // # Issue statistics: - // PhanUndeclaredProperty : 560+ occurrences + // PhanUndeclaredProperty : 570+ occurrences // PhanPossiblyUndeclaredGlobalVariable : 520+ occurrences // PhanUndeclaredGlobalVariable : 350+ occurrences - // PhanPluginUnknownPropertyType : 330+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 330+ occurrences - // PhanPluginUnknownArrayMethodReturnType : 230+ occurrences - // PhanPossiblyUndeclaredVariable : 180+ occurrences - // PhanPluginUnknownArrayMethodParamType : 160+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 320+ occurrences + // PhanPluginUnknownArrayMethodReturnType : 220+ occurrences + // PhanPluginUnknownPropertyType : 200+ occurrences // PhanTypeMismatchProperty : 160+ occurrences + // PhanPluginUnknownArrayMethodParamType : 140+ occurrences + // PhanPossiblyUndeclaredVariable : 120+ occurrences // PhanPluginUndeclaredVariableIsset : 65+ occurrences - // PhanPluginUnknownArrayFunctionParamType : 60+ occurrences - // PhanTypeMismatchArgumentNullableInternal : 60+ occurrences - // PhanPluginUnknownArrayFunctionReturnType : 50+ occurrences - // PhanPluginEmptyStatementIf : 45+ occurrences + // PhanTypeMismatchArgumentNullableInternal : 50+ occurrences // PhanRedefineFunction : 45+ occurrences // PhanTypeExpectedObjectPropAccess : 40+ occurrences - // PhanTypeInvalidDimOffset : 35+ occurrences + // PhanPluginEmptyStatementIf : 35+ occurrences + // PhanPluginUnknownArrayFunctionParamType : 35+ occurrences + // PhanPluginUnknownArrayFunctionReturnType : 30+ occurrences + // PhanTypeInvalidDimOffset : 30+ occurrences // PhanTypeMismatchDimFetch : 30+ occurrences - // PhanPluginUnknownArrayPropertyType : 15+ occurrences // PhanPluginUnknownObjectMethodCall : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences // PhanEmptyForeach : 10+ occurrences + // PhanPluginUnknownArrayPropertyType : 10+ occurrences // PhanTypeArraySuspiciousNull : 10+ occurrences // PhanTypeComparisonFromArray : 10+ occurrences // PhanTypeMismatchDimFetchNullable : 10+ occurrences // PhanUndeclaredMethod : 10+ occurrences - // PhanPluginSuspiciousParamPosition : 9 occurrences // PhanPluginBothLiteralsBinaryOp : 8 occurrences - // PhanPossiblyNullTypeMismatchProperty : 8 occurrences + // PhanPluginSuspiciousParamPosition : 8 occurrences // PhanPluginDuplicateExpressionBinaryOp : 7 occurrences - // PhanPluginConstantVariableNull : 6 occurrences // PhanParamTooMany : 5 occurrences + // PhanPossiblyNullTypeMismatchProperty : 5 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences // PhanEmptyFQSENInClasslike : 3 occurrences // PhanInvalidFQSENInClasslike : 3 occurrences // PhanTypeExpectedObjectPropAccessButGotNull : 2 occurrences + // PhanTypeMismatchDimAssignment : 2 occurrences // PhanAccessMethodProtected : 1 occurrence // PhanParamTooFew : 1 occurrence + // PhanPluginRedundantReturnComment : 1 occurrence // PhanTypeConversionFromArray : 1 occurrence + // PhanTypeMismatchArgumentReal : 1 occurrence // PhanTypeMismatchReturn : 1 occurrence + // PhanTypeSuspiciousStringExpression : 1 occurrence // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ @@ -119,7 +122,7 @@ return [ 'htdocs/commande/list.php' => ['PhanUndeclaredProperty'], 'htdocs/commande/list_det.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/commande/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/accounting-files.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/accounting-files.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], 'htdocs/compta/bank/account_statement_document.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/bank/annuel.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/bank/bankentries_list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], @@ -163,7 +166,6 @@ return [ 'htdocs/compta/paiement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/paiement/cheque/card.php' => ['PhanUndeclaredGlobalVariable'], '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'], @@ -256,7 +258,7 @@ return [ 'htdocs/core/class/notify.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/smtps.class.php' => ['PhanTypeConversionFromArray'], 'htdocs/core/class/timespent.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/customreports.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetchNullable'], + 'htdocs/core/customreports.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginRedundantReturnComment', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetchNullable'], 'htdocs/core/datepicker.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/core/db/sqlite3.class.php' => ['PhanTypeMismatchReturn'], 'htdocs/core/extrafieldsinimport.inc.php' => ['PhanTypeMismatchArgumentNullableInternal'], @@ -269,14 +271,12 @@ return [ 'htdocs/core/lib/images.lib.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/lib/pdf.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/lib/project.lib.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/lib/xcal.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/action/doc/pdf_standard_actions.class.php' => ['PhanPluginUnknownArrayPropertyType'], + 'htdocs/core/lib/xcal.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/asset/mod_asset_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/barcode/doc/phpbarcode.modules.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/barcode/mod_barcode_product_standard.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' => ['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'], @@ -299,8 +299,6 @@ return [ 'htdocs/core/modules/mailings/contacts1.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'], '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', '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'], @@ -308,8 +306,6 @@ 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', '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'], @@ -318,7 +314,6 @@ return [ 'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/propale/doc/pdf_cyan.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/propale/modules_propale.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/rapport/pdf_paiement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/reception/doc/pdf_squille.modules.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/societe/mod_codecompta_aquarium.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/societe/mod_codecompta_digitaria.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], @@ -364,14 +359,10 @@ return [ 'htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], 'htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/triggers/interface_50_modNotification_Notification.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess'], - 'htdocs/core/triggers/interface_80_modStripe_Stripe.class.php' => ['PhanPluginEmptyStatementIf', 'PhanUndeclaredProperty'], 'htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php' => ['PhanUndeclaredProperty'], 'htdocs/cron/card.php' => ['PhanPluginBothLiteralsBinaryOp'], - 'htdocs/cron/class/cronjob.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/cron/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/datapolicy/class/datapolicycron.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/debugbar/class/DataCollector/DolConfigCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/debugbar/class/DataCollector/DolMemoryCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'], @@ -387,7 +378,7 @@ return [ 'htdocs/don/admin/donation.php' => ['PhanUndeclaredMethod'], 'htdocs/don/card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/don/class/api_donations.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/don/class/don.class.php' => ['PhanParamTooMany', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'], + 'htdocs/don/class/don.class.php' => ['PhanParamTooMany'], 'htdocs/don/class/paymentdonation.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/don/document.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/don/index.php' => ['PhanPluginUndeclaredVariableIsset'], @@ -403,9 +394,7 @@ return [ 'htdocs/ecm/class/htmlecm.form.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/ecm/dir_card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/ecm/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], - 'htdocs/emailcollector/class/emailcollectoraction.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/emailcollector/class/emailcollectorfilter.class.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'], 'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/eventorganization/conferenceorbooth_card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/eventorganization/conferenceorbooth_contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], @@ -416,7 +405,6 @@ return [ 'htdocs/expedition/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/expedition/class/api_shipments.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/expedition/class/expedition.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/expedition/class/expeditionlinebatch.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/expedition/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/expedition/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/expedition/document.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -425,7 +413,6 @@ return [ 'htdocs/expedition/shipment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/expensereport/class/api_expensereports.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/expensereport/payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/payment/info.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -437,17 +424,14 @@ return [ 'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/fichinter/class/fichinterstats.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/fichinter/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/filefunc.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/fourn/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/fourn/class/fournisseur.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], - 'htdocs/fourn/class/paiementfourn.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/fourn/commande/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/fourn/commande/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimAssignment', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredProperty'], 'htdocs/fourn/commande/contact.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fourn/commande/dispatch.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fourn/commande/document.php' => ['PhanUndeclaredGlobalVariable'], @@ -486,7 +470,6 @@ return [ 'htdocs/hrm/position_list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/hrm/skill_card.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/hrm/skill_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/imports/class/import.class.php' => ['PhanPluginEmptyStatementIf'], 'htdocs/imports/emptyexample.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/imports/import.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], @@ -498,21 +481,16 @@ return [ 'htdocs/install/step5.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/install/upgrade.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/intracommreport/card.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/intracommreport/class/intracommreport.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/knowledgemanagement/class/knowledgerecord.class.php' => ['PhanUndeclaredProperty'], 'htdocs/knowledgemanagement/knowledgerecord_card.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/knowledgemanagement/knowledgerecord_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/loan/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/loan/class/loan.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/loan/class/loanschedule.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/loan/class/paymentloan.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/loan/document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/loan/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/loan/note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/loan/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/loan/schedule.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/mailmanspip/class/mailmanspip.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/margin/customerMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/margin/productMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/master.inc.php' => ['PhanUndeclaredGlobalVariable'], @@ -523,18 +501,17 @@ return [ 'htdocs/mrp/mo_production.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/mrp/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/mrp/tpl/originproductline.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/multicurrency/class/api_multicurrencies.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/multicurrency/class/multicurrency.class.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/multicurrency/class/api_multicurrencies.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], + 'htdocs/multicurrency/class/multicurrency.class.php' => ['PhanTypeExpectedObjectPropAccess'], 'htdocs/opcachepreload.php' => ['PhanEmptyForeach'], - 'htdocs/opensurvey/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/opensurvey/class/opensurveysondage.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], + 'htdocs/opensurvey/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/opensurvey/class/opensurveysondage.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/opensurvey/list.php' => ['PhanEmptyForeach', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/opensurvey/results.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/opensurvey/wizard/choix_date.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/opensurvey/wizard/create_survey.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/partnership/class/api_partnerships.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/partnership/class/partnership.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/partnership/class/partnershiputils.class.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/partnership/partnership_card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/partnership/partnership_list.php' => ['PhanUndeclaredProperty'], @@ -544,14 +521,9 @@ return [ 'htdocs/product/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/product/class/api_products.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/product/class/html.formproduct.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/product/class/product.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/product/class/productbatch.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'], 'htdocs/product/class/productfournisseurprice.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/product/class/propalmergepdfproduct.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/product/document.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/dynamic_price/class/price_global_variable.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'], - 'htdocs/product/dynamic_price/class/price_global_variable_updater.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'], - 'htdocs/product/dynamic_price/class/price_parser.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], 'htdocs/product/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/product/inventory/card.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/inventory/class/inventory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], @@ -634,7 +606,7 @@ return [ 'htdocs/public/project/suggestconference.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/recruitment/view.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/public/stripe/ipn.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], + 'htdocs/public/stripe/ipn.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/public/test/test_forms.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'], @@ -673,7 +645,6 @@ return [ 'htdocs/salaries/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/salaries/class/api_salaries.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/salaries/class/paymentsalary.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/salaries/class/salariesstats.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/salaries/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/salaries/paiement_salary.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/salaries/virement_request.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], @@ -691,7 +662,7 @@ return [ 'htdocs/societe/tpl/linesalesrepresentative.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/website.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginSuspiciousParamPosition'], - 'htdocs/stripe/class/stripe.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchProperty'], + 'htdocs/stripe/class/stripe.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchProperty'], 'htdocs/supplier_proposal/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/supplier_proposal/class/api_supplier_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/supplier_proposal/class/supplier_proposal.class.php' => ['PhanUndeclaredProperty'], @@ -718,7 +689,7 @@ return [ 'htdocs/theme/md/info-box.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/md/progress.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/ticket/card.php' => ['PhanUndeclaredProperty'], - 'htdocs/ticket/class/actions_ticket.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], + 'htdocs/ticket/class/actions_ticket.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/ticket/class/api_tickets.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/ticket/class/cticketcategory.class.php' => ['PhanUndeclaredProperty'], 'htdocs/ticket/class/ticket.class.php' => ['PhanUndeclaredProperty'], @@ -743,7 +714,7 @@ return [ 'htdocs/webhook/target_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/webportal/class/context.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/webportal/class/controller.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/webportal/class/html.formcardwebportal.class.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/webportal/class/html.formcardwebportal.class.php' => ['PhanUndeclaredProperty'], 'htdocs/webportal/class/html.formlistwebportal.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/webportal/class/webportalpropal.class.php' => ['PhanUndeclaredProperty'], 'htdocs/webservices/server_actioncomm.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index c0d92b3a75db5..9cea818bac661 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -223,7 +223,7 @@ 'simplify_ast' => true, 'analyzed_file_extensions' => ['php','inc'], 'globals_type_map' => [ - '_Avery_Labels' => 'array', + '_Avery_Labels' => 'array', 'action' => 'string', 'actioncode' => 'string', 'badgeStatus0' => 'string', diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 0b9441d8e685d..0e349810944ca 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -203,8 +203,8 @@ $arrayfields[$tableprefix.'.'.$key] = array( 'label' => $val['label'], 'checked' => (($visible < 0) ? 0 : 1), - 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), - 'position' => $val['position'], + 'enabled' => (int) (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), + 'position' => (int) $val['position'], 'help' => isset($val['help']) ? $val['help'] : '' ); } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 93a2a9abf8a57..900a9b16101d6 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -876,7 +876,7 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom $fac = new Facture($this->db); $fac->fetch($key); $fac->fetch_thirdparty(); - if (!in_array($fac->thirdparty->id, $linkaddedforthirdparty)) { // Not yet done for this thirdparty + if (!in_array($fac->thirdparty->id, $linkaddedforthirdparty)) { // Not yet done for this thirdparty @phan-suppress-current-line PhanPossiblyUndeclaredVariable $result = $acc->add_url_line( $bank_line_id, $fac->thirdparty->id, diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f0b84bf328eed..c12e9dee9c900 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -344,7 +344,7 @@ abstract class CommonObject public $newref; /** - * @var int|array The object's status. Use status instead. + * @var null|int|array The object's status. Use status instead. * @deprecated Use $status instead. * @see $status * @see setStatut(), $status @@ -352,9 +352,10 @@ abstract class CommonObject public $statut; /** - * @var int|array The object's status (an int). + * @var null|int|array The object's status (an int). * Or an array listing all the potential status of the object: * array: int of the status => translated label of the status + * In some classes status must be able to be null. * See for example the Account class. * @see setStatut() */ diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index 4e722c21dc34c..8dc612176d873 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -107,12 +107,12 @@ abstract class CommonStickerGenerator extends CommonDocGenerator 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} + * @var ?array{name:string,paper-size:'custom'|array{0:float,1:float},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 diff --git a/htdocs/core/modules/action/doc/pdf_standard_actions.class.php b/htdocs/core/modules/action/doc/pdf_standard_actions.class.php index bf3d192070b44..83b6a9ec13bb9 100644 --- a/htdocs/core/modules/action/doc/pdf_standard_actions.class.php +++ b/htdocs/core/modules/action/doc/pdf_standard_actions.class.php @@ -104,7 +104,7 @@ class pdf_standard_actions public $marge_basse; /** - * @var array format + * @var array{0:float,1:float} format */ public $format; diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index d9fe8a453f1ef..a2ce99ae903b9 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -57,6 +57,9 @@ class BordereauChequeBlochet extends ModeleChequeReceipts */ public $line_per_page; + /** + * @var string + */ public $ref_ext; @@ -206,7 +209,7 @@ public function write_file($object, $_dir, $number, $outputlangs) $this->Body($pdf, $pagenb, $pages, $outputlangs); // Pied de page - $this->_pagefoot($pdf, '', $outputlangs); + $this->_pagefoot($pdf, null, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } @@ -422,10 +425,10 @@ public function Body(&$pdf, $pagenb, $pages, $outputlangs) * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param ?CommonObject $object Object to show * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return mixed + * @param int<0,1> $hidefreetext 1=Hide free text + * @return int */ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index b50619460fe75..6834dcfd7e768 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -295,6 +295,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $mode = $result = $object->fetch_contact($arrayidcontact[0]); } + $contactobject = null; // Recipient name if (!empty($usecontact)) { // We can use the company of contact instead of thirdparty company @@ -426,7 +427,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $mode = * @param CommonObject $object member * @param Translate $outputlangs translation object * @param string $array_key key for array - * @return array array of substitutions + * @return array Array of substitutions */ public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') { 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 1842964ea5f96..74373fa4e9909 100644 --- a/htdocs/core/modules/member/doc/pdf_standard_member.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard_member.class.php @@ -67,7 +67,7 @@ public function __construct($db) * * @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 */ public function addSticker(&$pdf, $outputlangs, $param) diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index 01064493aad5c..d8713404fdc81 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -39,7 +39,7 @@ class pdf_standardlabel extends CommonStickerGenerator * * @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 */ public function addSticker(&$pdf, $outputlangs, $param) @@ -228,7 +228,7 @@ public function Add_PDF_label(&$pdf, $textleft, $header, $footer, $outputlangs, /** * 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 diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php index 5caf4e4e2b38d..3faa66afc595d 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php @@ -94,7 +94,7 @@ private function writeBarcode(&$pdf, $code, $encoding, $is2d, $x, $y, $w, $h) * * @param TCPDF $pdf PDF reference * @param Translate $outputlangs Output langs - * @param array $param Associative array containing label content and optional parameters + * @param array{textleft:string,textheader:string,textfooter:string,textright:string,code:string,encoding:string,is2d:int<0,1>|bool} $param Associative array containing label content and optional parameters * @return void */ public function addSticker(&$pdf, $outputlangs, $param) @@ -251,7 +251,7 @@ public function addSticker(&$pdf, $outputlangs, $param) /** * 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|bool}> $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 diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 99d0d83d13e9d..f47553703c9d9 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -37,22 +37,55 @@ */ class pdf_paiement extends CommonDocGenerator { + /** + * @var int + */ public $tab_top; + /** + * @var int + */ public $line_height; + /** + * @var int + */ public $line_per_page; + /** + * @var int + */ public $tab_height; + /** + * @var int + */ public $posxdate; + /** + * @var int + */ public $posxpaymenttype; + /** + * @var int + */ public $posxinvoice; + /** + * @var int + */ public $posxbankaccount; + /** + * @var int + */ public $posxinvoiceamount; + /** + * @var int + */ public $posxpaymentamount; + /** + * @var string + */ public $doc_type; /** @@ -208,6 +241,8 @@ public function write_file($_dir, $month, $year, $outputlangs) $result = $this->db->query($sql); if ($result) { $numpaiement = $this->db->num_rows($result); + } else { + $numpaiement = 0; } // number of bill @@ -464,7 +499,7 @@ protected function _pagehead(&$pdf, $page, $showaddress, $outputlangs) * * @param TCPDF $pdf PDF object * @param int $page Page - * @param array $lines Array of lines + * @param array> $lines Array of lines * @param Translate $outputlangs Object langs * @return void */ @@ -477,13 +512,14 @@ public function Body(&$pdf, $page, $lines, $outputlangs) $pdf->SetFont('', '', $default_font_size - 1); $oldprowid = 0; $total_page = 0; + $total_mod = 0; + $mod = 0; $total = 0; $pdf->SetFillColor(220, 220, 220); $yp = 0; $numlines = count($lines); if (($this->doc_type == 'client' && getDolGlobalString('PAYMENTS_REPORT_GROUP_BY_MOD')) || ($this->doc_type == 'fourn' && getDolGlobalString('PAYMENTS_FOURN_REPORT_GROUP_BY_MOD'))) { $mod = $lines[0][2]; - $total_mod = 0; } for ($j = 0; $j < $numlines; $j++) { $i = $j; @@ -528,9 +564,9 @@ public function Body(&$pdf, $page, $lines, $outputlangs) $pdf->SetXY($this->posxpaymentamount, $this->tab_top + 10 + $yp); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $lines[$j][4], 0, 'R', 1); $yp += 5; - $total_page += $lines[$j][9]; + $total_page += (float) $lines[$j][9]; if (($this->doc_type == 'client' && getDolGlobalString('PAYMENTS_REPORT_GROUP_BY_MOD')) || ($this->doc_type == 'fourn' && getDolGlobalString('PAYMENTS_FOURN_REPORT_GROUP_BY_MOD'))) { - $total_mod += $lines[$j][9]; + $total_mod += (float) $lines[$j][9]; } } diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index b9a009f7c0a1b..5bbd3995e15fa 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -33,6 +33,9 @@ */ class InterfaceNotification extends DolibarrTriggers { + /** + * @var string[] + */ public $listofmanagedevents = array(); /** @@ -102,7 +105,7 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf /** * Return list of events managed by notification module * - * @return array Array of events managed by notification module + * @return array Array of events managed by notification module */ public function getListOfManagedEvents() { diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index faa556da23576..7576164ae30d2 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -198,14 +198,15 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf $contactid = empty($object->context['contactid']) ? 0 : $object->context['contactid']; $res = 0; + $contactObj = null; if (!empty($contactid)) { - $contact = new Contact($this->db); - $res = $contact->fetch($contactid); + $contactObj = new Contact($this->db); + $res = $contactObj->fetch($contactid); } - if ($res > 0 && !empty($contact->email) && !empty($contact->statut)) { - $sendto = $contact->email; + if ($contactObj !== null && !empty($contactObj->email) && !empty($contactObj->statut)) { + $sendto = $contactObj->email; } elseif (!empty($object->fk_soc)) { $object->fetch_thirdparty(); $sendto = $object->thirdparty->email; @@ -256,13 +257,14 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf $contactid = empty($object->context['contactid']) ? 0 : $object->context['contactid']; $res = 0; + $contactObj = null; if ($contactid > 0) { // TODO This security test has no sens. We must check that $contactid is inside $linked_contacts[]['id'] when $linked_contacts[]['source'] = 'external' or 'thirdparty' // Refuse email if not - $contact = new Contact($this->db); - $res = $contact->fetch($contactid); - if (! in_array($contact, $linked_contacts)) { + $contactObj = new Contact($this->db); + $res = $contactObj->fetch($contactid); + if (! in_array($contactObj, $linked_contacts)) { $error_msg = $langs->trans('Error'). ': '; $error_msg .= $langs->transnoentities('TicketWrongContact'); setEventMessages($error_msg, [], 'errors'); @@ -272,8 +274,8 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf } $sendto = ''; - if ($res > 0 && !empty($contact->email) && !empty($contact->statut)) { - $sendto = $contact->email; + if ($contactObj !== null && $res > 0 && !empty($contactObj->email) && !empty($contactObj->statut)) { + $sendto = $contactObj->email; } elseif (!empty($linked_contacts) && ($contactid == -2 || (GETPOST('massaction', 'alpha') == 'close' && GETPOST('confirm', 'alpha') == 'yes'))) { // if sending to all contacts or sending to contacts while mass closing $temp_emails = []; @@ -350,6 +352,7 @@ private function composeAndSendAdminMessage($sendto, $base_subject, $body, Ticke $trackid = 'tic'.$object->id; + $old_MAIN_MAIL_AUTOCOPY_TO = null; if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) { $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO'); $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index 4099ae40390a6..89ab8a634c42c 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -206,10 +206,10 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf } // If payment mode is linked to Stripe, we update/delete Stripe too - if ($action == 'COMPANYPAYMENTMODE_CREATE' && $object->type == 'card') { - // For creation of credit card, we do not create in Stripe automatically - } - if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object->type == 'card' && $object instanceof CompanyPaymentMode) { + //if ($action == 'COMPANYPAYMENTMODE_CREATE' && $object instanceof CompanyPaymentMode && $object->type == 'card') { + // For creation of credit card, we do not create in Stripe automatically + //} + if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object instanceof CompanyPaymentMode && $object->type == 'card') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($object->stripe_card_ref)) { diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index d3dfb5f6b9206..b91eb248c343d 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -73,12 +73,33 @@ class Cronjob extends CommonObject * @var string Job command */ public $command; + /** + * @var null|string + */ public $classesname; + /** + * @var null|string + */ public $objectname; + /** + * @var null|string + */ public $methodename; + /** + * @var null|string + */ public $params; + /** + * @var null|string + */ public $md5params; + /** + * @var null|string + */ public $module_name; + /** + * @var null|int|string + */ public $priority; /** @@ -515,9 +536,9 @@ public function fetch(int $id, string $objectname = '', string $methodname = '') * @param string $sortfield Sort field * @param int $limit Limit page * @param int $offset Offset ppage - * @param int $status Display active or not (-1=no filter, 0=not active, 1=active, 2=archived) - * @param string|array $filter Filter USF. - * @param int $processing Processing or not (-1=all, 0=not in progress, 1=in progress) + * @param int<-1,2> $status Display active or not (-1=no filter, 0=not active, 1=active, 2=archived) + * @param string|array $filter Filter USF. + * @param int<-1,1> $processing Processing or not (-1=all, 0=not in progress, 1=in progress) * @return int if KO: <0 || if OK: >0 */ public function fetchAll(string $sortorder = 'DESC', string $sortfield = 't.rowid', int $limit = 0, int $offset = 0, int $status = 1, $filter = '', int $processing = -1) diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index e1d0012f3c1af..d2b8d88a1fa49 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -34,8 +34,14 @@ class DataPolicyCron */ public $db; + /** + * @var string + */ public $error; + /** + * @var string + */ public $output; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 87860eb2e9f35..eac251a8cf0a9 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -477,10 +477,10 @@ public function create($user, $notrigger = 0) } } - if (!$error && (getDolGlobalString('MAIN_DISABLEDRAFTSTATUS') || getDolGlobalString('MAIN_DISABLEDRAFTSTATUS_DONATION'))) { - //$res = $this->setValid($user); - //if ($res < 0) $error++; - } + //if (!$error && (getDolGlobalString('MAIN_DISABLEDRAFTSTATUS') || getDolGlobalString('MAIN_DISABLEDRAFTSTATUS_DONATION'))) { + //$res = $this->setValid($user); + //if ($res < 0) $error++; + //} if (!$error) { $this->db->commit(); diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 26da8f04930d4..e4dceae159fe1 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1179,6 +1179,8 @@ public function doCollectOneCollector($mode = 0) return -1; } + $client = null; + $sourcedir = $this->source_directory; $targetdir = ($this->target_directory ? $this->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag' diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index 9a36b208cdaa7..7cbcd91766155 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -84,15 +84,42 @@ class EmailCollectorAction extends CommonObject 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 1000, 'notnull' => -1,), 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'position' => 1000, 'notnull' => 1, 'default' => 1, 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled')), ); + /** + * @var int + */ public $rowid; + /** + * @var int + */ public $fk_emailcollector; + /** + * @var string + */ public $type; + /** + * @var string + */ public $actionparam; + /** + * @var int + */ public $fk_user_creat; + /** + * @var int + */ public $fk_user_modif; + /** + * @var int + */ public $position; + /** + * @var string + */ public $import_key; + /** + * @var int + */ public $status; // END MODULEBUILDER PROPERTIES diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index fd6495d28e7d5..cc099cc32406e 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -85,14 +85,38 @@ class EmailCollectorFilter extends CommonObject 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 1000, 'notnull' => -1,), 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'position' => 1000, 'notnull' => 1, 'default' => '1', 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled')), ); + /** + * @var int + */ public $rowid; + /** + * @var int + */ public $fk_emailcollector; + /** + * @var string + */ public $type; + /** + * @var string + */ public $rulevalue; + /** + * @var int + */ public $fk_user_creat; + /** + * @var int + */ public $fk_user_modif; + /** + * @var string + */ public $import_key; + /** + * @var int + */ public $status; // END MODULEBUILDER PROPERTIES diff --git a/htdocs/expedition/class/expeditionligne.class.php b/htdocs/expedition/class/expeditionligne.class.php index 888c953f7a318..35d305d3d927b 100644 --- a/htdocs/expedition/class/expeditionligne.class.php +++ b/htdocs/expedition/class/expeditionligne.class.php @@ -511,8 +511,8 @@ public function update($user = null, $notrigger = 0) $qty = price2num($this->qty); $remainingQty = 0; $batch = null; - $batch_id = null; - $expedition_batch_id = null; + $batch_id = 0; + $expedition_batch_id = 0; if (is_array($this->detail_batch)) { // array of ExpeditionLineBatch if (count($this->detail_batch) > 1) { dol_syslog(get_class($this).'::update only possible for one batch', LOG_ERR); @@ -605,7 +605,7 @@ public function update($user = null, $notrigger = 0) $shipmentLot->sellby = $lot->sellby; $shipmentLot->entrepot_id = $this->detail_batch->entrepot_id; $shipmentLot->qty = $this->detail_batch->qty; - $shipmentLot->fk_origin_stock = $batch_id; + $shipmentLot->fk_origin_stock = (int) $batch_id; if ($shipmentLot->create($this->id) < 0) { $this->errors = $shipmentLot->errors; $error++; diff --git a/htdocs/expedition/class/expeditionlinebatch.class.php b/htdocs/expedition/class/expeditionlinebatch.class.php index a1270b3b1c063..7bce8575ff886 100644 --- a/htdocs/expedition/class/expeditionlinebatch.class.php +++ b/htdocs/expedition/class/expeditionlinebatch.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2013-2014 Cedric GROSS + * 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 @@ -38,18 +39,43 @@ class ExpeditionLineBatch extends CommonObject */ public $table_element = 'expeditiondet_batch'; + /** + * @var null|int|string + */ public $sellby; + /** + * @var null|int|string + */ public $eatby; + /** + * @var ?string + */ public $batch; /** * @var float Quantity */ public $qty; - public $dluo_qty; // deprecated, use qty + /** + * @var null|float + * @deprecated Use $qty + */ + public $dluo_qty; + /** + * @var int + */ public $entrepot_id; + /** + * @var int + */ public $fk_origin_stock; // rowid in llx_product_batch table (not useful) + /** + * @var int + */ public $fk_warehouse; // warehouse ID + /** + * @var int + */ public $fk_expeditiondet; @@ -134,10 +160,10 @@ public function create($id_line_expdet, $f_user = null, $notrigger = 0) $sql .= $id_line_expdet; $sql .= ", ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : ("'".$this->db->idate($this->sellby))."'"); $sql .= ", ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : ("'".$this->db->idate($this->eatby))."'"); - $sql .= ", ".(!isset($this->batch) ? 'NULL' : ("'".$this->db->escape($this->batch)."'")); + $sql .= ", ".(!empty($this->batch) ? 'NULL' : ("'".$this->db->escape($this->batch)."'")); $sql .= ", ".(!isset($this->qty) ? ((!isset($this->dluo_qty)) ? 'NULL' : $this->dluo_qty) : $this->qty); // dluo_qty deprecated, use qty - $sql .= ", ".(!isset($this->fk_origin_stock) ? 'NULL' : $this->fk_origin_stock); - $sql .= ", ".(!isset($this->fk_warehouse) ? 'NULL' : $this->fk_warehouse); + $sql .= ", ".((int) $this->fk_origin_stock); + $sql .= ", ".(empty($this->fk_warehouse) ? 'NULL' : $this->fk_warehouse); $sql .= ")"; dol_syslog(__METHOD__, LOG_DEBUG); @@ -195,9 +221,9 @@ public function deleteFromShipment($id_expedition) /** * Retrieve all batch number detailed information of a shipment line * - * @param int $id_line_expdet id of shipment line - * @param int $fk_product If provided, load also detailed information of lot - * @return int|array -1 if KO, array of ExpeditionLineBatch if OK + * @param int $id_line_expdet id of shipment line + * @param int $fk_product If provided, load also detailed information of lot + * @return int<-1,-1>|ExpeditionLineBatch[] -1 if KO, array of ExpeditionLineBatch if OK */ public function fetchAll($id_line_expdet, $fk_product = 0) { diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index b3680728043f8..d8ecfc9962f72 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -557,6 +557,7 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom //Fix me field $total = $this->amount; + $amount = 0; if ($mode == 'payment_expensereport') { $amount = $total; @@ -569,7 +570,7 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom $label, -$amount, $this->num_payment, - '', + 0, $user, $emetteur_nom, $emetteur_banque diff --git a/htdocs/fichinter/class/fichinterstats.class.php b/htdocs/fichinter/class/fichinterstats.class.php index c2f7fbd7638c8..fea319988a125 100644 --- a/htdocs/fichinter/class/fichinterstats.class.php +++ b/htdocs/fichinter/class/fichinterstats.class.php @@ -39,11 +39,26 @@ class FichinterStats extends Stats */ public $table_element; + /** + * @var int + */ public $socid; + /** + * @var int + */ public $userid; + /** + * @var string + */ public $from; + /** + * @var string + */ public $field; + /** + * @var string + */ public $where; diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 7ad18c625978c..06d9efaee2a84 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -35,7 +35,7 @@ class SupplierInvoices extends DolibarrApi { /** * - * @var array $FIELDS Mandatory fields, checked when create and update object + * @var string[] $FIELDS Mandatory fields, checked when create and update object */ public static $FIELDS = array( 'socid', diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index cc774bcb1b446..c26b99bfc0971 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2006 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * 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 @@ -190,7 +191,7 @@ public function CreateCategory($user, $name) /** * Return the suppliers list * - * @return array Array of suppliers + * @return array Array of suppliers */ public function ListArray() { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 6592eee64a2c6..26613c10e0d6e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -83,7 +83,7 @@ class CommandeFournisseur extends CommonOrder /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user - * @var integer + * @var int<0,1> */ public $restrictiononfksoc = 1; @@ -115,7 +115,7 @@ class CommandeFournisseur extends CommonOrder public $ref_fourn; /** - * @var int + * @var ?int<0,9> */ public $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Ordered/Process running -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially // -> 7=Canceled/Never received -> (reopen) 3=Process running @@ -123,6 +123,9 @@ class CommandeFournisseur extends CommonOrder // -> 9=Refused -> (reopen) 1=Validated // Note: billed or not is on another field "billed" + /** + * @var int<0,1> + */ public $billed; /** @@ -161,9 +164,18 @@ class CommandeFournisseur extends CommonOrder */ public $date_commande; - //For backward compatibility + /** + * @deprecated Provided or backward compatibility + * @var float + */ public $remise_percent; + /** + * @var int + */ public $methode_commande_id; + /** + * @var int + */ public $methode_commande; /** @@ -196,6 +208,9 @@ class CommandeFournisseur extends CommonOrder */ public $total_ttc; + /** + * @var int + */ public $source; /** @@ -259,6 +274,9 @@ class CommandeFournisseur extends CommonOrder */ public $user_approve_id2; + /** + * @var string + */ public $refuse_note; /** @@ -276,8 +294,13 @@ class CommandeFournisseur extends CommonOrder */ public $line; - // Add for supplier_proposal + /** + * @var CommonObject Add for supplier_proposal + */ public $origin; + /** + * @var int + */ public $origin_id; public $linked_objects = array(); @@ -969,7 +992,7 @@ public function getTooltipContentArray($params) if ($user->hasRight("fournisseur", "commande", "read")) { $datas['picto'] = ''.$langs->trans("SupplierOrder").''; - if (isset($this->statut)) { + if ($this->statut) { $datas['picto'] .= ' '.$this->getLibStatut(5); } if (!empty($this->ref)) { @@ -2523,7 +2546,7 @@ public function delete(User $user, $notrigger = 0) * @since 8.0 Return dispatched quantity (qty). * * @param int $status Filter on stats (-1 = no filter, 0 = lines draft to be approved, 1 = approved lines) - * @return array Array of lines + * @return array Array of lines */ public function getDispachedLines($status = -1) { @@ -2574,8 +2597,8 @@ public function getDispachedLines($status = -1) * Set a delivery in database for this supplier order * * @param User $user User that input data - * @param integer $date Date of reception - * @param string $type Type of receipt ('tot' = total/done, 'par' = partial, 'nev' = never, 'can' = cancel) + * @param int $date Date of reception + * @param 'tot'|'par'|'nev'|'can' $type Type of receipt ('tot' = total/done, 'par' = partial, 'nev' = never, 'can' = cancel) * @param string $comment Comment * @return int Return integer <0 if KO, >0 if OK */ @@ -2586,6 +2609,7 @@ public function Livraison($user, $date, $type, $comment) $result = 0; $error = 0; + $dispatchedlinearray = array(); dol_syslog(get_class($this)."::Livraison"); @@ -2925,9 +2949,9 @@ public function setStatus($user, $status) * @param int $info_bits Miscellaneous information * @param int $type Type of line (0=product, 1=service) * @param int $notrigger Disable triggers - * @param integer $date_start Date start of service - * @param integer $date_end Date end of service - * @param array $array_options Extrafields array + * @param int $date_start Date start of service + * @param int $date_end Date end of service + * @param array $array_options Extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one * @param int|float $pu_ht_devise Unit price in currency * @param string $ref_supplier Supplier ref @@ -3379,10 +3403,10 @@ public function getInputMethod() * * @param string $modele Force template to use ('' to not force) * @param Translate $outputlangs Object lang to use for traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @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 Return integer < 0 if KO, 0 = no doc generated, > 0 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 508ca50485cd9..d61324e552ea7 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2595,8 +2595,8 @@ public function info($id) * Return list of replaceable invoices * Status valid or abandoned for other reason + not paid + no payment + not already replaced * - * @param int $socid Thirdparty id - * @return array|int Table of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) + * @param int $socid Thirdparty id + * @return array|int<-1,-1> Table of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) * <0 if error */ public function list_replacable_supplier_invoices($socid = 0) @@ -2646,7 +2646,7 @@ public function list_replacable_supplier_invoices($socid = 0) * (validated + payment in progress) or classified (paid in full or paid in part) + not already replaced + not already having * * @param int $socid Thirdparty id - * @return array|int Table of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) + * @return array,paymentornot:int<0,1>}>|int<-1,-1> Table of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) * <0 if error */ public function list_qualified_avoir_supplier_invoices($socid = 0) @@ -2682,7 +2682,7 @@ public function list_qualified_avoir_supplier_invoices($socid = 0) } if ($qualified) { $paymentornot = ($obj->fk_paiementfourn ? 1 : 0); - $return[$obj->rowid] = array('ref' => $obj->ref, 'status' => $obj->fk_statut, 'type' => $obj->type, 'paye' => $obj->paye, 'paymentornot' => $paymentornot); + $return[$obj->rowid] = array('ref' => (string) $obj->ref, 'status' => (int) $obj->fk_statut, 'type' => (int) $obj->type, 'paye' => (int) $obj->paye, 'paymentornot' => (int) $paymentornot); } } diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 6afb37552c9ee..ab4185520ae36 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -54,7 +54,10 @@ class PaiementFourn extends Paiement */ public $picto = 'payment'; - public $statut; //Status of payment. 0 = unvalidated; 1 = validated + /** + * @var int Status of payment. 0 = unvalidated; 1 = validated + */ + public $statut; // fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...) // fk_paiement dans llx_paiement_facture est le rowid du paiement @@ -239,6 +242,8 @@ public function create($user, $closepaidinvoices = 0, $thirdparty = null) $totalamount = (float) price2num($totalamount); $totalamount_converted = (float) price2num($totalamount_converted); + $mtotal = 0; + $total = 0; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -302,7 +307,7 @@ public function create($user, $closepaidinvoices = 0, $thirdparty = null) // Insert one discount by VAT rate category require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; $discount = new DiscountAbsolute($this->db); - $discount->fetch('', 0, $invoice->id); + $discount->fetch(0, 0, $invoice->id); if (empty($discount->id)) { // If the invoice was not yet converted into a discount (this may have been done manually before we come here) $discount->discount_type = 1; // Supplier discount $discount->description = '(DEPOSIT)'; @@ -565,7 +570,7 @@ public function info($id) * Return list of supplier invoices the payment point to * * @param string $filter SQL filter. Warning: This value must not come from a user input. - * @return array|int Array of supplier invoice id | <0 si ko + * @return array|int<-1,-1> Array of supplier invoice id | <0 si ko */ public function getBillsArray($filter = '') { @@ -848,13 +853,13 @@ public function getNextNumRef($soc, $mode = 'next') /** * Create a document onto disk according to template model. * - * @param string $modele Force template to use ('' to not force) - * @param Translate $outputlangs Object lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information - * @return int Return integer <0 if KO, 0 if nothing done, >0 if OK + * @param string $modele Force template to use ('' to not force) + * @param Translate $outputlangs Object lang a utiliser pour traduction + * @param int<0,1> $hidedetails Hide details of lines + * @param int<0,1> $hidedesc Hide description + * @param int<0,1> $hideref Hide ref + * @param ?array $moreparams Array to provide more information + * @return int Return integer <0 if KO, 0 if nothing done, >0 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index e020d2687951b..5700fb8618865 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1306,7 +1306,7 @@ $object->origin_id = $originid; // Possibility to add external linked objects with hooks - $object->linked_objects [$object->origin] = $object->origin_id; + $object->linked_objects[$object->origin] = $object->origin_id; $other_linked_objects = GETPOST('other_linked_objects', 'array'); if (!empty($other_linked_objects)) { $object->linked_objects = array_merge($object->linked_objects, $other_linked_objects); @@ -1521,7 +1521,7 @@ * View */ -$form = new Form($db); +$form = new Form($db); $formfile = new FormFile($db); $formorder = new FormOrder($db); $productstatic = new Product($db); @@ -1934,7 +1934,7 @@ $text = $langs->trans('ConfirmValidateOrder', $newref); if (isModEnabled('notification')) { require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; - $notify = new Notify($db); + $notify = new Notify($db); $text .= '
'; $text .= $notify->confirmMessage('ORDER_SUPPLIER_VALIDATE', $object->socid, $object); } @@ -1971,7 +1971,7 @@ $text = $langs->trans("ConfirmApproveThisOrder", $object->ref); if (isModEnabled('notification')) { require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; - $notify = new Notify($db); + $notify = new Notify($db); $text .= '
'; $text .= $notify->confirmMessage('ORDER_SUPPLIER_APPROVE', $object->socid, $object); } @@ -2006,7 +2006,7 @@ ); if (isModEnabled('notification')) { require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; - $notify = new Notify($db); + $notify = new Notify($db); $text .= '
'; $text .= $notify->confirmMessage('ORDER_SUPPLIER_CANCEL', $object->socid, $object); } @@ -2018,7 +2018,7 @@ $date_com = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); if (isModEnabled('notification')) { require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; - $notify = new Notify($db); + $notify = new Notify($db); $text .= '
'; $text .= $notify->confirmMessage('ORDER_SUPPLIER_SUBMIT', $object->socid, $object); } diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 5e52c5c24ca13..f9156a38115a8 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -453,16 +453,15 @@ public function delete($user, $notrigger = 0) $this->errors[] = "Error ".$this->db->lasterror(); } + /* Not used. This is not a business object. To convert it we must herit from CommonObject if (!$error) { - if (!$notrigger) { - /* Not used. This is not a business object. To convert it we must herit from CommonObject // Call trigger $result=$this->call_trigger('IMPORT_DELETE',$user); if ($result < 0) $error++; // End call triggers - */ } } + */ // Commit or rollback if ($error) { diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index 58609f85590c9..5bca6f0940aa9 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -142,7 +142,13 @@ class IntracommReport extends CommonObject * @var string */ public $type_export; + /** + * @var int|string + */ public $datec; + /** + * @var int + */ public $tms; // END MODULEBUILDER PROPERTIES @@ -152,8 +158,14 @@ class IntracommReport extends CommonObject */ public $label; + /** + * @var string + */ public $period; + /** + * @var string + */ public $declaration; /** @@ -391,6 +403,7 @@ public function addItemsFact(&$declaration, $type, $period_reference, $exporttyp return 0; } + $categ_fraisdeport = null; if ($exporttype == 'deb' && getDolGlobalInt('INTRACOMMREPORT_CATEG_FRAISDEPORT') > 0) { $categ_fraisdeport = new Categorie($this->db); $categ_fraisdeport->fetch(getDolGlobalString('INTRACOMMREPORT_CATEG_FRAISDEPORT')); @@ -530,7 +543,7 @@ public function addItemXMlDes($declaration, &$res, $i) * This function adds an item by retrieving the customs code of the product with the highest amount in the invoice * * @param SimpleXMLElement $declaration Reference declaration - * @param array $TLinesFraisDePort Data of shipping costs line + * @param Object[] $TLinesFraisDePort Data of shipping costs line * @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des) * @param Categorie $categ_fraisdeport category of shipping costs * @param int $i Line Id @@ -595,11 +608,12 @@ public function getNextDeclarationNumber() $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE exporttype = '".$this->db->escape($this->type_export)."'"; $resql = $this->db->query($sql); + $res = null; if ($resql) { $res = $this->db->fetch_object($resql); } - return (string) ($res->max_declaration_number + 1); + return (string) ($res !== null ? ($res->max_declaration_number + 1) : ''); } /** diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index a4e2c7ed84800..97c87aaf6415a 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -350,7 +350,7 @@ public function delete($user) // Get bank transaction lines for this loan include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $account = new Account($this->db); - $lines_url = $account->get_url('', $this->id, 'loan'); + $lines_url = $account->get_url(0, $this->id, 'loan'); // Delete bank urls foreach ($lines_url as $line_url) { diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index 7e5d2f4f428b6..87ce150cd2396 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -46,7 +46,13 @@ class LoanSchedule extends CommonObject */ public $fk_loan; + /** + * @var int + */ public $bank_account; + /** + * @var int + */ public $bank_line; /** @@ -59,9 +65,21 @@ class LoanSchedule extends CommonObject */ public $datep; + /** + * @var float[] + */ public $amounts = array(); // Array of amounts - public $amount_capital; // Total amount of payment + /** + * @var null|float|string Total amount of payment + */ + public $amount_capital; + /** + * @var null|float|string + */ public $amount_insurance; + /** + * @var null|float|string + */ public $amount_interest; /** @@ -102,12 +120,19 @@ class LoanSchedule extends CommonObject public $lines = array(); /** - * @deprecated + * @deprecated Use $amount, $amounts * @see $amount, $amounts + * @var float */ public $total; + /** + * @var string + */ public $type_code; + /** + * @var string + */ public $type_label; @@ -565,9 +590,9 @@ private function lastPayment($loanid) /** * paimenttorecord * - * @param int $loanid Loan id - * @param int $datemax Date max - * @return array Array of id + * @param int $loanid Loan id + * @param int $datemax Date max + * @return int[] Array of id */ public function paimenttorecord($loanid, $datemax) { diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index d8b461ad7d8bc..98ba5d2bba2be 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -78,7 +78,7 @@ class PaymentLoan extends CommonObject public $amount_insurance; /** - * @var float|int + * @var null|float|int */ public $amount_interest; @@ -116,6 +116,9 @@ class PaymentLoan extends CommonObject * @var string */ public $type_label; + /** + * @var int + */ public $chid; /** * @var string @@ -131,6 +134,9 @@ class PaymentLoan extends CommonObject * @var int */ public $bank_account; + /** + * @var int + */ public $bank_line; @@ -552,7 +558,7 @@ public function addPaymentToBank($user, $fk_loan, $mode, $label, $accountid, $em $label, $total, $this->num_payment, - '', + 0, $user, $emetteur_nom, $emetteur_banque diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index c1b3a2aca46d9..128243ffe37d6 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -56,22 +56,22 @@ class MailmanSpip public $errors = array(); /** - * @var array + * @var array */ public $mladded_ok; /** - * @var array + * @var array */ public $mladded_ko; /** - * @var array + * @var array */ public $mlremoved_ok; /** - * @var array + * @var array */ public $mlremoved_ko; diff --git a/htdocs/multicurrency/class/api_multicurrencies.class.php b/htdocs/multicurrency/class/api_multicurrencies.class.php index 09ad43b6dbe7e..50dff7401ccd8 100644 --- a/htdocs/multicurrency/class/api_multicurrencies.class.php +++ b/htdocs/multicurrency/class/api_multicurrencies.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 @@ -144,7 +145,7 @@ public function get($id) public function getByCode($code) { $multicurrency = new MultiCurrency($this->db); - if (!$multicurrency->fetch('', $code)) { + if (!$multicurrency->fetch(0, $code)) { throw new RestException(404, 'Currency not found'); } diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index ebfbe3e433df2..b02c662f514ff 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -713,13 +713,13 @@ public function syncRates($key, $addifnotfound = 0, $mode = "") /** * Check in database if the current code already exists * - * @param string $code current code to search - * @return boolean True if exists, false if not exists + * @param string $code current code to search + * @return bool True if exists, false if not exists */ public function checkCodeAlreadyExists($code) { $currencytmp = new MultiCurrency($this->db); - if ($currencytmp->fetch('', $code) > 0) { + if ($currencytmp->fetch(0, $code) > 0) { return true; } else { return false; diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 9b511e970e271..ef27448e34a2b 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -97,7 +97,7 @@ accessforbidden(); } - $result = $object->delete($user, '', $numsondage); + $result = $object->delete($user, 0, $numsondage); header('Location: '.dol_buildpath('/opensurvey/list.php', 1)); exit(); @@ -217,7 +217,7 @@ $listofanswers = array(); foreach ($toutsujet as $value) { $tmp = explode('@', $value); - $listofanswers[] = array('label'=>$tmp[0], 'format'=>(!empty($tmp[1]) ? $tmp[1] : 'checkbox')); + $listofanswers[] = array('label' => $tmp[0], 'format' => (!empty($tmp[1]) ? $tmp[1] : 'checkbox')); } $toutsujet = str_replace("@", "
", $toutsujet); $toutsujet = str_replace("°", "'", $toutsujet); @@ -350,7 +350,7 @@ $url = $urlwithroot.'/public/opensurvey/studs.php?sondage='.$object->id_sondage; print ''; //if ($action != 'edit') { - print ajax_autoselect("opensurveyurl", $url, 'image'); +print ajax_autoselect("opensurveyurl", $url, 'image'); //} print ''; diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 13327925dcc4c..3a952452586fc 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -157,6 +157,9 @@ class Opensurveysondage extends CommonObject * @var int|'' end date of survey */ public $date_fin = ''; + /** + * @var int + */ public $status; /** @@ -393,7 +396,7 @@ public function update(User $user, $notrigger = 0) $sql .= " nom_admin=".(isset($this->nom_admin) ? "'".$this->db->escape($this->nom_admin)."'" : "null").","; $sql .= " titre=".(isset($this->title) ? "'".$this->db->escape($this->title)."'" : "null").","; $sql .= " date_fin=".(dol_strlen($this->date_fin) != 0 ? "'".$this->db->idate($this->date_fin)."'" : 'null').","; - $sql .= " status=".(isset($this->status) ? "'".$this->db->escape($this->status)."'" : "null").","; + $sql .= " status=".(!empty($this->status) ? (int) $this->status : "null").","; $sql .= " format=".(isset($this->format) ? "'".$this->db->escape($this->format)."'" : "null").","; $sql .= " mailsonde=".(isset($this->mailsonde) ? ((int) $this->mailsonde) : "null").","; $sql .= " allow_comments=".((int) $this->allow_comments).","; @@ -528,10 +531,10 @@ public function getTooltipContentArray($params) /** * Return a link to the object card (with optionally the picto) * - * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) - * @param int $notooltip 1=Disable tooltip - * @param string $morecss Add more css on link - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int<0,2> $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param int<0,1> $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ public function getNomUrl($withpicto = 0, $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) @@ -694,10 +697,10 @@ public function getComments() /** * Adds a comment to the poll * - * @param string $comment Comment content - * @param string $comment_user Comment author - * @param string $user_ip Comment author IP - * @return boolean False in case of the query fails, true if it was successful + * @param string $comment Comment content + * @param string $comment_user Comment author + * @param string $user_ip Comment author IP + * @return bool False in case of the query fails, true if it was successful */ public function addComment($comment, $comment_user, $user_ip = '') { diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index fa158f5b0df04..d766fe86d54cb 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -552,6 +552,7 @@ private function checkDolibarrBacklink($website = null) $xpath = new DOMXPath($dom); $hrefs = $xpath->evaluate("//a"); + '@phan-var-force DOMNodeList $hrefs'; for ($i = 0; $i < $hrefs->length; $i++) { $href = $hrefs->item($i); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f60226709c1d8..f7a21500f8513 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -611,47 +611,47 @@ class Product extends CommonObject public $barcode_type_code; /** - * @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats propales + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats propales */ public $stats_propale = array(); /** - * @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats orders + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats orders */ public $stats_commande = array(); /** - * @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats contracts + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats contracts */ public $stats_contrat = array(); /** - * @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats invoices + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats invoices */ public $stats_facture = array(); /** - * @var array{}|array{suppliers:int,nb:int,rows:int,qty:int} stats supplier propales + * @var array{}|array{suppliers:int,nb:int,rows:int,qty:float} stats supplier propales */ public $stats_proposal_supplier = array(); /** - * @var array{}|array{suppliers:int,nb:int,rows:int,qty:int|float} stats supplier orders + * @var array{}|array{suppliers:int,nb:int,rows:int,qty:float} stats supplier orders */ public $stats_commande_fournisseur = array(); /** - * @var array{}|array{customers:int,nb:int,rows:int,qty:int} stats shipping + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats shipping */ public $stats_expedition = array(); /** - * @var array{}|array{suppliers:int,nb:int,rows:int,qty:int|float} stats receptions + * @var array{}|array{suppliers:int,nb:int,rows:int,qty:float} stats receptions */ public $stats_reception = array(); /** - * @var array{}|array{customers_toconsume:int,nb_toconsume:int,qty_toconsume:int,customers_consumed:int,nb_consumed:int,qty_consumed:int,customers_toproduce:int,nb_toproduce:int,qty_toproduce:int,customers_produced:int,nb_produced:int,qty_produced:int} stats by role toconsume, consumed, toproduce, produced + * @var array{}|array{customers_toconsume:int,nb_toconsume:int,qty_toconsume:float,customers_consumed:int,nb_consumed:int,qty_consumed:float,customers_toproduce:int,nb_toproduce:int,qty_toproduce:float,customers_produced:int,nb_produced:int,qty_produced:float} stats by role toconsume, consumed, toproduce, produced */ public $stats_mo = array(); public $stats_bom = array(); @@ -687,7 +687,9 @@ class Product extends CommonObject */ public $nbphoto = 0; - //! Contains detail of stock of product into each warehouse + /** + * @var array Contains detail of stock of product into each warehouse + */ public $stock_warehouse = array(); /** @@ -1475,7 +1477,7 @@ public function update($id, $user, $notrigger = 0, $action = 'update', $updatety $ObjBatch = new Productbatch($this->db); $ObjBatch->batch = $valueforundefinedlot; $ObjBatch->qty = ($ObjW->real - $qty_batch); - $ObjBatch->fk_product_stock = $ObjW->id; + $ObjBatch->fk_product_stock = (int) $ObjW->id; if ($ObjBatch->create($user, 1) < 0) { $error++; @@ -5287,7 +5289,7 @@ public function clone_fournisseurs($fromId, $toId) * Function recursive, used only by get_arbo_each_prod(), to build tree of subproducts into ->res * Define value of this->res * - * @param array $prod Products array + * @param array $prod Products array * @param string $compl_path Directory path of parents to add before * @param int $multiply Because each sublevel must be multiplicated by parent nb * @param int $level Init level @@ -5459,7 +5461,7 @@ public function isVariant() /** * Return all parent products for current product (first level only) * - * @return array|int Array of product + * @return array,fk_product_type:int,entity:int,status:int,status_buy:int}>|int<-1,-1> Array of product * @see hasFatherOrChild() */ public function getFather() @@ -5476,6 +5478,7 @@ public function getFather() $prods = array(); while ($record = $this->db->fetch_array($res)) { // $record['id'] = $record['rowid'] = id of father + $prods[$record['id']] = array(); $prods[$record['id']]['id'] = $record['rowid']; $prods[$record['id']]['ref'] = $record['ref']; $prods[$record['id']]['label'] = $record['label']; diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 681cac1ed8bf9..7ffc627d8b093 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -44,8 +44,14 @@ class Productbatch extends CommonObject */ public $element = 'productbatch'; + /** + * @var string + */ private static $_table_element = 'product_batch'; //!< Name of table without prefix where object is stored + /** + * @var ?int + */ public $fk_product_stock; /** @@ -222,8 +228,10 @@ public function update($user = null, $notrigger = 0) $this->cleanParam(); // TODO Check qty is ok for stock move. Negative may not be allowed. + /* if ($this->qty < 0) { } + */ // Update request $sql = "UPDATE ".$this->db->prefix().self::$_table_element." SET"; @@ -360,7 +368,7 @@ public function initAsSpecimen() $this->id = 0; $this->tms = dol_now(); - $this->fk_product_stock = ''; + $this->fk_product_stock = 0; $this->sellby = ''; $this->eatby = ''; $this->batch = ''; @@ -377,7 +385,7 @@ public function initAsSpecimen() private function cleanParam() { if (isset($this->fk_product_stock)) { - $this->fk_product_stock = (int) trim($this->fk_product_stock); + $this->fk_product_stock = (int) trim((string) $this->fk_product_stock); } if (isset($this->batch)) { $this->batch = trim($this->batch); @@ -466,7 +474,7 @@ public function find($fk_product_stock = 0, $eatby = null, $sellby = null, $batc * @param int $fk_product_stock id product_stock for object * @param int $with_qty 1 = doesn't return line with 0 quantity * @param int $fk_product If set to a product id, get eatby and sellby from table llx_product_lot - * @return array|int Return integer <0 if KO, array of batch + * @return Productbatch[]|int Return integer <0 if KO, array of batch */ public static function findAll($dbs, $fk_product_stock, $with_qty = 0, $fk_product = 0) { @@ -569,7 +577,7 @@ public static function findAll($dbs, $fk_product_stock, $with_qty = 0, $fk_produ * @param int $qty_min [=NULL] Minimum quantity * @param string $sortfield [=NULL] List of sort fields, separated by comma. Example: 't1.fielda,t2.fieldb' * @param string $sortorder [=NULL] Sort order, separated by comma. Example: 'ASC,DESC'; - * @return int|array Return integer <0 if KO, array of batch + * @return int<-1,-1>|Productbatch[] Return integer <0 if KO, array of batch * * @throws Exception */ diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index 44a0e5eaf14c8..cb8219c42d184 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2015 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 @@ -61,6 +62,9 @@ class Propalmergepdfproduct extends CommonObject * @var int Id user */ public $fk_user_mod; + /** + * @var int|'' + */ public $datec = ''; /** @@ -601,7 +605,13 @@ class PropalmergepdfproductLine extends CommonObjectLine */ public $fk_user_mod; + /** + * @var int|'' + */ public $datec = ''; + /** + * @var string + */ public $import_key; } diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 385ee7009084b..4129687cf59f0 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -358,7 +358,7 @@ print ''; print ''.$productstatic->getNomUrl(1, 'composition').''; print ''.dol_escape_htmltag($productstatic->label).''; - print ''.dol_escape_htmltag($value['qty']).''; + print ''.dol_escape_htmltag((string) $value['qty']).''; print ''; } } else { diff --git a/htdocs/product/dynamic_price/class/price_global_variable.class.php b/htdocs/product/dynamic_price/class/price_global_variable.class.php index 6b81d780c492f..3d92ca2ddd7d5 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ion Agorria * 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 @@ -228,10 +229,10 @@ public function update($user = null, $notrigger = 0) /** * Delete object in database * - * @param int $rowid Row id of global variable - * @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 int $rowid Row id of global variable + * @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($rowid, $user, $notrigger = 0) { @@ -239,6 +240,7 @@ public function delete($rowid, $user, $notrigger = 0) $this->db->begin(); + /* if (!$error) { if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you @@ -250,6 +252,7 @@ public function delete($rowid, $user, $notrigger = 0) //// End call triggers } } + */ if (!$error) { $sql = "DELETE FROM ".$this->db->prefix().$this->table_element; diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index c303e2806c357..46dd34a856262 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -46,7 +46,13 @@ class PriceGlobalVariableUpdater */ public $errors = array(); + /** + * @var int[] + */ public $types = array(0, 1); //!< Updater types + /** + * @var int + */ public $update_min = 5; //!< Minimal update rate /** @@ -54,6 +60,9 @@ class PriceGlobalVariableUpdater */ public $id; + /** + * @var int + */ public $type; /** @@ -61,6 +70,9 @@ class PriceGlobalVariableUpdater */ public $description; + /** + * @var ?string + */ public $parameters; /** @@ -68,8 +80,17 @@ class PriceGlobalVariableUpdater */ public $fk_variable; - public $update_interval; //!< Interval in mins - public $next_update; //!< Next update timestamp + /** + * @var int Interval in mins + */ + public $update_interval; + /** + * @var int Next update timestamp + */ + public $next_update; + /** + * @var ?string + */ public $last_status; /** @@ -126,6 +147,7 @@ public function create($user, $notrigger = 0) if (!$error) { $this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element); + /* if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -135,6 +157,7 @@ public function create($user, $notrigger = 0) //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //// End call triggers } + */ } // Commit or rollback @@ -561,9 +584,9 @@ public function process() /** * Update next_update into database * - * @param string $next_update Next update to write - * @param User|null $user User that modifies - * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @param int $next_update Next update to write + * @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_next_update($next_update, $user = null, $notrigger = 0) diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index 138f5927836b5..f69d63391e0a6 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.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 @@ -32,16 +33,29 @@ */ class PriceParser { + /** + * @var DoliDB + */ protected $db; - // Limit of expressions per price + /** + * @var int Limit of expressions per price + */ public $limit = 100; - // The error that occurred when parsing price + /** + * @var array The error that occurred when parsing price + */ public $error_parser; - // The expression that caused the error + /** + * @var ?string The expression that caused the error + */ public $error_expr; - //The special char + /** + * @var string The special char + */ public $special_chr = "#"; - //The separator char + /** + * @var string The separator char + */ public $separator_chr = ";"; /** @@ -117,8 +131,8 @@ public function translatedError() * Calculates price based on expression * * @param Product $product The Product object to get information - * @param String $expression The expression to parse - * @param array $values Strings to replaces + * @param string $expression The expression to parse + * @param array $values Strings to replace * @return int > 0 if OK, < 1 if KO */ public function parseExpression($product, $expression, $values) @@ -246,7 +260,7 @@ public function parseExpression($product, $expression, $values) * Calculates product price based on product id and associated expression * * @param Product $product The Product object to get information - * @param array $extra_values Any additional values for expression + * @param array $extra_values Any additional values for expression * @return int > 0 if OK, < 1 if KO */ public function parseProduct($product, $extra_values = array()) @@ -293,7 +307,7 @@ public function parseProduct($product, $extra_values = array()) * Calculates supplier product price based on product supplier price and associated expression * * @param ProductFournisseur $product_supplier The Product supplier object to get information - * @param array $extra_values Any additional values for expression + * @param array $extra_values Any additional values for expression * @return int > 0 if OK, < 1 if KO */ public function parseProductSupplier($product_supplier, $extra_values = array()) @@ -324,7 +338,7 @@ public function parseProductSupplier($product_supplier, $extra_values = array()) * * @param int $product_id The Product id to get information * @param string $expression The expression to parse - * @param array $extra_values Any additional values for expression + * @param array $extra_values Any additional values for expression * @return int > 0 if OK, < 1 if KO */ public function testExpression($product_id, $expression, $extra_values = array()) diff --git a/htdocs/webportal/class/html.formcardwebportal.class.php b/htdocs/webportal/class/html.formcardwebportal.class.php index 8c2c1c5831588..e261d93bbcf75 100644 --- a/htdocs/webportal/class/html.formcardwebportal.class.php +++ b/htdocs/webportal/class/html.formcardwebportal.class.php @@ -207,7 +207,7 @@ public function init($elementEn, $id = 0, $permissiontoread = 0, $permissiontoad $this->backtopagejsfields = $backtopagejsfields; $this->cancel = $cancel; $this->elementEn = $elementEn; - $this->id = $id; + $this->id = (int) $id; $this->object = $object; $this->permissiontoread = $permissiontoread; $this->permissiontoadd = $permissiontoadd;