From ad141c1e1f59eb4eed72e168d2ccbce00a5f9d15 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Thu, 8 Feb 2024 00:15:16 +0100 Subject: [PATCH] qual: phpstan for htdocs/core/class/cunits.class.php (#28064) htdocs/core/class/cunits.class.php 88 Property CommonDict::$active (int) does not accept string. htdocs/core/class/cunits.class.php 415 Method CUnits::getUnitFromCode() should return int but returns string. --- htdocs/core/class/cunits.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 66fcf730b11..0c620cb8bd3 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -85,7 +85,7 @@ class CUnits extends CommonDict $this->libelle = trim($this->short_label); } if (isset($this->unit_type)) { - $this->active = trim($this->unit_type); + $this->unit_type = trim($this->unit_type); } if (isset($this->active)) { $this->active = trim($this->active); @@ -402,7 +402,7 @@ class CUnits extends CommonDict * @param string $code code of unit * @param string $mode 0= id , short_label=Use short label as value, code=use code * @param string $unit_type weight,size,surface,volume,qty,time... - * @return int Return integer <0 if KO, Id of code if OK + * @return int|string Return integer <0 if KO, Id of code if OK (or $code if $mode is different from '', 'short_label' or 'code') */ public function getUnitFromCode($code, $mode = 'code', $unit_type = '') {