Fix phpstan (#32005)

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan
This commit is contained in:
Frédéric FRANCE 2024-11-19 21:02:05 +01:00 committed by GitHub
parent 926b6301c7
commit daae68f9d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 79 additions and 165 deletions

View File

@ -1158,36 +1158,6 @@ parameters:
count: 2
path: ../../htdocs/adherents/class/subscription.class.php
-
message: '#^Variable \$badgeStatus0 might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/adherents/index.php
-
message: '#^Variable \$badgeStatus1 might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/adherents/index.php
-
message: '#^Variable \$badgeStatus4 might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/adherents/index.php
-
message: '#^Variable \$badgeStatus6 might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/adherents/index.php
-
message: '#^Variable \$badgeStatus8 might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../htdocs/adherents/index.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
@ -18246,12 +18216,6 @@ parameters:
count: 1
path: ../../htdocs/cron/list.php
-
message: '#^Variable \$head might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/cron/list.php
-
message: '#^Variable \$texttoshow might not be defined\.$#'
identifier: variable.undefined
@ -23220,12 +23184,6 @@ parameters:
count: 1
path: ../../htdocs/hrm/skill_tab.php
-
message: '#^Variable \$head might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/hrm/skill_tab.php
-
message: '#^Variable \$object might not be defined\.$#'
identifier: variable.undefined
@ -24720,12 +24678,6 @@ parameters:
count: 2
path: ../../htdocs/master.inc.php
-
message: '#^Variable \$head might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/modulebuilder/admin/setup.php
-
message: '#^Call to function is_array\(\) with array\<int\|string, array\{modulenamewithcase\: mixed, moduledescriptorrelpath\: string, moduledescriptorfullpath\: mixed, moduledescriptorrootpath\: mixed, moduletype\?\: ''external''\|''internal''\}\> will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -26460,12 +26412,6 @@ parameters:
count: 1
path: ../../htdocs/product/admin/product_tools.php
-
message: '#^Variable \$arrayresult might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/product/ajax/products.php
-
message: '#^Property ActionsCardProduct\:\:\$field_list has no type specified\.$#'
identifier: missingType.property
@ -36312,54 +36258,18 @@ parameters:
count: 1
path: ../../scripts/product/migrate_picture_path.php
-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 4
path: ../../scripts/product/migrate_picture_path.php
-
message: '#^Variable \$hookmanager might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../scripts/product/migrate_picture_path.php
-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../scripts/product/migrate_picture_path.php
-
message: '#^Result of \|\| is always false\.$#'
identifier: booleanOr.alwaysFalse
count: 1
path: ../../scripts/product/regenerate_thumbs.php
-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../scripts/product/regenerate_thumbs.php
-
message: '#^Variable \$dir in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
count: 1
path: ../../scripts/product/regenerate_thumbs.php
-
message: '#^Variable \$hookmanager might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../scripts/product/regenerate_thumbs.php
-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../scripts/product/regenerate_thumbs.php
-
message: '#^Variable \$subdir in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
@ -36372,44 +36282,8 @@ parameters:
count: 1
path: ../../scripts/user/migrate_picture_path.php
-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 4
path: ../../scripts/user/migrate_picture_path.php
-
message: '#^Variable \$hookmanager might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../scripts/user/migrate_picture_path.php
-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../scripts/user/migrate_picture_path.php
-
message: '#^Variable \$user might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../scripts/user/sync_groups_dolibarr2ldap.php
-
message: '#^Variable \$user might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../scripts/user/sync_users_dolibarr2ldap.php
-
message: '#^Unable to resolve the template type T in call to function array_values$#'
identifier: argument.templateType
count: 1
path: ../../scripts/user/sync_users_ldap2dolibarr.php
-
message: '#^Variable \$user might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../scripts/user/sync_users_ldap2dolibarr.php

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 Alexandre Janniaux <alexandre.janniaux@gmail.com>
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2023-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Alexandre Janniaux <alexandre.janniaux@gmail.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

View File

@ -136,6 +136,13 @@ if ($conf->use_javascript_ajax) {
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), $sumMembers['total']['members_excluded']);
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), $sumMembers['total']['members_resiliated']);
/**
* @var string $badgeStatus0
* @var string $badgeStatus1
* @var string $badgeStatus4
* @var string $badgeStatus6
* @var string $badgeStatus8
*/
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2017 Oscss-Shop <support@oscss-shop.fr>.
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
/* Copyright (C) 2017 Oscss-Shop <support@oscss-shop.fr>.
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020-2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modifyion 2.0 (the "License");
* it under the terms of the GNU General Public License as published bypliance with the License.

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -50,6 +50,8 @@ require_once '../../main.inc.php';
/**
* @var Conf $conf
* @var Translate $langs
*
* @var int $dolibarr_nocache
*/
@ -75,7 +77,7 @@ jQuery(document).ready(function () {\n";
if (empty($conf->dol_no_mouse_hover)) {
print '
/* for standard tooltip */
/* for standard tooltip */
jQuery(".classfortooltip").tooltip({
tooltipClass: "mytooltip",
show: { collision: "flipfit", effect:"toggle", delay:50, duration: 20 },
@ -101,30 +103,30 @@ if (empty($conf->dol_no_mouse_hover)) {
target.off("mouseover mouseout");
target.on("mouseover", function(event) {
console.log("we will create timer for ajax call");
event.stopImmediatePropagation();
event.stopImmediatePropagation();
clearTimeout(elemtostoretooltiptimer.data("openTimeoutId"));
var params = JSON.parse($(this).attr("data-params"));
params.token = currenttoken;
var elemfortooltip = $(this);
elemtostoretooltiptimer.data("openTimeoutId", setTimeout(function() {
elemtostoretooltiptimer.data("openTimeoutId", setTimeout(function() {
target.tooltip("close");
$.ajax({
url:"'. DOL_URL_ROOT.'/core/ajax/ajaxtooltip.php",
type: "post",
async: true,
data: params,
success: function(response){
// Setting content option
console.log("ajax success");
if (elemfortooltip.is(":hover")) {
elemfortooltip.tooltip("option","content",response);
elemfortooltip.tooltip("open");
}
url:"'. DOL_URL_ROOT.'/core/ajax/ajaxtooltip.php",
type: "post",
async: true,
data: params,
success: function(response){
// Setting content option
console.log("ajax success");
if (elemfortooltip.is(":hover")) {
elemfortooltip.tooltip("option","content",response);
elemfortooltip.tooltip("open");
}
});
}, opendelay));
}
});
}, opendelay));
});
target.on("mouseout", function(event) {
console.log("mouse out of a .classforajaxtooltip");
@ -346,9 +348,9 @@ print '
var currenttoken = jQuery("meta[name=anti-csrf-currenttoken]").attr("content");
console.log("We click on a cssforclicktodial class with href="+this.href);
$.ajax({
url: this.href,
type: \'GET\',
data: { token: currenttoken }
url: this.href,
type: \'GET\',
data: { token: currenttoken }
}).done(function(xhr, textStatus, errorThrown) {
/* do nothing */
}).fail(function(xhr, textStatus, errorThrown) {

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -50,7 +51,9 @@ if (!defined('NOREQUIREAJAX')) {
session_cache_limiter('public');
require_once '../../main.inc.php';
/**
* @var int $dolibarr_nocache
*/
// Define javascript type
top_httphead('text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.

View File

@ -50,6 +50,8 @@ require_once '../../main.inc.php';
/**
* @var DoliDB $db
* @var Translate $langs
*
* @var int $dolibarr_nocache
*/
/*
* View

View File

@ -401,6 +401,7 @@ if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predel
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$head = [];
if ($mode == 'modulesetup') {
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("CronSetup"), $linkback, 'title_setup');
@ -422,8 +423,7 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
// Line with explanation and button new
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), $langs->trans('CronCreateJob'), 'fa fa-plus-circle', DOL_URL_ROOT.'/cron/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?mode=modulesetup'), '', $user->hasRight('cron', 'create'));
$newcardbutton = dolGetButtonTitle($langs->trans('New'), $langs->trans('CronCreateJob'), 'fa fa-plus-circle', DOL_URL_ROOT.'/cron/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?mode=modulesetup'), '', $user->hasRight('cron', 'create'));
if ($mode == 'modulesetup') {

View File

@ -350,6 +350,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$object->getRights();
$head = user_prepare_head($object);
$listLink = dol_buildpath('/user/list.php', 1);
} else {
$head = [];
}
print dol_get_fiche_head($head, 'skill_tab', $langs->trans("Workstation"), -1, $object->picto);

View File

@ -36,6 +36,7 @@ $langs->loadLangs(array("admin", "other", "modulebuilder"));
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$head = [];
if (!$user->admin || !isModEnabled('modulebuilder')) {
accessforbidden();

View File

@ -323,6 +323,7 @@ if ($action == 'fetch' && !empty($id)) {
$form = new Form($db);
}
$arrayresult = [];
if (empty($mode) || $mode == 1) { // mode=1: customer
$arrayresult = $form->select_produits_list("", $htmlname, $type, getDolGlobalInt('PRODUIT_LIMIT_SIZE', 1000), $price_level, $searchkey, $status, $finished, $outjson, $socid, '1', 0, '', $hidepriceinlabel, $warehouseStatus, $status_purchase, $warehouseId);
} elseif ($mode == 2) { // mode=2: supplier

View File

@ -1,8 +1,9 @@
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean Heimburger <http://tiaris.eu>
* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean Heimburger <http://tiaris.eu>
* 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
@ -48,7 +49,12 @@ require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
// After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file).
// $user is created but empty.
/**
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// $langs->setDefaultLang('en_US'); // To change default language of $langs
$langs->load("main"); // To load language file for default language

View File

@ -1,7 +1,8 @@
#!/usr/bin/env php
<?php
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean Heimburger <http://tiaris.eu>
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean Heimburger <http://tiaris.eu>
* 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
@ -48,7 +49,12 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/images.lib.php";
// After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file).
// $user is created but empty.
/**
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// $langs->setDefaultLang('en_US'); // To change default language of $langs
$langs->load("main"); // To load language file for default language

View File

@ -3,6 +3,7 @@
/*
* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean Heimburger <http://tiaris.eu>
* 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
@ -48,7 +49,12 @@ require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
// After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file).
// $user is created but empty.
/**
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// $langs->setDefaultLang('en_US'); // To change default language of $langs
$langs->load("main"); // To load language file for default language

View File

@ -55,6 +55,7 @@ require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php";
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Global variables

View File

@ -52,6 +52,7 @@ require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php";
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
$langs->loadLangs(array("main", "errors"));

View File

@ -55,6 +55,7 @@ require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php";
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Global variables

View File

@ -50,6 +50,7 @@ require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php";
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
$langs->loadLangs(array("main", "errors"));