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.
This commit is contained in:
thibdrev 2024-02-08 00:15:16 +01:00 committed by Laurent Destailleur
parent 1322c20f91
commit ad141c1e1f

View File

@ -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 = '')
{