fix phpstan (#32188)

* fix phpstan

* fix typos

* add phpdoc

* cut long line
This commit is contained in:
Frédéric FRANCE
2024-12-01 23:15:27 +01:00
committed by GitHub
parent e2f6c68063
commit 01297eeb86
21 changed files with 48 additions and 150 deletions

View File

@@ -15378,54 +15378,18 @@ parameters:
count: 1
path: ../../htdocs/core/modules/oauth/generic_oauthcallback.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/oauth/github_oauthcallback.php
-
message: '#^Variable \$state might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/oauth/github_oauthcallback.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/oauth/microsoft2_oauthcallback.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/oauth/microsoft_oauthcallback.php
-
message: '#^Strict comparison using \=\=\= between null and null will always evaluate to true\.$#'
identifier: identical.alwaysTrue
count: 2
path: ../../htdocs/core/modules/oauth/stripelive_oauthcallback.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/oauth/stripelive_oauthcallback.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/oauth/stripetest_oauthcallback.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/modules/openid_connect/callback.php
-
message: '#^Property mod_payment_cicada\:\:\$prefix has no type specified\.$#'
identifier: missingType.property
@@ -18360,12 +18324,6 @@ parameters:
count: 1
path: ../../htdocs/ecm/file_card.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/ecm/file_card.php
-
message: '#^Variable \$module might not be defined\.$#'
identifier: variable.undefined
@@ -18654,12 +18612,6 @@ parameters:
count: 1
path: ../../htdocs/eventorganization/conferenceorbooth_contact.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../htdocs/eventorganization/conferenceorbooth_contact.php
-
message: '#^Variable \$mode might not be defined\.$#'
identifier: variable.undefined
@@ -18690,12 +18642,6 @@ parameters:
count: 1
path: ../../htdocs/eventorganization/conferenceorbooth_document.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../htdocs/eventorganization/conferenceorbooth_document.php
-
message: '#^Comparison operation "\>" between 0 and 0 is always false\.$#'
identifier: greater.alwaysFalse
@@ -24126,24 +24072,6 @@ parameters:
count: 1
path: ../../htdocs/master.inc.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../htdocs/master.inc.php
-
message: '#^Variable \$dolibarr_main_url_root_alt might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/master.inc.php
-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../htdocs/master.inc.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
@@ -25236,12 +25164,6 @@ parameters:
count: 1
path: ../../htdocs/opensurvey/card.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/opensurvey/card.php
-
message: '#^Variable \$id might not be defined\.$#'
identifier: variable.undefined
@@ -25332,66 +25254,18 @@ parameters:
count: 1
path: ../../htdocs/opensurvey/class/opensurveysondage.class.php
-
message: '#^Empty array passed to foreach\.$#'
identifier: foreach.emptyArray
count: 1
path: ../../htdocs/opensurvey/list.php
-
message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
count: 1
path: ../../htdocs/opensurvey/list.php
-
message: '#^Variable \$nbuser might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/opensurvey/list.php
-
message: '#^Variable \$search_all might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/opensurvey/list.php
-
message: '#^Offset int\<0, max\> on array\<int\<0, max\>, int\<0, max\>\> in isset\(\) always exists and is not nullable\.$#'
identifier: isset.offset
count: 1
path: ../../htdocs/opensurvey/results.php
-
message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 1
path: ../../htdocs/opensurvey/results.php
-
message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 1
path: ../../htdocs/opensurvey/results.php
-
message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 1
path: ../../htdocs/opensurvey/results.php
-
message: '#^Variable \$cleinsertion might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../htdocs/opensurvey/results.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/opensurvey/results.php
-
message: '#^Variable \$erreur_ajout_date in isset\(\) always exists and is not nullable\.$#'
identifier: isset.variable
@@ -25440,12 +25314,6 @@ parameters:
count: 1
path: ../../htdocs/opensurvey/wizard/create_survey.php
-
message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/partnership/admin/website.php
-
message: '#^Left side of && is always false\.$#'
identifier: booleanAnd.leftAlwaysFalse

View File

@@ -704,7 +704,11 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
if (!empty($bookcalcalendars["calendars"])) {
foreach ($bookcalcalendars["calendars"] as $key => $value) {
$label = $value['label'];
$s .= '<div class="nowrap inline-block minheight30"><input '.(GETPOST('check_bookcal_calendar_'.$value['id']) ? "checked" : "").' type="checkbox" id="check_bookcal_calendar_'.$value['id'].'" name="check_bookcal_calendar_'.$value['id'].'" class="check_bookcal_calendar_'.$value['id'].'"><label for="check_bookcal_calendar_'.$value['id'].'" class="labelcalendar"> <span class="check_bookcal_calendar_'.$value['id'].'_text">'.$langs->trans("AgendaShowBookcalCalendar", $label).'</span></label> &nbsp; </div>';
$s .= '<div class="nowrap inline-block minheight30">';
$s .= '<input '.(GETPOST('check_bookcal_calendar_'.$value['id']) ? "checked" : "").' type="checkbox" id="check_bookcal_calendar_'.$value['id'].'" name="check_bookcal_calendar_'.$value['id'].'" class="check_bookcal_calendar_'.$value['id'].'">';
$s .= '<label for="check_bookcal_calendar_'.$value['id'].'" class="labelcalendar">';
$s .= '<span class="check_bookcal_calendar_'.$value['id'].'_text">'.$langs->trans("AgendaShowBookcalCalendar", $label).'</span>';
$s .= '</label> &nbsp; </div>';
}
}
}

