2
0
forked from Wavyzz/dolibarr

Qual: Fix phan/phpstan notices (#31297)

# Qual: Fix phan/phpstan notices

Fix several phan and phpstan notices.
This commit is contained in:
MDW
2024-10-07 14:07:24 +02:00
committed by GitHub
parent 9b378d74af
commit f4c91d5bb6
34 changed files with 418 additions and 124 deletions

View File

@@ -74,34 +74,93 @@ class Reception extends CommonObject
*/
public $picto = 'dollyrevert';
/**
* @var int
*/
public $socid;
/**
* @var string
*/
public $ref_supplier;
/**
* @var int
*/
public $entrepot_id;
/**
* @var string
*/
public $tracking_number;
/**
* @var string
*/
public $tracking_url;
/**
* @var int<0,1>
*/
public $billed;
/**
* @var string
*/
public $model_pdf;
/**
* @var int|float
*/
public $weight;
/**
* @var int|float
*/
public $trueWeight;
/**
* @var null|float|int
*/
public $weight_units;
/**
* @var int|float
*/
public $trueWidth;
/**
* @var int
*/
public $width_units;
/**
* @var int|float
*/
public $trueHeight;
/**
* @var int
*/
public $height_units;
/**
* @var int|float
*/
public $trueDepth;
/**
* @var int
*/
public $depth_units;
// A denormalized value
/**
* @var string A denormalized value
*/
public $trueSize;
/**
* @var int|string
*/
public $size_units;
/**
* @var int
*/
public $user_author_id;
public $date_delivery; // Date delivery planned
/**
* @var int|string Planned date of delivery
*/
public $date_delivery;
/**
* @var int|string Effective delivery date
* @deprecated
* @deprecated Use $date_reception
* @see $date_reception
*/
public $date;
@@ -116,7 +175,13 @@ class Reception extends CommonObject
*/
public $date_valid;
/**
* @var array<int,string>
*/
public $meths;
/**
* @var array<array{rowid:int,code:string,libelle:string,description:string,tracking:string,active:string}>
*/
public $listmeths; // List of carriers
/**
@@ -125,8 +190,10 @@ class Reception extends CommonObject
public $lines = array();
// detail of lot and qty = array(id in receptiondet_batch, batch, qty)
// We can use this to know warehouse planned to be used for each lot.
/**
* @var stdClass[] detail of lot and qty = array(id in receptiondet_batch, batch, qty)
* // We can use this to know warehouse planned to be used for each lot.
*/
public $detail_batch;
const STATUS_DRAFT = 0;
@@ -134,7 +201,6 @@ class Reception extends CommonObject
const STATUS_CLOSED = 2;
/**
* Constructor
*
@@ -180,8 +246,8 @@ class Reception extends CommonObject
}
$obj = new $classname();
'@phan-var-force ModelNumRefReception $obj';
$numref = "";
$numref = $obj->getNextValue($soc, $this);
if ($numref != "") {
@@ -810,12 +876,12 @@ class Reception extends CommonObject
* @param int $entrepot_id Id of warehouse
* @param int $id Id of source line (supplier order line)
* @param float $qty Quantity
* @param array $array_options extrafields array
* @param array<string, mixed> $array_options extrafields array
* @param string $comment Comment for stock movement
* @param int $eatby eat-by date
* @param int $sellby sell-by date
* @param string $batch Lot number
* @param double $cost_price Line cost
* @param float $cost_price Line cost
* @return int Return integer <0 if KO, index of line if OK
*/
public function addline($entrepot_id, $id, $qty, $array_options = [], $comment = '', $eatby = null, $sellby = null, $batch = '', $cost_price = 0)
@@ -925,7 +991,7 @@ class Reception extends CommonObject
$this->ref_supplier = trim($this->ref_supplier);
}
if (isset($this->socid)) {
$this->socid = trim($this->socid);
$this->socid = (int) trim((string) $this->socid);
}
if (isset($this->fk_user_author)) {
$this->fk_user_author = (int) $this->fk_user_author;
@@ -943,22 +1009,22 @@ class Reception extends CommonObject
$this->statut = (int) $this->statut;
}
if (isset($this->trueDepth)) {
$this->trueDepth = trim($this->trueDepth);
$this->trueDepth = (float) trim((string) $this->trueDepth);
}
if (isset($this->trueWidth)) {
$this->trueWidth = trim($this->trueWidth);
$this->trueWidth = (float) trim((string) $this->trueWidth);
}
if (isset($this->trueHeight)) {
$this->trueHeight = trim($this->trueHeight);
$this->trueHeight = (float) trim((string) $this->trueHeight);
}
if (isset($this->size_units)) {
$this->size_units = trim((string) $this->size_units);
}
if (isset($this->weight_units)) {
$this->weight_units = trim((string) $this->weight_units);
$this->weight_units = (float) trim((string) $this->weight_units);
}
if (isset($this->trueWeight)) {
$this->weight = trim((string) $this->trueWeight);
$this->weight = (float) trim((string) $this->trueWeight);
}
if (isset($this->note_private)) {
$this->note_private = trim($this->note_private);
@@ -1115,12 +1181,14 @@ class Reception extends CommonObject
if (!empty($this->origin) && $this->origin_id > 0) {
$this->fetch_origin();
if ($this->origin_object->statut == 4) { // If order source of reception is "partially received"
$origin_object = $this->origin_object;
'@phan-var-force CommandeFournisseur $origin_object';
if ($origin_object->statut == 4) { // If order source of reception is "partially received"
// Check if there is no more reception. If not, we can move back status of order to "validated" instead of "reception in progress"
$this->origin_object->loadReceptions();
$origin_object->loadReceptions();
//var_dump($this->$origin->receptions);exit;
if (count($this->origin_object->receptions) <= 0) {
$this->origin_object->setStatut(3); // ordered
if (count($origin_object->receptions) <= 0) {
$origin_object->setStatut(3); // ordered
}
}
}