From f99beb902304a32996f8427fac0d6bf04606be99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 6 Jul 2024 14:30:13 +0200 Subject: [PATCH] fix expects int (#30304) --- htdocs/adherents/agenda.php | 3 ++- htdocs/admin/external_rss.php | 3 ++- htdocs/admin/stock.php | 2 +- htdocs/compta/bank/bankentries_list.php | 10 ++++++---- htdocs/core/lib/admin.lib.php | 3 ++- htdocs/mrp/mo_production.php | 2 +- htdocs/ticket/card.php | 4 ++-- phpstan.neon.dist | 17 ++++++++++++++++- 8 files changed, 32 insertions(+), 12 deletions(-) diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 286a66ea493..3875569448f 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -5,6 +5,7 @@ * Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 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 @@ -190,7 +191,7 @@ if ($object->id > 0) { $param .= '&limit='.$limit; } - print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 0); + print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 0); // List of all actions $filters = array(); diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 9c17713bbf5..8f9228b97c8 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -8,6 +8,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2020 Tobias Sekan * 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 @@ -320,7 +321,7 @@ if ($resql) { } // Active - $active = _isInBoxList($idrss, $boxlist) ? 'yes' : 'no'; + $active = _isInBoxList((int) $idrss, $boxlist) ? 'yes' : 'no'; print ''; print ''.$langs->trans('WidgetAvailable').''; print ''.yn($active); diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 2524fe7b4a8..ed5e508cbd1 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -494,7 +494,7 @@ if ($virtualdiffersfromphysical) { print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; - print "\n"; + print "\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 620ecbae808..d5a617b95f6 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -659,21 +659,23 @@ if ($search_thirdparty_user) { $sql .= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu"; $sql .= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank"; $sql .= " JOIN ".MAIN_DB_PREFIX."user AS subUser ON (bu.type = 'user' AND bu.url_id = subUser.rowid)"; - $sql .= " WHERE ". natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, '', 1).")"; + $sql .= " WHERE ". natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, 0, 1).")"; $sql .= " OR b.rowid IN "; $sql .= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu"; $sql .= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe AS subSoc ON (bu.type = 'company' AND bu.url_id = subSoc.rowid)"; - $sql .= " WHERE ". natural_search(array("subSoc.nom"), $search_thirdparty_user, '', 1); + $sql .= " WHERE ". natural_search(array("subSoc.nom"), $search_thirdparty_user, 0, 1); $sql .= "))"; } if ($search_description) { $search_description_to_use = $search_description; $arrayoffixedlabels = array( 'payment_salary', - 'CustomerInvoicePayment', 'CustomerInvoicePaymentBack', - 'SupplierInvoicePayment', 'SupplierInvoicePaymentBack', + 'CustomerInvoicePayment', + 'CustomerInvoicePaymentBack', + 'SupplierInvoicePayment', + 'SupplierInvoicePaymentBack', 'DonationPayment', 'ExpenseReportPayment', 'SocialContributionPayment', diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 3e52db42821..c085cfa09ad 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2023 Eric Seigne * 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 @@ -1066,7 +1067,7 @@ function listOfSessions() /** * Purge existing sessions * - * @param int $mysessionid To avoid to try to delete my own session + * @param string $mysessionid To avoid to try to delete my own session * @return int >0 if OK, <0 if KO */ function purgeSessions($mysessionid) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 5773f72354a..c7e2f268081 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -999,7 +999,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $reg = []; $qtyhourservice = 0; if (preg_match('/^(\d+)([a-z]+)$/', $tmpproduct->duration, $reg)) { - $qtyhourservice = convertDurationtoHour($reg[1], $reg[2]); + $qtyhourservice = convertDurationtoHour($reg[1], (string) $reg[2]); } $qtyhourforline = 0; if ($line->fk_unit) { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 85e83794115..719c24c8a49 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2018 Laurent Destailleur - * Copyright (C) 2021-2024 Frédéric France + * Copyright (C) 2021-2024 Frédéric France * Copyright (C) 2021 Alexandre Spangaro * Copyright (C) 2022-2023 Charlene Benke * Copyright (C) 2023 Benjamin Falière @@ -1060,7 +1060,7 @@ if ($action == 'create' || $action == 'presend') { print '
".$langs->trans("RuleForStockReplenishment")." ".img_help('help', $langs->trans("VirtualDiffersFromPhysical"))."".$langs->trans("RuleForStockReplenishment")." ".img_help(1, $langs->trans("VirtualDiffersFromPhysical"))."'.$langs->trans("Status").'
'; print $langs->trans("AssignedTo"); if (isset($object->status) && $object->status < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->hasRight('ticket', 'manage')) { - print ''.img_edit($langs->trans('Modify'), '').''; + print ''.img_edit($langs->trans('Modify')).''; } print '
'; print ''; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 8b2ec7364b7..cef82d0379d 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -69,7 +69,22 @@ parameters: - '#expects int\|#' - '#expects int<-2, 2>, bool given.#' - '#expects int<0, 1>#' - - '#expects int, string#' + - '#print.* expects int, string#' + - '#tax_by.* expects int, string#' + - '#load.* expects int, string#' + - '#ajax.* expects int, string#' + - '#measu.* expects int, string#' + - '#color.* expects int, string#' + - '#imap.* expects int, string#' + - '#show.* expects int, string#' + - '#pdf.* expects int, string#' + - '#dol.* expects int, string#' + - '#get.* expects int, string#' + - '#send.* expects int, string#' + - '#convert.* expects int, string#' + - '#constructor expects int, string#' + - '#\(\) expects int, string#' + - '#run_sql expects int, string#' - '#expects int, float#' - '#expects int, null#' - '#expects int, bool given.#'