diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 62f3427736b..c0b4c86a907 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -72,7 +72,6 @@ return [ 'htdocs/core/class/html.formcompany.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/html.formmail.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/openid.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/core/class/rssparser.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/class/timespent.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/core/lib/admin.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/lib/files.lib.php' => ['PhanUndeclaredProperty'], diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php index 9e53db01e82..32f56331ba2 100644 --- a/htdocs/compta/ajaxpayment.php +++ b/htdocs/compta/ajaxpayment.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2026 Lenin Rivas * @@ -59,7 +59,7 @@ $langs->load('compta'); //init var $invoice_type = GETPOSTINT('invoice_type'); $amountPayment = GETPOST('amountPayment'); -$amounts = GETPOST('amounts'); // from text inputs : invoice amount payment (check required) +$amounts = GETPOST('amounts', 'array'); // from text inputs : invoice amount payment (check required) $remains = GETPOST('remains'); // from dolibarr's object (no need to check) $currentInvId = GETPOST('imgClicked'); // from DOM elements : imgId (equals invoice id) @@ -69,7 +69,7 @@ $amountPayment = $amountPayment != '' ? (is_numeric(price2num($amountPayment)) ? // Multicurrency LRR $multicurrency = GETPOSTINT('multicurrency'); $multicurrencyAmountPayment = GETPOST('multicurrency_amountPayment'); -$multicurrencyAmounts = GETPOST('multicurrency_amounts'); // from text inputs : invoice amount payment (check required) +$multicurrencyAmounts = GETPOST('multicurrency_amounts', 'array'); // from text inputs : invoice amount payment (check required) $multicurrencyRemains = GETPOST('multicurrency_remains'); // from dolibarr's object (no need to check) // Getting the posted keys=>values, sanitize the ones who are from text inputs diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index a470531a398..4a814b4a5f2 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2015 Marcos García + * Copyright (C) 2026 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -66,6 +67,9 @@ class LignePrelevement */ public $db; + /** + * @var string[] Map status index to localized labels + */ public $labelStatus = array(); const STATUS_DRAFT = 0; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 0b6182c94f4..ae49ad112c2 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,7 +59,14 @@ class PaymentSocialContribution extends CommonObject */ public $fk_charge; + /** + * @var int|'' Date of creation + */ public $datec = ''; + + /** + * @var int|'' Date of payment + */ public $datep = ''; /** @@ -137,7 +144,7 @@ class PaymentSocialContribution extends CommonObject public $chid; /** - * @var int|string datepaye + * @var int|'' Payment date when creating */ public $datepaye; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index d81b8d5ce98..efb970ee10f 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -189,6 +189,7 @@ class CMailFile public $html_images = array(); /** @var array */ public $images_encoded = array(); + /** @var array Filename extension to MIME mapping */ public $image_types = array( 'gif' => 'image/gif', 'jpg' => 'image/jpeg', diff --git a/htdocs/core/class/cleadstatus.class.php b/htdocs/core/class/cleadstatus.class.php index 6d131c0a3c4..43a745aa92c 100644 --- a/htdocs/core/class/cleadstatus.class.php +++ b/htdocs/core/class/cleadstatus.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2020 Florian HENRY - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -183,7 +183,7 @@ class CLeadStatus extends CommonDict * @param int $offset Offset * @param string $filter Filter USF * @param string $filtermode Filter mode (AND or OR) - * @return array|int int <0 if KO, array of pages if OK + * @return self[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2386a7d0d18..16e78a972f5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4914,7 +4914,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|int Array of record, -1 if empty + * @return string[]|int Array of record, -1 if empty */ public static function getAllItemsLinkedByObjectID($fk_object_where, $field_select, $field_where, $table_element) { @@ -4946,7 +4946,7 @@ abstract class CommonObject * @param int $fk_object_where id of object we need to get linked items * @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|int Array of record, -1 if empty + * @return int<-1,max> Array of records, -1 if empty argument */ public static function getCountOfItemsLinkedByObjectID($fk_object_where, $field_where, $table_element) { diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index ac91a67dce5..9fdc693b783 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -139,7 +139,9 @@ class Notify */ public $fk_project; - // This codes actions are defined into table llx_notify_def + /** + * @var string[] These codes actions are defined in table llx_notify_def + */ public static $arrayofnotifsupported = array( 'BILL_CANCEL', 'BILL_VALIDATE', @@ -185,10 +187,10 @@ class Notify * Return message that say how many notification (and to which email) will occurs on requested event. * This is to show confirmation messages before event is recorded. * - * @param string $action Id of action in llx_c_action_trigger - * @param int $socid Id of third party - * @param Object $object Object the notification is about - * @return string Message + * @param string $action Id of action in llx_c_action_trigger + * @param int $socid Id of third party + * @param ?CommonObject $object Object the notification is about + * @return string Message */ public function confirmMessage($action, $socid, $object) { @@ -451,10 +453,10 @@ class Notify * * @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage) * @param int $socid Id of third party or 0 for all thirdparties or -1 for no thirdparties - * @param CommonObject $object Object the notification is about (need it to check threshold value of some notifications) + * @param ?CommonObject $object Object the notification is about (need it to check threshold value of some notifications) * @param int $userid Id of user or 0 for all users or -1 for no users - * @param array $scope Scope where to search - * @return array|int Return integer <0 if KO, array of notifications to send if OK + * @param string[] $scope Scope where to search + * @return array|-1 Return integer <0 if KO, array of notifications to send if OK */ public function getNotificationsArray($notifcode, $socid = 0, $object = null, $userid = 0, $scope = array('thirdparty', 'user', 'global')) { @@ -547,7 +549,7 @@ class Notify $newval2 = trim($obj->email); $isvalid = isValidEmail($newval2); if (empty($resarray[$newval2])) { - $resarray[$newval2] = array('type' => 'touser', 'code' => trim($obj->code), 'emaildesc' => 'User id '.$obj->rowid, 'email' => $newval2, 'userid' => $obj->rowid, 'isemailvalid' => $isvalid); + $resarray[$newval2] = array('type' => 'touser', 'code' => trim($obj->code), 'emaildesc' => 'User id '.$obj->rowid, 'email' => $newval2, 'userid' => (int) $obj->rowid, 'isemailvalid' => $isvalid); } } $i++; diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index c57011ab8ba..fd8e505d015 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -99,6 +99,9 @@ class RssParser */ private $current_namespace; + /** + * @var array|array>> + */ public $items = array(); /** * @var array|array> @@ -811,11 +814,14 @@ class RssParser } } else { if (!empty($this->initem)) { - $this->concat($this->current_item[$el], $text); + // @phpstan-ignore-next-line argument.type + $this->concat($this->current_item[$el], $text); // @phan-suppress-current-line PhanTypeMismatchArgument } elseif (!empty($this->intextinput)) { - $this->concat($this->textinput[$el], $text); + // @phpstan-ignore-next-line argument.type + $this->concat($this->textinput[$el], $text); // @phan-suppress-current-line PhanTypeMismatchArgument } elseif (!empty($this->inimage)) { - $this->concat($this->image[$el], $text); + // @phpstan-ignore-next-line argument.type + $this->concat($this->image[$el], $text); // @phan-suppress-current-line PhanTypeMismatchArgument } elseif (!empty($this->inchannel)) { $this->concat($this->channel[$el], $text); } diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 874f9437067..2a3bfa71561 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1379,7 +1379,7 @@ if (class_exists('mysqli')) { } if (strpos($host, 'ssl://') === 0) { $host = substr($host, 6); - parent::options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false); + parent::options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, 0); // Suppress false positive @phan-suppress-next-line PhanTypeMismatchArgumentInternalProbablyReal parent::ssl_set(null, null, "", null, null); $flags = MYSQLI_CLIENT_SSL; diff --git a/htdocs/core/filemanagerdol/connectors/php/config.inc.php b/htdocs/core/filemanagerdol/connectors/php/config.inc.php index 7cb8b015ec3..377646fe9a5 100644 --- a/htdocs/core/filemanagerdol/connectors/php/config.inc.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.inc.php @@ -3,6 +3,7 @@ * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2024 Frédéric France + * Copyright (C) 2026 MDW * * == BEGIN LICENSE == * @@ -52,7 +53,6 @@ $entity = ((!empty($_SESSION['dol_entity']) && $_SESSION['dol_entity'] > 1) ? $_ if (!empty($user->admin) && !$user->hasRight('website', 'write')) { accessforbidden('Need to be admin or having write permission on website module'); - exit; } diff --git a/htdocs/core/modules/modQuickMemo.class.php b/htdocs/core/modules/modQuickMemo.class.php index 6aebd38cd54..54996a88b71 100644 --- a/htdocs/core/modules/modQuickMemo.class.php +++ b/htdocs/core/modules/modQuickMemo.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2026 John BOTELLA + * Copyright (C) 2026 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,7 +99,7 @@ class modQuickMemo extends DolibarrModules } $compatibleHooks = array_unique($compatibleHooks); // Security check - $compatibleHooks = array_filter($compatibleHooks, function (string $k) { + $compatibleHooks = array_filter($compatibleHooks, /** @return int|false */ static function (string $k) { return preg_match('/^[a-zA-Z0-9_]+$/', $k); }); diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 6d55b21309a..a07389708e3 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -398,7 +398,7 @@ class Position extends CommonObject * @param string $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return self[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { @@ -985,7 +985,7 @@ class Position extends CommonObject /** * Create an array of lines * - * @return array|int array of lines if OK, <0 if KO + * @return CommonObject[]|int array of lines if OK, <0 if KO */ public function getLinesArray() { @@ -1063,7 +1063,7 @@ class Position extends CommonObject * getForUser * * @param int $userid id of user we need to get position list - * @return array|int of positions of user with for each of them the job fetched into that array + * @return self[]|int of positions of user with for each of them the job fetched into that array */ public function getForUser($userid) { diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 5e7ed1d884f..aca7ccc0139 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -432,7 +432,7 @@ class Skill extends CommonObject /** * Load object lines in memory from the database * - * @return array|int Return integer <0 if KO, array of skill level found + * @return CommonObject[]|int Return integer <0 if KO, array of skill level found */ public function fetchLines() { @@ -991,7 +991,7 @@ class Skill extends CommonObject /** * Create an array of lines * - * @return array|int array of lines if OK, <0 if KO + * @return Skilldet[]|int array of lines if OK, <0 if KO */ public function getLinesArray() { diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index 5dc2ad8840c..b72bf804de1 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -95,7 +95,7 @@ class WorkstationResource extends CommonObject { global $db; $obj = new self($db); - return parent::getAllItemsLinkedByObjectID($fk_workstation, 'fk_resource', 'fk_workstation', $obj->table_element); + return array_map('intval', parent::getAllItemsLinkedByObjectID($fk_workstation, 'fk_resource', 'fk_workstation', $obj->table_element)); } /** diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index d3598ff50e6..9b62594540a 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -95,7 +95,7 @@ class WorkstationUserGroup extends CommonObject global $db; $obj = new self($db); - return parent::getAllItemsLinkedByObjectID($fk_workstation, 'fk_usergroup', 'fk_workstation', $obj->table_element); + return array_map('intval', parent::getAllItemsLinkedByObjectID($fk_workstation, 'fk_usergroup', 'fk_workstation', $obj->table_element)); } /**