Fix arg type to preg_replace(),preg_match(),trim() with cast + phpdoc

This commit is contained in:
MDW
2024-03-19 15:40:45 +01:00
parent 05fbb7257c
commit 4d4d3ba175

View File

@@ -1488,7 +1488,7 @@ class Contrat extends CommonObject
*
* @param string $desc Description of line
* @param float $pu_ht Unit price net
* @param int $qty Quantity
* @param float $qty Quantity
* @param float $txtva Vat rate
* @param float $txlocaltax1 Local tax 1 rate
* @param float $txlocaltax2 Local tax 2 rate
@@ -1528,9 +1528,9 @@ class Contrat extends CommonObject
// Clean vat code
$reg = array();
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $txtva, $reg)) {
if (preg_match('/\((.*)\)/', (string) $txtva, $reg)) {
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
$txtva = preg_replace('/\s*\(.*\)/', '', (string) $txtva); // Remove code into vatrate.
}
$txtva = price2num($txtva);
$txlocaltax1 = price2num($txlocaltax1);
@@ -1721,7 +1721,7 @@ class Contrat extends CommonObject
* @param int $rowid Id de la ligne de facture
* @param string $desc Description de la ligne
* @param float $pu Prix unitaire
* @param int $qty Quantite
* @param float $qty Quantite
* @param float $remise_percent Percentage discount of the line
* @param int $date_start Date de debut prevue
* @param int $date_end Date de fin prevue
@@ -1746,7 +1746,7 @@ class Contrat extends CommonObject
$error = 0;
// Clean parameters
$qty = trim($qty);
$qty = trim((string) $qty);
$desc = trim($desc);
$desc = trim($desc);
$price = price2num($pu);
@@ -3476,8 +3476,8 @@ class ContratLigne extends CommonObjectLine
$this->tva_tx = trim((string) $this->tva_tx);
$this->localtax1_tx = trim($this->localtax1_tx);
$this->localtax2_tx = trim($this->localtax2_tx);
$this->qty = trim($this->qty);
$this->remise_percent = trim($this->remise_percent);
$this->qty = trim((string) $this->qty);
$this->remise_percent = trim((string) $this->remise_percent);
$this->fk_remise_except = (int) $this->fk_remise_except;
$this->subprice = price2num($this->subprice);
$this->price_ht = price2num($this->price_ht);