diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d23fe1be28a..5c0b747191d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -210,7 +210,7 @@ repos: - -x - dev/tools/codespell/codespell-lines-ignore.txt exclude_types: [image] - exclude: (?x)^(.phan/stubs/.*)$ + exclude: (?x)^(.phan/stubs/.*|phpstan\.neon.*)$ additional_dependencies: [tomli] - alias: codespell-lang-en_US # Only for translations with specialised exceptions diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 479e8875878..8a07bc1fe82 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,13 +9,13 @@ */ return [ // # Issue statistics: - // PhanPluginUnknownPropertyType : 1520+ occurrences + // PhanPluginUnknownPropertyType : 1490+ occurrences // PhanUndeclaredProperty : 840+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 780+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 740+ occurrences // PhanPossiblyUndeclaredGlobalVariable : 730+ occurrences - // PhanPluginUnknownArrayMethodReturnType : 470+ occurrences // PhanUndeclaredGlobalVariable : 440+ occurrences - // PhanPluginUnknownArrayMethodParamType : 400+ occurrences + // PhanPluginUnknownArrayMethodReturnType : 430+ occurrences + // PhanPluginUnknownArrayMethodParamType : 360+ occurrences // PhanPossiblyUndeclaredVariable : 330+ occurrences // PhanPluginUnknownObjectMethodCall : 230+ occurrences // PhanTypeMismatchProperty : 200+ occurrences @@ -25,7 +25,7 @@ return [ // PhanPluginUnknownArrayPropertyType : 80+ occurrences // PhanPluginUndeclaredVariableIsset : 70+ occurrences // PhanPluginEmptyStatementIf : 55+ occurrences - // PhanRedefineFunction : 55+ occurrences + // PhanRedefineFunction : 50+ occurrences // PhanTypeSuspiciousNonTraversableForeach : 50+ occurrences // PhanTypeMismatchDimFetch : 40+ occurrences // PhanTypeExpectedObjectPropAccess : 25+ occurrences @@ -52,9 +52,7 @@ return [ 'htdocs/accountancy/class/accountancyexport.class.php' => ['PhanUndeclaredProperty'], 'htdocs/adherents/canvas/actions_adherentcard_common.class.php' => [/* Traverses Adherent as array, ignore */ 'PhanTypeSuspiciousNonTraversableForeach'], 'htdocs/adherents/list.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/admin/dict.php' => ['PhanRedefineFunction'], 'htdocs/admin/fckeditor.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/admin/mails_templates.php' => ['PhanRedefineFunction'], 'htdocs/api/class/api_access.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredProperty'], 'htdocs/api/class/api_documents.class.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/api/class/api_login.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], @@ -116,7 +114,6 @@ return [ 'htdocs/comm/action/list.php' => ['PhanTypeMismatchProperty'], 'htdocs/comm/action/pertype.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchDimFetch'], 'htdocs/comm/action/peruser.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeComparisonFromArray'], - 'htdocs/comm/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/comm/mailing/cibles.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/comm/mailing/class/advtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'], @@ -132,7 +129,7 @@ return [ 'htdocs/commande/class/api_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/commande/class/commande.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/commande/class/commandestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/commande/customer.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/commande/customer.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/commande/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/commande/list_det.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/commande/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -157,7 +154,7 @@ return [ 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/cashcontrol/class/cashcontrol.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/compta/charges/index.php' => ['PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/deplacement/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/deplacement/class/deplacement.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/compta/deplacement/class/deplacementstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], @@ -217,13 +214,13 @@ return [ 'htdocs/compta/sociales/list.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/compta/sociales/payments.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/stats/byratecountry.php' => ['PhanPluginEmptyStatementIf'], - 'htdocs/compta/stats/cabyprodserv.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/stats/cabyprodserv.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/stats/cabyuser.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/stats/casoc.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/stats/casoc.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/stats/supplier_turnover.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/stats/supplier_turnover_by_prodserv.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/stats/supplier_turnover_by_thirdparty.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/stats/supplier_turnover_by_prodserv.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/compta/stats/supplier_turnover_by_thirdparty.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/tva/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/compta/tva/class/tva.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -267,16 +264,15 @@ return [ 'htdocs/core/boxes/box_actions_future.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/boxes/box_external_rss.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/boxes/box_funnel_of_prospection.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_invoices_permonth.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_invoices_peryear.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_invoices_supplier_permonth.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/boxes/box_graph_invoices_permonth.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/boxes/box_graph_invoices_supplier_permonth.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/boxes/box_graph_nb_tickets_type.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/boxes/box_graph_new_vs_close_ticket.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/boxes/box_graph_orders_permonth.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_orders_supplier_permonth.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_product_distribution.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/boxes/box_graph_propales_permonth.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/boxes/box_graph_orders_permonth.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/boxes/box_graph_orders_supplier_permonth.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/boxes/box_graph_product_distribution.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/boxes/box_graph_propales_permonth.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/boxes/box_graph_ticket_by_severity.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/boxes/box_last_modified_ticket.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/boxes/box_last_ticket.php' => ['PhanPluginUnknownPropertyType'], @@ -720,7 +716,6 @@ return [ 'htdocs/intracommreport/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/intracommreport/class/intracommreport.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/intracommreport/lib/intracommreport.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/intracommreport/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/knowledgemanagement/class/knowledgerecord.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/knowledgemanagement/knowledgerecord_card.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'], @@ -801,13 +796,6 @@ return [ 'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'], 'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray'], - 'htdocs/product/stats/commande.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/stats/commande_fournisseur.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/stats/facture.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/stats/facture_fournisseur.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/stats/facturerec.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/stats/mo.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/stats/propal.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stock/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/product/stock/class/api_stockmovements.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/product/stock/class/api_warehouses.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], @@ -824,10 +812,10 @@ return [ 'htdocs/product/stock/productlot_card.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/productlot_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stock/replenish.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/stock/stats/commande_fournisseur.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/stats/expedition.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/stats/mo.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/stats/reception.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/stats/commande_fournisseur.php' => ['PhanUndeclaredProperty'], + 'htdocs/product/stock/stats/expedition.php' => ['PhanUndeclaredProperty'], + 'htdocs/product/stock/stats/mo.php' => ['PhanUndeclaredProperty'], + 'htdocs/product/stock/stats/reception.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/stockatdate.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stock/stocktransfer/class/stocktransfer.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], 'htdocs/product/stock/stocktransfer/class/stocktransferline.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], @@ -847,7 +835,7 @@ return [ 'htdocs/projet/class/api_tasks.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/projet/class/project.class.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/projet/class/projectstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/projet/class/task.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], + 'htdocs/projet/class/task.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/projet/class/taskstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/projet/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/element.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], @@ -1017,7 +1005,7 @@ return [ 'htdocs/user/bank.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/user/card.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/user/class/api_users.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], - 'htdocs/user/class/user.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/user/class/user.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/user/class/usergroup.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/user/group/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/user/param_ihm.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], @@ -1042,7 +1030,7 @@ return [ 'htdocs/webportal/class/html.formwebportal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchDimFetch'], 'htdocs/webportal/class/webPortalTheme.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/webportal/class/webportalinvoice.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/webportal/class/webportalmember.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/webportal/class/webportalmember.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/webportal/class/webportalorder.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/webportal/class/webportalpropal.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/webportal/lib/webportal.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 3fa105b56fe..a31c09375b0 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1775,7 +1775,7 @@ if ($id > 0) { } if (empty($reshook)) { - fieldList($fieldlist, $obj, $tabname[$id], 'add'); + dictFieldList($fieldlist, $obj, $tabname[$id], 'add'); } if ($id == DICT_COUNTRY) { @@ -2280,7 +2280,7 @@ if ($id > 0) { // Show fields if (empty($reshook)) { - $withentity = fieldList($fieldlist, $obj, $tabname[$id], 'edit'); + $withentity = dictFieldList($fieldlist, $obj, $tabname[$id], 'edit'); } print '