View File

@@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/
use OAuth\Common\Storage\DoliStorage;
use OAuth\Common\Consumer\Credentials;

View File

@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/
use OAuth\Common\Storage\DoliStorage;

View File

@@ -47,7 +47,7 @@ require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/
use OAuth\Common\Storage\DoliStorage;

View File

@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/
use OAuth\Common\Storage\DoliStorage;

View File

@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/
use OAuth\Common\Storage\DoliStorage;

View File

@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/
use OAuth\Common\Storage\DoliStorage;

View File

@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_roott
* @var string $dolibarr_main_url_root
*/
use OAuth\Common\Storage\DoliStorage;

View File

@@ -30,7 +30,9 @@ if (!defined('NOTOKENRENEWAL')) {
require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
/**
* @var string $dolibarr_main_url_root
*/
// Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
$arrayofjs = array(
'/includes/jstz/jstz.min.js'.(empty($conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION)),

View File

@@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/
// Load translation files required by page

View File

@@ -43,6 +43,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/
// Load translation files required by the page

View File

@@ -45,6 +45,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/
// Load translation files required by the page

View File

@@ -44,6 +44,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/
// Load translation files required by the page

View File

@@ -46,6 +46,7 @@
* @var ?string $uploaddir
* @var string[] $toselect
* @var array<string,mixed> $parameters
* @var string $dolibarr_main_url_root
*/
// Protection
if (empty($objectclass) || empty($uploaddir)) {

View File

@@ -38,7 +38,12 @@
require_once 'filefunc.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/conf.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
/**
* @var Translate $langs
*
* @var string $dolibarr_main_url_root
* @var string $dolibarr_main_url_root_alt
*/
if (!function_exists('is_countable')) {
/**

View File

@@ -39,6 +39,8 @@ require_once DOL_DOCUMENT_ROOT."/opensurvey/lib/opensurvey.lib.php";
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/
// Security check

View File

@@ -48,8 +48,8 @@ $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'opensurveylist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$sall = trim(GETPOST('search_all', 'alphanohtml'));
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$search_all = trim(GETPOST('search_all', 'alphanohtml'));
$id = GETPOST('id', 'alpha');
$search_ref = GETPOST('search_ref', 'alpha');
@@ -94,12 +94,13 @@ if (!$user->hasRight('opensurvey', 'read')) {
// Definition of fields for list
$arrayfields = array();
foreach ($arrayfields as $key => $val) {
// TODO
/* foreach ($arrayfields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
$arrayfields['t.'.$key] = array('label' => $val['label'], 'checked' => (($val['visible'] < 0) ? 0 : 1), 'enabled' => $val['enabled'], 'position' => $val['position']);
}
}
} */
// Extra fields
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
@@ -249,7 +250,7 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist');
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if (/* !empty($contextpage) && */ $contextpage != $_SERVER["PHP_SELF"]) { // $contextpage can't be empty
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
@@ -303,7 +304,7 @@ $trackid = 'surv'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall) {
if ($search_all) {
// Ensure $fieldstosearchall is set and array
if (!isset($fieldstosearchall) || !is_array($fieldstosearchall)) {
$fieldstosearchall = array();
@@ -311,7 +312,7 @@ if ($sall) {
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);
}
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).implode(', ', $fieldstosearchall).'</div>';
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
}
$moreforfilter = '';
@@ -417,6 +418,7 @@ while ($i < min($num, $limit)) {
break; // Should not happen
}
$nbuser = 0;
$sql2 = 'select COUNT(*) as nb from '.MAIN_DB_PREFIX."opensurvey_user_studs where id_sondage='".$db->escape($obj->rowid)."'";
$resql2 = $db->query($sql2);
if ($resql2) {

View File

@@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT."/opensurvey/lib/opensurvey.lib.php";
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/
// Security check
@@ -191,7 +193,7 @@ if (GETPOSTISSET("ajoutercolonne") && $object->format == "D") {
if (GETPOSTISSET("nouveaujour") && GETPOST("nouveaujour") != "vide" &&
GETPOSTISSET("nouveaumois") && GETPOST("nouveaumois") != "vide" &&
GETPOSTISSET("nouvelleannee") && GETPOST("nouvelleannee") != "vide") {
$nouvelledate = dol_mktime(0, 0, 0, GETPOST("nouveaumois"), GETPOST("nouveaujour"), GETPOST("nouvelleannee"));
$nouvelledate = dol_mktime(0, 0, 0, GETPOSTINT("nouveaumois"), GETPOSTINT("nouveaujour"), GETPOSTINT("nouvelleannee"));
if (GETPOSTISSET("nouvelleheuredebut") && GETPOST("nouvelleheuredebut") != "vide") {
$nouvelledate .= "@";

View File

@@ -39,6 +39,8 @@ require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/
// Load translation files required by the page

View File

@@ -39,6 +39,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/
// Load translation files required by the page