Browse Source

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.
thibdrev 1 năm trước cách đây
mục cha
commit
ad141c1e1f
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      htdocs/core/class/cunits.class.php

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