diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 5a23163c6d9..a3ec7716200 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -5592,12 +5592,6 @@ parameters: count: 3 path: ../../htdocs/compta/facture/class/facture-rec.class.php - - - message: '#^Parameter \#1 \$qty of function calcul_price_total expects float, string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/compta/facture/class/facture-rec.class.php - - message: '#^Parameter \#1 \$vatrate of function getLocalTaxesFromRate expects int\|string, float given\.$#' identifier: argument.type @@ -5610,12 +5604,6 @@ parameters: count: 1 path: ../../htdocs/compta/facture/class/facture-rec.class.php - - - message: '#^Parameter \#2 \$pu of function calcul_price_total expects float, string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/compta/facture/class/facture-rec.class.php - - message: '#^Property CommonObject\:\:\$array_options \(array\\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -5670,12 +5658,6 @@ parameters: count: 3 path: ../../htdocs/compta/facture/class/facture.class.php - - - message: '#^Parameter \#1 \$qty of function calcul_price_total expects float, string given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/compta/facture/class/facture.class.php - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' identifier: argument.type @@ -5688,42 +5670,18 @@ parameters: count: 2 path: ../../htdocs/compta/facture/class/facture.class.php - - - message: '#^Parameter \#15 \$pu_devise of function calcul_price_total expects float, string given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/compta/facture/class/facture.class.php - - message: '#^Parameter \#2 \$alreadypaid of method CommonInvoice\:\:getLibStatut\(\) expects int, float given\.$#' identifier: argument.type count: 1 path: ../../htdocs/compta/facture/class/facture.class.php - - - message: '#^Parameter \#2 \$pu of function calcul_price_total expects float, string given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/compta/facture/class/facture.class.php - - message: '#^Parameter \#4 \$txtva of method Facture\:\:addline\(\) expects float, string given\.$#' identifier: argument.type count: 1 path: ../../htdocs/compta/facture/class/facture.class.php - - - message: '#^Parameter \#5 \$uselocaltax1_rate of function calcul_price_total expects float, string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/compta/facture/class/facture.class.php - - - - message: '#^Parameter \#6 \$uselocaltax2_rate of function calcul_price_total expects float, string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/compta/facture/class/facture.class.php - - message: '#^Property CommonInvoice\:\:\$close_code \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 056d34018fc..f011ecc05ab 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -975,14 +975,14 @@ class FactureRec extends CommonInvoice if (empty($remise_percent)) { $remise_percent = 0; } - $qty = price2num($qty); - $pu_ht = price2num($pu_ht); - $pu_ttc = price2num($pu_ttc); + $qty = (float) price2num($qty); + $pu_ht = (float) price2num($pu_ht); + $pu_ttc = (float) price2num($pu_ttc); if (!preg_match('/\((.*)\)/', $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } - $txlocaltax1 = price2num($txlocaltax1); - $txlocaltax2 = price2num($txlocaltax2); + $txlocaltax1 = (float) price2num($txlocaltax1); + $txlocaltax2 = (float) price2num($txlocaltax2); if (empty($txtva)) { $txtva = 0; } @@ -1183,8 +1183,8 @@ class FactureRec extends CommonInvoice if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } - $txlocaltax1 = price2num($txlocaltax1); - $txlocaltax2 = price2num($txlocaltax2); + $txlocaltax1 = (float) price2num($txlocaltax1); + $txlocaltax2 = (float) price2num($txlocaltax2); if (empty($txlocaltax1)) { $txlocaltax1 = 0; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3ccd5441aa1..0d1435fa918 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3946,16 +3946,16 @@ class Facture extends CommonInvoice } $remise_percent = (float) price2num($remise_percent); - $qty = price2num($qty); - $pu_ht = price2num($pu_ht); - $pu_ht_devise = price2num($pu_ht_devise); - $pu_ttc = price2num($pu_ttc); - $pa_ht = price2num($pa_ht); + $qty = (float) price2num($qty); + $pu_ht = (float) price2num($pu_ht); + $pu_ht_devise = (float) price2num($pu_ht_devise); + $pu_ttc = (float) price2num($pu_ttc); + $pa_ht = (float) price2num($pa_ht); if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } - $txlocaltax1 = price2num($txlocaltax1); - $txlocaltax2 = price2num($txlocaltax2); + $txlocaltax1 = (float) price2num($txlocaltax1); + $txlocaltax2 = (float) price2num($txlocaltax2); if ($price_base_type == 'HT') { $pu = $pu_ht; @@ -4208,15 +4208,15 @@ class Facture extends CommonInvoice } $remise_percent = (float) price2num($remise_percent); - $qty = price2num($qty); - $pu = price2num($pu); - $pu_ht_devise = price2num($pu_ht_devise); - $pa_ht = price2num($pa_ht); + $qty = (float) price2num($qty); + $pu = (float) price2num($pu); + $pu_ht_devise = (float) price2num($pu_ht_devise); + $pa_ht = (float) price2num($pa_ht); if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } - $txlocaltax1 = (float) price2num($txlocaltax1); - $txlocaltax2 = (float) price2num($txlocaltax2); + $txlocaltax1 = (float) price2num($txlocaltax1); + $txlocaltax2 = (float) price2num($txlocaltax2); // Check parameters if ($type < 0) {