From 7a5eabb249d3a97980fd94e30f90430bc2d727c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 6 Nov 2024 17:35:39 +0100 Subject: [PATCH] add phpdoc and clean phpstan baseline --- build/phpstan/phpstan-baseline.neon | 15 --------------- htdocs/admin/limits.php | 10 +++++----- htdocs/imports/import.php | 5 +++-- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 29b6e38cf1431..92e8952a6a91c 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -1315,11 +1315,6 @@ parameters: count: 2 path: ../../htdocs/admin/limits.php - - - message: "#^Parameter \\#2 \\$pu of function calcul_price_total expects float, string given\\.$#" - count: 3 - path: ../../htdocs/admin/limits.php - - message: "#^Variable \\$aCurrencies in empty\\(\\) always exists and is not falsy\\.$#" count: 2 @@ -19530,11 +19525,6 @@ parameters: count: 1 path: ../../htdocs/imports/import.php - - - message: "#^Variable \\$relativepath might not be defined\\.$#" - count: 1 - path: ../../htdocs/imports/import.php - - message: "#^If condition is always true\\.$#" count: 1 @@ -27755,11 +27745,6 @@ parameters: count: 1 path: ../../htdocs/societe/price.php - - - message: "#^Variable \\$arrayofmassactions might not be defined\\.$#" - count: 1 - path: ../../htdocs/societe/project.php - - message: "#^Variable \\$parameters might not be defined\\.$#" count: 1 diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 142e52faec929..a3e9b993621da 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -303,7 +303,7 @@ $localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc); $s = 10 / 3; - $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); + $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print ' x '.$langs->trans("Quantity").": ".$qty; print ' - '.$langs->trans("VAT").': '.$vat.'%'; @@ -314,13 +314,13 @@ } if (getDolGlobalString('MAIN_ADD_MORE_EXAMPLE_IN_ACCURANCY_SETUP')) { - $qty = '1.234'; + $qty = 1.234; $vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : ''); $localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc); $s = 10 / 3; - $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); + $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print ' x '.$langs->trans("Quantity").": ".$qty; print ' - '.$langs->trans("VAT").': '.$vat.'%'; @@ -340,7 +340,7 @@ $s = 10 / 3; $qty = 1; $vat = 10; - $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); + $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print ' x '.$langs->trans("Quantity").": ".$qty; print ' - '.$langs->trans("VAT").": ".$vat.'%'; @@ -349,7 +349,7 @@ $s = 10 / 3; $qty = 2; $vat = 10; - $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); + $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print ' x '.$langs->trans("Quantity").": ".$qty; print ' - '.$langs->trans("VAT").": ".$vat.'%'; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 8d536e8514703..845978f19f246 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -148,15 +148,16 @@ $confirm = GETPOST('confirm', 'alpha'); $step = (GETPOST('step') ? GETPOST('step') : 1); $import_name = GETPOST('import_name'); -$hexa = GETPOST('hexa'); +$hexa = GETPOST('hexa'); $importmodelid = GETPOSTINT('importmodelid'); $excludefirstline = (GETPOST('excludefirstline') ? GETPOST('excludefirstline') : 2); -$endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : ''); +$endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : ''); $updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array()); $separator = (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml', 3) : ''); $enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"'); // We must use 'nohtml' and not 'alphanohtml' because we must accept " $charset = GETPOST('charset', 'aZ09'); $separator_used = str_replace('\t', "\t", $separator); +$relativepath = ''; $objimport = new Import($db); $objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport));