From 969f0315df5a3e86d2632a65ec895801aebdd6eb Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 5 Aug 2025 13:47:44 +0200 Subject: [PATCH] Clean code --- htdocs/api/class/api_setup.class.php | 7 +++---- htdocs/core/class/hookmanager.class.php | 14 +++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 1e84d558c81..179143c45ab 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -2917,9 +2917,7 @@ class Setup extends DolibarrApi * * @url GET /modules * - * @return array Data without useless information - * @phan-return array - * @phpstan-return array + * @return array Array of modules * * @throws RestException 403 Forbidden */ @@ -2934,6 +2932,7 @@ class Setup extends DolibarrApi sort($conf->modules); - return $this->_cleanObjectDatas($conf->modules); + //return $this->_cleanObjectDatas($conf->modules); + return $conf->modules; } } diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index b27920128ca..6c9d863ff7f 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -189,14 +189,14 @@ class HookManager /** * Execute hooks (if they were initialized) for the given method * - * @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...) + * @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...) * @param array $parameters Array of parameters - * @param null|Object|string $object Object to use hooks on @phan-ignore-reference - * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) - * @return int<-1,1> For 'addreplace' hooks (doActions, formConfirm, formObjectOptions, pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop/replace standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller. - * For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0 if we want to keep standard actions, >0 uf we want to stop/replace standard actions (at least one > 0 and replacement will be done), <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller. - * All types can also return some values into an array ->results that will be merged into this->resArray for caller. - * $this->error or this->errors are also defined by class called by this function if error. + * @param null|Object|array|string $object Object to use hooks on @phan-ignore-reference + * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) + * @return int<-1,1> For 'addreplace' hooks (doActions, formConfirm, formObjectOptions, pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop/replace standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller. + * For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0 if we want to keep standard actions, >0 uf we want to stop/replace standard actions (at least one > 0 and replacement will be done), <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller. + * All types can also return some values into an array ->results that will be merged into this->resArray for caller. + * $this->error or this->errors are also defined by class called by this function if error. */ public function executeHooks($method, $parameters = array(), &$object = null, &$action = '') {