From eac44b164ac1984388e2e7a63f4fc5955680cdf1 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 3 Mar 2025 01:49:20 +0100 Subject: [PATCH] Qual: Fix phpdoc index(), FIELDS --- htdocs/adherents/class/api_members.class.php | 2 +- .../categories/class/api_categories.class.php | 18 +++++++++++++++++- .../action/class/api_agendaevents.class.php | 10 ++++++---- .../comm/propal/class/api_proposals.class.php | 4 +++- htdocs/commande/class/api_orders.class.php | 4 +++- .../facture/class/api_invoices.class.php | 4 +++- htdocs/contrat/class/api_contracts.class.php | 4 +++- htdocs/don/class/api_donations.class.php | 4 +++- .../class/api_supplier_invoices.class.php | 2 ++ .../class/api_knowledgemanagement.class.php | 2 ++ htdocs/product/class/api_products.class.php | 4 +++- .../reception/class/api_receptions.class.php | 4 ++-- htdocs/salaries/class/api_salaries.class.php | 4 ++-- .../societe/class/api_thirdparties.class.php | 4 +++- .../class/api_supplier_proposals.class.php | 4 +++- htdocs/ticket/class/api_tickets.class.php | 6 ++++-- htdocs/webhook/class/api_webhook.class.php | 4 +++- 17 files changed, 63 insertions(+), 21 deletions(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index a08dc6cc2db..9d2d9cda8d5 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -541,7 +541,7 @@ class Members extends DolibarrApi * @param Object $object Object to clean * @return Object Object with cleaned properties */ - protected function _cleanObjectDatas($object) + public function _cleanObjectDatas($object) { // phpcs:enable $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 96af20da374..2e8605e205f 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -69,7 +69,9 @@ class Categories extends DolibarrApi * * @param int $id ID of category * @param bool $include_childs Include child categories list (true or false) - * @return array|mixed data without useless information + * @return array Data without useless information + * @phan-return Categorie + * @phpstan-return Categorie * * @throws RestException */ @@ -115,6 +117,8 @@ class Categories extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @return array Array of category objects + * @phan-return Categorie[] + * @phpstan-return Categorie[] * * @throws RestException */ @@ -217,6 +221,8 @@ class Categories extends DolibarrApi * @phan-param ?array $request_data * @phpstan-param ?array $request_data * @return Object Updated object + * @phan-return Categorie + * @phpstan-return Categorie */ public function put($id, $request_data = null) { @@ -306,6 +312,8 @@ class Categories extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @return array Array of category objects + * @phan-return Categorie[] + * @phpstan-return Categorie[] * * @throws RestException * @@ -360,6 +368,8 @@ class Categories extends DolibarrApi * @param int $object_id ID of object * * @return array + * @phan-return array{success:array{code:int,message:string}} + * @phpstan-return array{success:array{code:int,message:string}} * @throws RestException * * @url POST {id}/objects/{type}/{object_id} @@ -441,6 +451,8 @@ class Categories extends DolibarrApi * @param string $object_ref Reference of object * * @return array + * @phan-return array{success:array{code:int,message:string}} + * @phpstan-return array{success:array{code:int,message:string}} * @throws RestException * * @url POST {id}/objects/{type}/ref/{object_ref} @@ -522,6 +534,8 @@ class Categories extends DolibarrApi * @param int $object_id ID of the object * * @return array + * @phan-return array{success:array{code:int,message:string}} + * @phpstan-return array{success:array{code:int,message:string}} * @throws RestException * * @url DELETE {id}/objects/{type}/{object_id} @@ -601,6 +615,8 @@ class Categories extends DolibarrApi * @param string $object_ref Reference of the object * * @return array + * @phan-return array{success:array{code:int,message:string}} + * @phpstan-return array{success:array{code:int,message:string}} * @throws RestException * * @url DELETE {id}/objects/{type}/ref/{object_ref} diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 3f9b20893e8..c89e7b6cb20 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -37,7 +37,7 @@ class AgendaEvents extends DolibarrApi ); /** - * @var ActionComm {@type ActionComm} + * @var ActionComm {@type ActionActionCom} */ public $actioncomm; @@ -104,6 +104,8 @@ class AgendaEvents extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @return array Array of order objects + * @phan-return ActionComm[]|array{data:ActionComm[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return ActionComm[]|array{data:ActionComm[],pagination:array{total:int,page:int,page_count:int,limit:int}} */ public function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = '', $sqlfilters = '', $properties = '', $pagination_data = false) { @@ -197,7 +199,7 @@ class AgendaEvents extends DolibarrApi $obj_ret['pagination'] = [ 'total' => (int) $total, 'page' => $page, //count starts from 0 - 'page_count' => ceil((int) $total / $limit), + 'page_count' => (int) ceil((int) $total / $limit), 'limit' => $limit ]; } @@ -272,7 +274,7 @@ class AgendaEvents extends DolibarrApi if ($result) { $this->actioncomm->fetch_optionals(); $this->actioncomm->fetch_userassigned(); - $this->actioncomm->oldcopy = clone $this->actioncomm; + $this->actioncomm->oldcopy = clone $this->actioncomm; // @phan-suppress-current-line PhanTypeMismatchProperty } if (!$result) { throw new RestException(404, 'actioncomm not found'); @@ -326,7 +328,7 @@ class AgendaEvents extends DolibarrApi if ($result) { $this->actioncomm->fetch_optionals(); $this->actioncomm->fetch_userassigned(); - $this->actioncomm->oldcopy = clone $this->actioncomm; + $this->actioncomm->oldcopy = clone $this->actioncomm; // @phan-suppress-current-line PhanTypeMismatchProperty } if (!DolibarrApiAccess::$user->hasRight('agenda', 'allactions', 'delete') && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) { diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 54a017d39b7..1cb3d491737 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; class Proposals extends DolibarrApi { /** - * @var array Mandatory fields, checked when create and update object + * @var string[] Mandatory fields, checked when create and update object */ public static $FIELDS = array( 'socid' @@ -162,6 +162,8 @@ class Proposals extends DolibarrApi * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @param int $loadlinkedobjects Load also linked object * @return array Array of order objects + * @phan-return Propal[]|array{data:Propal[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return Propal[]|array{data:Propal[],pagination:array{total:int,page:int,page_count:int,limit:int}} */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '', $pagination_data = false, $loadlinkedobjects = 0) { diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 5ebaec4be86..c4890f69f67 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; class Orders extends DolibarrApi { /** - * @var array Mandatory fields, checked when create and update object + * @var string[] Mandatory fields, checked when create and update object */ public static $FIELDS = array( 'socid', @@ -164,6 +164,8 @@ class Orders extends DolibarrApi * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @param int $loadlinkedobjects Load also linked object * @return array Array of order objects + * @phan-return Commande[]|array{data:Commande[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return Commande[]|array{data:Commande[],pagination:array{total:int,page:int,page_count:int,limit:int}} * * @throws RestException 404 Not found * @throws RestException 503 Error diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 4da9526ebb2..9a214e95a18 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; class Invoices extends DolibarrApi { /** - * @var array Mandatory fields, checked when create and update object + * @var string[] Mandatory fields, checked when create and update object */ public static $FIELDS = array( 'socid', @@ -184,6 +184,8 @@ class Invoices extends DolibarrApi * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0 * @param int $loadlinkedobjects Load also linked object * @return array Array of invoice objects + * @phan-return Facture[]|array{data:Facture[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return Facture[]|array{data:Facture[],pagination:array{total:int,page:int,page_count:int,limit:int}} * * @throws RestException 404 Not found * @throws RestException 503 Error diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 55771f352bf..d53f60c940b 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; class Contracts extends DolibarrApi { /** - * @var array Mandatory fields, checked when create and update object + * @var string[] Mandatory fields, checked when create and update object */ public static $FIELDS = array( 'socid', @@ -97,6 +97,8 @@ class Contracts extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @return array Array of order objects + * @phan-return Contrat[]|array{data:Contrat[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return Contrat[]|array{data:Contrat[],pagination:array{total:int,page:int,page_count:int,limit:int}} * * @throws RestException 404 Not found * @throws RestException 503 Error diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 4570fda0bf5..6b7ad5b0444 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; class Donations extends DolibarrApi { /** - * @var array Mandatory fields, checked when create and update object + * @var string[] Mandatory fields, checked when create and update object */ public static $FIELDS = array( 'amount' @@ -96,6 +96,8 @@ class Donations extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @return array Array of order objects + * @phan-return Don[]|array{data:Don[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return Don[]|array{data:Don[],pagination:array{total:int,page:int,page_count:int,limit:int}} * * @throws RestException */ diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 4dbb43115be..49fc7e4ce8f 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -103,6 +103,8 @@ class SupplierInvoices extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @return array Array of invoice objects + * @phan-return FactureFournisseur[]|array{data:FactureFournisseur[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return FactureFournisseur[]|array{data:FactureFournisseur[],pagination:array{total:int,page:int,page_count:int,limit:int}} * * @throws RestException */ diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index a46e075634b..2b4fc1d20c5 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -130,6 +130,8 @@ class KnowledgeManagement extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @return array Array of order objects + * @phan-return KnowledgeRecord[]|array{data:KnowledgeRecord[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return KnowledgeRecord[]|array{data:KnowledgeRecord[],pagination:array{total:int,page:int,page_count:int,limit:int}} * * @throws RestException * diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index ce9d7803292..17b3d31f93c 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.cla class Products extends DolibarrApi { /** - * @var array Mandatory fields, checked when create and update object + * @var string[] Mandatory fields, checked when create and update object */ public static $FIELDS = array( 'ref', @@ -177,6 +177,8 @@ class Products extends DolibarrApi * @param int $includestockdata Load also information about stock (slower) * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @return array Array of product objects + * @phan-return Product[]|array{data:Product[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return Product[]|array{data:Product[],pagination:array{total:int,page:int,page_count:int,limit:int}} */ public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false, $variant_filter = 0, $pagination_data = false, $includestockdata = 0, $properties = '') { diff --git a/htdocs/reception/class/api_receptions.class.php b/htdocs/reception/class/api_receptions.class.php index e536919e8aa..68cc80eaa61 100644 --- a/htdocs/reception/class/api_receptions.class.php +++ b/htdocs/reception/class/api_receptions.class.php @@ -98,8 +98,8 @@ class Receptions extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @return array Array of reception objects - * @phan-return array> - * @phpstan-return array> + * @phan-return Reception[]|array{data:Reception[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return Reception[]|array{data:Reception[],pagination:array{total:int,page:int,page_count:int,limit:int}} * * @throws RestException */ diff --git a/htdocs/salaries/class/api_salaries.class.php b/htdocs/salaries/class/api_salaries.class.php index a7227e4ebe6..8470768b1b1 100644 --- a/htdocs/salaries/class/api_salaries.class.php +++ b/htdocs/salaries/class/api_salaries.class.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; class Salaries extends DolibarrApi { /** - * @var array Mandatory fields, checked when creating an object + * @var string[] Mandatory fields, checked when creating an object */ public static $FIELDS = array( 'fk_user', @@ -41,7 +41,7 @@ class Salaries extends DolibarrApi ); /** - * array $FIELDS Mandatory fields, checked when creating an object + * string[] $FIELDS Mandatory fields, checked when creating an object */ public static $FIELDSPAYMENT = array( "paiementtype", diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index bfecfc45047..4517ed911e9 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -32,7 +32,7 @@ use Luracast\Restler\RestException; class Thirdparties extends DolibarrApi { /** - * @var array Mandatory fields, checked when we create and update the object + * @var string[] Mandatory fields, checked when we create and update the object */ public static $FIELDS = array( 'name' @@ -131,6 +131,8 @@ class Thirdparties extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @return array Array of thirdparty objects + * @phan-return Societe[]|array{data:Societe[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return Societe[]|array{data:Societe[],pagination:array{total:int,page:int,page_count:int,limit:int}} */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $properties = '', $pagination_data = false) { diff --git a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php index 0d607880f12..d2fa85fa69d 100644 --- a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php +++ b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class class SupplierProposals extends DolibarrApi { /** - * @var array Mandatory fields, checked when create and update object + * @var string[] Mandatory fields, checked when create and update object */ public static $FIELDS = array( 'socid' @@ -226,6 +226,8 @@ class SupplierProposals extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @return array Array of order objects + * @phan-return SupplierProposal[]|array{data:SupplierProposal[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return SupplierProposal[]|array{data:SupplierProposal[],pagination:array{total:int,page:int,page_count:int,limit:int}} */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '', $pagination_data = false) { diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index c633ab5085e..da0eb4c4d87 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; class Tickets extends DolibarrApi { /** - * @var array Mandatory fields, checked when create and update object + * @var string[] Mandatory fields, checked when create and update object */ public static $FIELDS = array( 'subject', @@ -40,7 +40,7 @@ class Tickets extends DolibarrApi ); /** - * @var array Mandatory fields, checked when create and update object + * @var string[] Mandatory fields, checked when create and update object */ public static $FIELDS_MESSAGES = array( 'track_id', @@ -202,6 +202,8 @@ class Tickets extends DolibarrApi * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * * @return array Array of ticket objects + * @phan-return Ticket[]|array{data:Ticket[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return Ticket[]|array{data:Ticket[],pagination:array{total:int,page:int,page_count:int,limit:int}} */ public function index($socid = 0, $sortfield = "t.rowid", $sortorder = "ASC", $limit = 100, $page = 0, $sqlfilters = '', $properties = '', $pagination_data = false) { diff --git a/htdocs/webhook/class/api_webhook.class.php b/htdocs/webhook/class/api_webhook.class.php index e51a73ff463..32474da267c 100644 --- a/htdocs/webhook/class/api_webhook.class.php +++ b/htdocs/webhook/class/api_webhook.class.php @@ -27,7 +27,7 @@ use Luracast\Restler\RestException; class Webhook extends DolibarrApi { /** - * @var array Mandatory fields, checked when we create and update the object + * @var string[] Mandatory fields, checked when we create and update the object */ public static $FIELDS = array( 'url', @@ -80,6 +80,8 @@ class Webhook extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @return array Array of target objects + * @phan-return Target[]|array{data:Target[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * @phpstan-return Target[]|array{data:Target[],pagination:array{total:int,page:int,page_count:int,limit:int}} */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '', $pagination_data = false) {