From f29e9e760f44a077b86ad1c741a448ce9b6c5c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 6 Sep 2024 14:02:53 +0200 Subject: [PATCH] fix phpstan (#30861) * fix phpstan * fix phpstan * fix phpstan * fix phpstan --- htdocs/comm/mailing/cibles.php | 3 ++- htdocs/compta/facture/card.php | 2 +- htdocs/compta/resultat/clientfourn.php | 2 +- htdocs/compta/resultat/index.php | 2 +- htdocs/compta/resultat/result.php | 4 ++-- htdocs/compta/stats/byratecountry.php | 4 ++-- htdocs/compta/stats/cabyprodserv.php | 2 +- htdocs/compta/stats/cabyuser.php | 4 ++-- htdocs/compta/stats/casoc.php | 4 ++-- htdocs/compta/stats/index.php | 6 +++--- htdocs/compta/stats/supplier_turnover.php | 5 +++-- htdocs/compta/stats/supplier_turnover_by_prodserv.php | 5 +++-- htdocs/compta/stats/supplier_turnover_by_thirdparty.php | 5 +++-- htdocs/core/customreports.php | 2 +- htdocs/exports/export.php | 3 ++- htdocs/fourn/facture/card.php | 2 +- htdocs/imports/import.php | 2 +- htdocs/main.inc.php | 2 +- htdocs/modulebuilder/index.php | 2 +- htdocs/public/recruitment/index.php | 5 +++-- htdocs/public/recruitment/view.php | 5 +++-- phpstan.neon.dist | 1 - 22 files changed, 39 insertions(+), 33 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index b6629f3b87c..5065e4b8571 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * 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 @@ -649,7 +650,7 @@ if ($object->fetch($id) >= 0) { print '
'; if ($sqlmessage && $user->admin) { - print info_admin($langs->trans("SQLUsedForExport").':
'.$sqlmessage, 0, 0, 1, '', 'TechnicalInformation'); + print info_admin($langs->trans("SQLUsedForExport").':
'.$sqlmessage, 0, 0, '1', '', 'TechnicalInformation'); print '
'; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 7783192177f..1cf65892bb5 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3368,7 +3368,7 @@ if ($action == 'create') { if (!getDolGlobalString('INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE')) { $text .= ' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')); } - print info_admin($text, 0, 0, 0, 'opacitymedium').'
'; + print info_admin($text, 0, 0, '0', 'opacitymedium').'
'; } print '
'; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 54efdad7705..b67ea15e6ec 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -232,7 +232,7 @@ $calcmode .= ''; report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'showaccountdetail'=>$showaccountdetail), $calcmode); if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { - print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1'); } // Show report array diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 2f89d7106cc..b2aa25b3fa3 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -205,7 +205,7 @@ $calcmode .= ''; report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode); if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { - print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1'); } diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index a5d4ef0ddec..82df54e259e 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016-2017 Jamal Elbaz * Copyright (C) 2016-2022 Alexandre Spangaro * Copyright (C) 2018-2020 Laurent Destailleur - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -247,7 +247,7 @@ report_header($name, '', $period, $periodlink ?? '', $description, $builddate, $ if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { - print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1'); } diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 8269058cf69..a0ed00d518a 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -289,7 +289,7 @@ $description .= ' trans("WarningReportNotReliable"), 0, 0, '1'); } diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 4401b262a9f..b3f5cf5efa2 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -285,7 +285,7 @@ if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) { report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode); if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { - print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1'); } diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index ab2220a8e77..01fa7c1010c 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Antoine Iauch - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -233,7 +233,7 @@ if (!empty($modecompta)) { report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode); if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { - print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1'); } diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 0b935ba2664..4d677fed1bb 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -5,7 +5,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2013 Antoine Iauch * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024 MDW * @@ -262,7 +262,7 @@ if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) { report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode); if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { - print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1'); } diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 19bc7b6110f..eb4e01da929 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2017 Olivier Geffroy - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 Benjamin B. * Copyright (C) 2024 MDW * @@ -212,7 +212,7 @@ report_header($name, $namelink, $period, $periodlink, $description, $builddate, if (isModEnabled('accounting')) { if ($modecompta != 'BOOKKEEPING') { - print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1'); } else { // Test if there is at least one line in bookkeeping $pcgverid = getDolGlobalInt('CHARTOFACCOUNTS'); @@ -234,7 +234,7 @@ if (isModEnabled('accounting')) { $nb = $db->num_rows($resql); if ($nb == 0) { $langs->load("errors"); - print info_admin($langs->trans("WarningNoDataTransferedInAccountancyYet"), 0, 0, 1); + print info_admin($langs->trans("WarningNoDataTransferedInAccountancyYet"), 0, 0, '1'); } } } diff --git a/htdocs/compta/stats/supplier_turnover.php b/htdocs/compta/stats/supplier_turnover.php index a4839a74cbb..b0c2fe0a483 100644 --- a/htdocs/compta/stats/supplier_turnover.php +++ b/htdocs/compta/stats/supplier_turnover.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * 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 @@ -205,7 +206,7 @@ report_header($name, $namelink, $period, $periodlink, $description, $builddate, if (isModEnabled('accounting')) { if ($modecompta != 'BOOKKEEPING') { - print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1'); } else { // Test if there is at least one line in bookkeeping $pcgverid = getDolGlobalInt('CHARTOFACCOUNTS'); @@ -227,7 +228,7 @@ if (isModEnabled('accounting')) { $nb = $db->num_rows($resql); if ($nb == 0) { $langs->load("errors"); - print info_admin($langs->trans("WarningNoDataTransferedInAccountancyYet"), 0, 0, 1); + print info_admin($langs->trans("WarningNoDataTransferedInAccountancyYet"), 0, 0, '1'); } } } diff --git a/htdocs/compta/stats/supplier_turnover_by_prodserv.php b/htdocs/compta/stats/supplier_turnover_by_prodserv.php index 844258bd492..d27cc167776 100644 --- a/htdocs/compta/stats/supplier_turnover_by_prodserv.php +++ b/htdocs/compta/stats/supplier_turnover_by_prodserv.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * 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 @@ -260,7 +261,7 @@ report_header($name, '', $period, $periodlink, $description, $builddate, $export if (isModEnabled('accounting')) { if ($modecompta != 'BOOKKEEPING') { - print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1'); } else { // Test if there is at least one line in bookkeeping $pcgverid = getDolGlobalInt('CHARTOFACCOUNTS'); @@ -282,7 +283,7 @@ if (isModEnabled('accounting')) { $nb = $db->num_rows($resql); if ($nb == 0) { $langs->load("errors"); - print info_admin($langs->trans("WarningNoDataTransferedInAccountancyYet"), 0, 0, 1); + print info_admin($langs->trans("WarningNoDataTransferedInAccountancyYet"), 0, 0, '1'); } } } diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index 67429cff39a..814446e8260 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -2,6 +2,7 @@ /* Copyright (C) 2020 Maxime Kohlhaas * Copyright (C) 2023 Ferran Marcet * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * 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 @@ -240,7 +241,7 @@ report_header($name, '', $period, $periodlink, $description, $builddate, $export if (isModEnabled('accounting')) { if ($modecompta != 'BOOKKEEPING') { - print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1'); } else { // Test if there is at least one line in bookkeeping $pcgverid = getDolGlobalInt('CHARTOFACCOUNTS'); @@ -262,7 +263,7 @@ if (isModEnabled('accounting')) { $nb = $db->num_rows($resql); if ($nb == 0) { $langs->load("errors"); - print info_admin($langs->trans("WarningNoDataTransferedInAccountancyYet"), 0, 0, 1); + print info_admin($langs->trans("WarningNoDataTransferedInAccountancyYet"), 0, 0, '1'); } } } diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 41cf88a005c..d1c87ba09c2 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -1150,7 +1150,7 @@ if ($mode == 'graph') { if ($sql && !defined('MAIN_CUSTOM_REPORT_KEEP_GRAPH_ONLY')) { // Show admin info - print '
'.info_admin($langs->trans("SQLUsedForExport").':
'.$sql, 0, 0, 1, '', 'TechnicalInformation'); + print '
'.info_admin($langs->trans("SQLUsedForExport").':
'.$sql, 0, 0, '1', '', 'TechnicalInformation'); } print '
'; diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 4291ae72ba8..94c65432e83 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -4,6 +4,7 @@ * Copyright (C) 2012 Marcos García * Copyright (C) 2012 Charles-Fr BENKE * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2024 Frédéric France * * 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 @@ -1277,7 +1278,7 @@ if ($step == 5 && $datatoexport) { if ($sqlusedforexport && $user->admin) { - print info_admin($langs->trans("SQLUsedForExport").':
'.$sqlusedforexport, 0, 0, 1, '', 'TechnicalInformation'); + print info_admin($langs->trans("SQLUsedForExport").':
'.$sqlusedforexport, 0, 0, '1', '', 'TechnicalInformation'); } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 90ff11b602a..afe418a6c60 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2261,7 +2261,7 @@ if ($action == 'create') { if (!getDolGlobalString('INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE')) { $text .= ' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')); } - print info_admin($text, 0, 0, 0, 'opacitymedium').'
'; + print info_admin($text, 0, 0, '0', 'opacitymedium').'
'; } print ''; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 134381c7fde..7eeca16cf0e 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -579,7 +579,7 @@ if ($step == 3 && $datatoimport) { if ($format == 'xlsx' && !class_exists('XMLWriter')) { $langs->load("install"); - print info_admin($langs->trans("ErrorPHPDoesNotSupport", 'php-xml'), 0, 0, 1, 'error'); + print info_admin($langs->trans("ErrorPHPDoesNotSupport", 'php-xml'), 0, 0, '1', 'error'); } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1351dcea95e..709390a9532 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -3584,7 +3584,7 @@ function main_area($title = '') print $hookmanager->resPrint; if (getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')) { - print info_admin($langs->trans("WarningYouAreInMaintenanceMode", getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')), 0, 0, 1, 'warning maintenancemode'); + print info_admin($langs->trans("WarningYouAreInMaintenanceMode", getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')), 0, 0, '1', 'warning maintenancemode'); } // Permit to add user company information on each printed document by setting SHOW_SOCINFO_ON_PRINT diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 8db1cf2fe0e..cc77c47cbd7 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -3218,7 +3218,7 @@ if (empty($allowonlineinstall)) { $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs')); } else { // Show technical message - $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock'), 0, 0, 1, 'warning'); + $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock'), 0, 0, '1', 'warning'); } print $message; diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php index 586d3d8f872..af86d85034b 100644 --- a/htdocs/public/recruitment/index.php +++ b/htdocs/public/recruitment/index.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * 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 @@ -259,10 +260,10 @@ if (is_array($results)) { print '
'; if ($object->status == RecruitmentJobPosition::STATUS_RECRUITED) { - print info_admin($langs->trans("JobClosedTextCandidateFound"), 0, 0, 0, 'warning'); + print info_admin($langs->trans("JobClosedTextCandidateFound"), 0, 0, '0', 'warning'); } if ($object->status == RecruitmentJobPosition::STATUS_CANCELED) { - print info_admin($langs->trans("JobClosedTextCanceled"), 0, 0, 0, 'warning'); + print info_admin($langs->trans("JobClosedTextCanceled"), 0, 0, '0', 'warning'); } print '
'; diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 4294223915c..c3c205c2685 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * 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 @@ -311,10 +312,10 @@ print ''; print '
'; if ($object->status == RecruitmentJobPosition::STATUS_RECRUITED) { - print info_admin($langs->trans("JobClosedTextCandidateFound"), 0, 0, 0, 'warning'); + print info_admin($langs->trans("JobClosedTextCandidateFound"), 0, 0, '0', 'warning'); } if ($object->status == RecruitmentJobPosition::STATUS_CANCELED) { - print info_admin($langs->trans("JobClosedTextCanceled"), 0, 0, 0, 'warning'); + print info_admin($langs->trans("JobClosedTextCanceled"), 0, 0, '0', 'warning'); } print '
'; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 76671de572f..c616dae0adb 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -80,7 +80,6 @@ parameters: - '#on array{url: mixed} in empty\(\) does not exist.#' - '#dolCopyDir expects string, int given#' - '#dol_copy expects string, int given#' - - '#info_admin expects string, int given#' - '#dol_getIdFromCode expects string, int given#' - '#dol_strlen expects string, int given#' - '#dol_get_fiche_head expects string, int given#'