Qual: Fix phpstan notices (#37932)

* Qual: Fix phpstan notices

# Qual: Fix phpstan notices.

- Fix ModeleBoxes::$info_box_contents typing;
- Fix validate value to non-string (htdocs/asset/card.php)
- Fix type for lines_model in FormMail

* Qual: Fix get_tz_array() return typehint

* Qual: Fix arguments types to mktime, dol_time

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
MDW 2026-04-20 12:35:28 +02:00 committed by GitHub
parent ddf2a617e1
commit ca850421f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 13 deletions

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025-2026 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -198,7 +198,7 @@ if ($action == 'create') {
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
}
if (GETPOSTISSET('supplier_invoice_id')) {
$object->fields['supplier_invoice_id'] = array('type' => 'integer:FactureFournisseur:fourn/class/fournisseur.facture.class.php:1:entity IN (__SHARED_ENTITIES__)', 'label' => 'SupplierInvoice', 'enabled' => '1', 'noteditable' => 1, 'position' => 280, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => '1',);
$object->fields['supplier_invoice_id'] = array('type' => 'integer:FactureFournisseur:fourn/class/fournisseur.facture.class.php:1:entity IN (__SHARED_ENTITIES__)', 'label' => 'SupplierInvoice', 'enabled' => '1', 'noteditable' => 1, 'position' => 280, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => 1,);
print '<input type="hidden" name="supplier_invoice_id" value="' . GETPOSTINT('supplier_invoice_id') . '">';
}

View file

@ -3,7 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -52,12 +52,12 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo
public $param;
/**
* @var array<array{text:string,nbcol?:int,limit?:int,graph?:int<0,1>,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string}>|array{text:string,nbcol?:int,limit?:int,graph?:int<0,1>,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string} box info heads. Example: array('text' => $langs->trans("BoxScheduledJobs", $max), 'nbcol' => 4);
* @var array<array{text:string,nbcol?:int,limit?:int,graph?:int<0,1>,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string}>|array{text:string,nbcol?:int,limit?:int,graph?:int<0,1>,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string} box info heads. Example: array('text' =>->trans("BoxScheduledJobs",), 'nbcol' => 4);
*/
public $info_box_head = array();
/**
* @var array<array<array{td?:string,text:string,asis?:int<0,1>,maxlength?:int}>>|array<array{td?:string,text:string,asis?:int<0,1>,maxlength?:int}> box info content
* @var array<array<array{td?:string,text:string,asis?:int<0,1>,maxlength?:int}|array{td?:string,textnoformat:string,asis?:int<0,1>,maxlength?:int}>>|array<array{td?:string,text:string,asis?:int<0,1>,maxlength?:int}|array{td?:string,textnoformat:string,asis?:int<0,1>,maxlength?:int}> box info content
*/
public $info_box_contents = array();
@ -487,7 +487,6 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo
*
* @param ?string[] $forcedirwidget null=All default directories. This parameter is used by modulebuilder module only.
* @return array<array{picto:string,file:string,fullpath:string,relpath:string,iscoreorexternal:'external'|'internal',version:string,status:string,info:string}> Array list of widgets
*
*/
public static function getWidgetsList($forcedirwidget = null)
{

View file

@ -266,7 +266,7 @@ class FormMail extends Form
public $withtoccuser = array();
/**
* @var ModelMail[]
* @var CEmailTemplate[]
*/
public $lines_model;

View file

@ -4,7 +4,7 @@
* Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2024 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -31,7 +31,7 @@
/**
* Return an array with timezone values
*
* @return array<int<-11,13>,string> Array with timezone values
* @return array<int<-11,14>,string> Array with timezone values
*/
function get_tz_array()
{

View file

@ -427,7 +427,7 @@ if (issetAndNoEmpty('choixjourajout')) {
$nbofchoice = count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++) {
$choixjourajout = GETPOST("choixjourajout");
if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"])) {
if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourajout[0], $_SESSION["annee"])) {
$journeuf = false;
}
}
@ -436,9 +436,9 @@ if (issetAndNoEmpty('choixjourajout')) {
// If the validation is ok, add a field to the session variables that holds all the dates
if ($journeuf && issetAndNoEmpty('choixjourajout') === true) {
$choixjourajout = GETPOST("choixjourajout");
array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"]));
array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourajout[0], $_SESSION["annee"]));
sort($_SESSION["totalchoixjour"]);
$cle = array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]);
$cle = array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourajout[0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]);
//On sauvegarde les heures deja entrées
for ($i = 0; $i < $cle; $i++) {
@ -479,7 +479,7 @@ if (issetAndNoEmpty('choixjourretrait')) {
for ($i = 0; $i < $nbofchoice; $i++) {
$choixjourretrait = GETPOST('choixjourretrait');
if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $choixjourretrait[0], $_SESSION["annee"])) {
if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourretrait[0], $_SESSION["annee"])) {
for ($j = $i; $j < $nbofchoice; $j++) {
$k = $j + 1;
$_SESSION["horaires$j"] = $_SESSION["horaires$k"];