fix phpstan (#31024)

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan
This commit is contained in:
Frédéric FRANCE 2024-09-20 01:45:17 +02:00 committed by GitHub
parent c00650c403
commit e252e36073
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 14 deletions

View File

@ -6,6 +6,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -41,7 +42,6 @@ if (!$user->admin) {
}
$type = array('yesno', 'texte', 'chaine');
$action = GETPOST('action', 'aZ09');
$testsubscribeemail = GETPOST("testsubscribeemail");
@ -57,13 +57,14 @@ $error = 0;
// Action updated or added a constant
if ($action == 'update' || $action == 'add') {
$tmparray = GETPOST('constname', 'array');
$tmpvalue = GETPOST('constvalue', 'array');
$tmpnote = GETPOST('constnote', 'array');
if (is_array($tmparray)) {
foreach ($tmparray as $key => $val) {
$constname = $tmparray[$key];
$constvalue = $tmparray[$key];
$consttype = $tmparray[$key];
$constnote = $tmparray[$key];
$res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
$constvalue = $tmpvalue[$key];
$constnote = $tmpnote[$key];
$res = dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, $constnote, $conf->entity);
if (!($res > 0)) {
$error++;

View File

@ -7,6 +7,7 @@
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 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
* it under the terms of the GNU General Public License as published by
@ -42,8 +43,6 @@ if (!$user->admin) {
}
$type = array('yesno', 'texte', 'chaine');
$action = GETPOST('action', 'aZ09');
@ -55,7 +54,6 @@ $action = GETPOST('action', 'aZ09');
if ($action == 'update' || $action == 'add') {
$constnamearray = GETPOST("constname", 'array');
$constvaluearray = GETPOST("constvalue", 'array');
$consttypearray = GETPOST("consttype", 'array');
$constnotearray = GETPOST("constnote", 'array');
// Action mise a jour ou ajout d'une constante
@ -63,10 +61,9 @@ if ($action == 'update' || $action == 'add') {
foreach ($constnamearray as $key => $val) {
$constname = dol_escape_htmltag($constnamearray[$key]);
$constvalue = dol_escape_htmltag($constvaluearray[$key]);
$consttype = (int) $consttypearray[$key];
$constnote = dol_escape_htmltag($constnotearray[$key]);
$res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
$res = dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, $constnote, $conf->entity);
if (!($res > 0)) {
$error++;

View File

@ -1715,8 +1715,8 @@ function complete_elementList_with_modules(&$elementList)
/**
* Show array with constants to edit
*
* @param array<string,array{type:string,label:string}> $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label)
* where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ...
* @param array<string,array{type:string,label:string}>|array<int,string> $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label)
* where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ...
* @param int<2,3> $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (deprecated), 2=No form nor button at all, 3=No form nor button at all and each field has a unique name (form is output by caller, recommended) (typed as int<2,3> to highlight the deprecated values)
* @param string $helptext Tooltip help to use for the column name of values
* @param string $text Text to use for the column name of values
@ -1767,7 +1767,6 @@ function form_constantes($tableau, $strictw3c = 2, $helptext = '', $text = 'Valu
$const = $key;
}
}
$sql = "SELECT ";
$sql .= "rowid";
$sql .= ", ".$db->decrypt('name')." as name";

View File

@ -115,7 +115,6 @@ parameters:
- '# Form::formconfirm\(\) expects array#'
- '# FormWebPortal::selectForForms\(\) expects int, array#'
- '# Lettering::getBankLinesFromFkDocAndDocType\(\) expects array#'
- '# form_constantes expects array#'
- '# (Odf) constructor expects #'
- '# Stripe[^ ]+::all\(\) expects #'
- '#expects resource#'