Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix phpstan 🎅 🎄 #32466

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions build/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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\<string, mixed\>\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -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\<string, string\>, array\<string, int\|string\> given\.$#'
identifier: argument.type
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions htdocs/compta/facture/class/facture-rec.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -975,14 +975,14 @@ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocalt
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;
}
Expand Down Expand Up @@ -1183,8 +1183,8 @@ public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0
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;
}
Expand Down
26 changes: 13 additions & 13 deletions htdocs/compta/facture/class/facture.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3946,16 +3946,16 @@ public function addline(
}

$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;
Expand Down Expand Up @@ -4208,15 +4208,15 @@ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_star
}

$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) {
Expand Down
Loading