From f250f7caa50bf86f837ca1ced84b311cea1ae051 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 18 Jan 2025 23:15:39 +0100 Subject: [PATCH] Qual: Fix Phan notices # Qual: Fix phan notices --- dev/tools/phan/stubs/multicompany.php | 4 +- htdocs/core/class/dolgraph.class.php | 8 ++-- htdocs/core/class/html.formcron.class.php | 11 ++--- htdocs/core/tpl/onlinepaymentlinks.tpl.php | 4 ++ htdocs/core/tpl/passwordforgotten.tpl.php | 26 ++++++++---- htdocs/core/tpl/passwordreset.tpl.php | 27 +++++++++--- htdocs/core/tpl/resource_add.tpl.php | 8 +++- ...interface_50_modLdap_Ldapsynchro.class.php | 6 +-- ...terface_50_modTicket_TicketEmail.class.php | 42 +++++++++++++++---- htdocs/cron/card.php | 3 +- htdocs/cron/list.php | 5 ++- .../DataCollector/DolMemoryCollector.php | 4 +- .../class/DataCollector/DolQueryCollector.php | 4 +- htdocs/delivery/card.php | 21 +++++++--- htdocs/delivery/class/delivery.class.php | 6 +-- htdocs/delivery/tpl/linkedobjectblock.tpl.php | 5 ++- htdocs/document.php | 7 +++- htdocs/don/admin/donation.php | 4 +- htdocs/don/card.php | 29 +++++++------ htdocs/don/class/donstats.class.php | 5 +-- htdocs/don/class/paymentdonation.class.php | 4 +- htdocs/don/document.php | 15 ++++--- htdocs/don/index.php | 8 ++-- htdocs/don/info.php | 14 ++++--- htdocs/don/note.php | 14 ++++--- htdocs/don/paiement/list.php | 23 +++++----- htdocs/don/payment/card.php | 3 +- htdocs/don/payment/payment.php | 4 +- htdocs/don/stats/index.php | 11 +++-- htdocs/don/tpl/linkedobjectblock.tpl.php | 6 ++- 30 files changed, 216 insertions(+), 115 deletions(-) diff --git a/dev/tools/phan/stubs/multicompany.php b/dev/tools/phan/stubs/multicompany.php index 0f2ba3b4e74..33c25d99c23 100644 --- a/dev/tools/phan/stubs/multicompany.php +++ b/dev/tools/phan/stubs/multicompany.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2024-2025 MDW * * Note: in this context Entity == Company. */ @@ -31,7 +31,7 @@ class ActionsMulticompany } /** - * @param string $entity + * @param int $entity * @return void */ public function getInfo($entity) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 79cff89f228..81fc746874d 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1,7 +1,7 @@ * Copyright (c) 2004-2015 Laurent Destailleur - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -55,7 +55,9 @@ class DolGraph private $_library; // Graphic library to use (jflot, chart, artichow) /** - * @var array Array of data + * @var array> Array of data + * @phpstan-var array + * @phan-var array */ public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...) /** @@ -364,7 +366,7 @@ class DolGraph /** * Set data * - * @param array $data Data + * @param array $data Data * @return void * @see draw_jflot() for syntax of data array */ diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php index 69730aaca51..fde4fd8e3f3 100644 --- a/htdocs/core/class/html.formcron.class.php +++ b/htdocs/core/class/html.formcron.class.php @@ -1,6 +1,7 @@ + * Copyright (C) 2025 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 @@ -53,12 +54,12 @@ class FormCron extends Form /** * Display On Off selector * - * @param string $htmlname Html control name - * @param integer $selected selected value - * @param integer $readonly Select is read only or not - * @return string HTML select field + * @param string $htmlname Html control name + * @param string $selected Selected value + * @param int<0,1> $readonly Select is read only or not + * @return string HTML select field */ - public function select_typejob($htmlname, $selected = 0, $readonly = 0) + public function select_typejob($htmlname, $selected = '', $readonly = 0) { // phpcs:enable global $langs; diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php index 3964d67232d..aae89f8a135 100644 --- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php +++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2025 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 @@ -19,6 +20,9 @@ * @var Translate $langs * @var string $servicename */ +' +@phan-var-force string $servicename +'; // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index d01fb3a5f99..edfaae9154c 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -2,7 +2,7 @@ /* Copyright (C) 2009-2010 Regis Houssin * Copyright (C) 2011-2024 Laurent Destailleur * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -34,13 +34,25 @@ if (!defined('NOBROWSERNOTIF')) { * @var string $disabled * @var string $dol_url_root * @var string $focus_element - * @var string $mode + * @var string $mode Contains (list of) authentication methods - example "http","dolibarr","openid,dolibarr" * @var string $message * @var string $title * @var string $urllogo - * @var string $user + * @var User $user * @var string $username */ +' +@phan-var-force string $captcha +@phan-var-force string $disabled +@phan-var-force string $dol_url_root +@phan-var-force string $focus_element +@phan-var-force string $mode +@phan-var-force string $message +@phan-var-force string $title +@phan-var-force string $urllogo +@phan-var-force User $user +@phan-var-force string $username +'; // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; @@ -130,10 +142,10 @@ $(document).ready(function () {