From c4521efa57db526986f80197afda81c568a86db8 Mon Sep 17 00:00:00 2001 From: FLIO Date: Mon, 23 Jan 2023 16:31:14 +0100 Subject: [PATCH 1/2] fix(qodana) fix function comment bad return --- htdocs/fichinter/class/api_interventions.class.php | 4 ++-- htdocs/fourn/class/fournisseur.product.class.php | 4 ++-- htdocs/product/class/product.class.php | 4 ++-- .../class/price_global_variable_updater.class.php | 4 ++-- htdocs/product/stock/class/entrepot.class.php | 4 ++-- htdocs/reception/class/api_receptions.class.php | 4 ++-- htdocs/societe/class/api_thirdparties.class.php | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index f96dc3d6aa7..6cd6595432d 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -341,7 +341,7 @@ class Interventions extends DolibarrApi * * @url POST {id}/validate * - * @return array + * @return Object */ public function validate($id, $notrigger = 0) { @@ -377,7 +377,7 @@ class Interventions extends DolibarrApi * * @url POST {id}/close * - * @return array + * @return Object */ public function closeFichinter($id) { diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index fa1706a523a..1d764cee490 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -673,7 +673,7 @@ class ProductFournisseur extends Product * @param int $limit Limit * @param int $offset Offset * @param int $socid Filter on a third party id - * @return array Array of ProductFournisseur with new properties to define supplier price + * @return array|int Array of ProductFournisseur with new properties to define supplier price */ public function list_product_fournisseur_price($prodid, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0, $socid = 0) { @@ -1042,7 +1042,7 @@ class ProductFournisseur extends Product * @param string $sortorder Sort order * @param int $limit Limit * @param int $offset Offset - * @return array Array of Log prices + * @return array|int Array of Log prices */ public function listProductFournisseurPriceLog($product_fourn_price_id, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 11133d6a6e0..e1251efe8f7 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4829,7 +4829,7 @@ class Product extends CommonObject /** * Return all parent products for current product (first level only) * - * @return array Array of product + * @return array|int Array of product * @see hasFatherOrChild() */ public function getFather() @@ -4871,7 +4871,7 @@ class Product extends CommonObject * @param int $firstlevelonly Return only direct child * @param int $level Level of recursing call (start to 1) * @param array $parents Array of all parents of $id - * @return array Return array(prodid=>array(0=prodid, 1=>qty, 2=>product type, 3=>label, 4=>incdec, 5=>product ref) + * @return array|int Return array(prodid=>array(0=prodid, 1=>qty, 2=>product type, 3=>label, 4=>incdec, 5=>product ref) */ public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = array()) { diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index 317bc7fb5fd..d43a2e3bf56 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -367,7 +367,7 @@ class PriceGlobalVariableUpdater /** * List all price global variables * - * @return array Array of price global variable updaters + * @return array|int Array of price global variable updaters */ public function listUpdaters() { @@ -404,7 +404,7 @@ class PriceGlobalVariableUpdater /** * List all updaters which need to be processed * - * @return array Array of price global variable updaters + * @return array|int Array of price global variable updaters */ public function listPendingUpdaters() { diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 6e09a81eb7f..d537d7d06cf 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -564,7 +564,7 @@ class Entrepot extends CommonObject /** * Return number of unique different product into a warehouse * - * @return Array Array('nb'=>Nb, 'value'=>Value) + * @return array|int Array('nb'=>Nb, 'value'=>Value) */ public function nb_different_products() { @@ -595,7 +595,7 @@ class Entrepot extends CommonObject /** * Return stock and value of warehosue * - * @return Array Array('nb'=>Nb, 'value'=>Value) + * @return array|int Array('nb'=>Nb, 'value'=>Value) */ public function nb_products() { diff --git a/htdocs/reception/class/api_receptions.class.php b/htdocs/reception/class/api_receptions.class.php index 473650161e2..68da64fcc36 100644 --- a/htdocs/reception/class/api_receptions.class.php +++ b/htdocs/reception/class/api_receptions.class.php @@ -502,7 +502,7 @@ class Receptions extends DolibarrApi * * @url POST {id}/validate * - * @return array + * @return Object * \todo An error 403 is returned if the request has an empty body. * Error message: "Forbidden: Content type `text/plain` is not supported." * Workaround: send this in the body @@ -630,7 +630,7 @@ class Receptions extends DolibarrApi * * @url POST {id}/close * - * @return int + * @return Object */ public function close($id, $notrigger = 0) { diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index c4781c0df6a..f81fd066a2c 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -524,7 +524,7 @@ class Thirdparties extends DolibarrApi * Delete thirdparty * * @param int $id Thirdparty ID - * @return integer + * @return array */ public function delete($id) { @@ -1354,7 +1354,7 @@ class Thirdparties extends DolibarrApi * @param int $id Thirdparty id * @param int $companybankid Companybank id * @param string $model Model of document to generate - * @return void + * @return array * * @url GET {id}/generateBankAccountDocument/{companybankid}/{model} */ From 02f4f470830283fbf5dd7a6690fa4ca51bdab3fe Mon Sep 17 00:00:00 2001 From: FLIO Date: Tue, 24 Jan 2023 23:11:28 +0100 Subject: [PATCH 2/2] fix (qodana) Return value type is not compatible with declared --- htdocs/bom/class/api_boms.class.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/db/sqlite3.class.php | 2 +- htdocs/don/class/api_donations.class.php | 2 +- htdocs/ecm/class/ecmdirectory.class.php | 2 +- htdocs/expedition/class/api_shipments.class.php | 4 ++-- htdocs/supplier_proposal/class/supplier_proposal.class.php | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index fb7d175a229..c2df69b9012 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -365,7 +365,7 @@ class Boms extends DolibarrApi * * @url PUT {id}/lines/{lineid} * - * @return array|bool + * @return object|bool */ public function putLine($id, $lineid, $request_data = null) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 37f250bf92f..7df0c4efe9c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4277,7 +4277,7 @@ abstract class CommonObject * @param string $field_select name of field we need to get a list * @param string $field_where name of field of object we need to get linked items * @param string $table_element name of association table - * @return array Array of record + * @return array|int Array of record, -1 if empty */ public static function getAllItemsLinkedByObjectID($fk_object_where, $field_select, $field_where, $table_element) { diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 8c10c26d464..40d0f10baa8 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -316,7 +316,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $passwd password * @param string $name name of database (not used for mysql, used for pgsql) * @param integer $port Port of database server - * @return SQLite3 Database access handler + * @return SQLite3|string Database access handler * @see close() */ public function connect($host, $login, $passwd, $name, $port = 0) diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index f9af0568bf0..eee681cea7b 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -295,7 +295,7 @@ class Donations extends DolibarrApi * @throws RestException 404 * @throws RestException 500 System error * - * @return array + * @return object */ public function validate($id, $idwarehouse = 0, $notrigger = 0) { diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index fb9b2a35dd0..21a43565a25 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -633,7 +633,7 @@ class EcmDirectory extends CommonObject * level Level of line (Added by buildPathFromId call) * * @param int $force Force reload of full arbo even if already loaded in cache $this->cats - * @return array Tableau de array + * @return array|int Tableau de array if OK, -1 if KO */ public function get_full_arbo($force = 0) { diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 357683ef35a..e5e1f584f5e 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -502,7 +502,7 @@ class Shipments extends DolibarrApi * * @url POST {id}/validate * - * @return array + * @return object * \todo An error 403 is returned if the request has an empty body. * Error message: "Forbidden: Content type `text/plain` is not supported." * Workaround: send this in the body @@ -630,7 +630,7 @@ class Shipments extends DolibarrApi * * @url POST {id}/close * - * @return int + * @return object */ public function close($id, $notrigger = 0) { diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 1f95e3de5fd..1604cf928e7 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1942,7 +1942,7 @@ class SupplierProposal extends CommonObject * @param int $offset For pagination * @param string $sortfield Sort criteria * @param string $sortorder Sort order - * @return int -1 if KO, array with result if OK + * @return array|int -1 if KO, array with result if OK */ public function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datec', $sortorder = 'DESC') { @@ -2223,7 +2223,7 @@ class SupplierProposal extends CommonObject * * @param User $user Object user * @param int $mode "opened" for askprice to close, "signed" for proposal to invoice - * @return int <0 if KO, >0 if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ public function load_board($user, $mode) {