Merge pull request #32925 from frederic34/2025-02-03-fix_phpstan

fix phpstan
This commit is contained in:
Laurent Destailleur 2025-02-05 03:01:14 +01:00 committed by GitHub
commit f39f05889a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 148 additions and 133 deletions

View File

@ -8034,12 +8034,6 @@ parameters:
count: 1
path: ../../../htdocs/core/ajax/ajaxdirpreview.php
-
message: '#^Variable \$module might not be defined\.$#'
identifier: variable.undefined
count: 34
path: ../../../htdocs/core/ajax/ajaxdirpreview.php
-
message: '#^Variable \$section might not be defined\.$#'
identifier: variable.undefined
@ -14634,36 +14628,12 @@ parameters:
count: 1
path: ../../../htdocs/core/tpl/bloc_showhide.tpl.php
-
message: '#^Variable \$action might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/card_presend.tpl.php
-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 12
path: ../../../htdocs/core/tpl/card_presend.tpl.php
-
message: '#^Variable \$hidedetails might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/card_presend.tpl.php
-
message: '#^Variable \$hookmanager might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/card_presend.tpl.php
-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 6
path: ../../../htdocs/core/tpl/card_presend.tpl.php
-
message: '#^Variable \$modelmail might not be defined\.$#'
identifier: variable.undefined
@ -14682,18 +14652,6 @@ parameters:
count: 2
path: ../../../htdocs/core/tpl/card_presend.tpl.php
-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/commonfields_edit.tpl.php
-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/commonfields_view.tpl.php
-
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -14706,30 +14664,12 @@ parameters:
count: 1
path: ../../../htdocs/core/tpl/contacts.tpl.php
-
message: '#^Variable \$action might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/contacts.tpl.php
-
message: '#^Variable \$conf might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/contacts.tpl.php
-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 4
path: ../../../htdocs/core/tpl/contacts.tpl.php
-
message: '#^Variable \$hookmanager might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/contacts.tpl.php
-
message: '#^Variable \$action might not be defined\.$#'
identifier: variable.undefined
@ -14814,12 +14754,6 @@ parameters:
count: 2
path: ../../../htdocs/core/tpl/extrafields_list_print_fields.tpl.php
-
message: '#^Variable \$object might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/extrafields_list_search_input.tpl.php
-
message: '#^Variable \$extrafields might not be defined\.$#'
identifier: variable.undefined
@ -14832,12 +14766,6 @@ parameters:
count: 2
path: ../../../htdocs/core/tpl/extrafields_list_search_param.tpl.php
-
message: '#^Variable \$object might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/extrafields_list_search_param.tpl.php
-
message: '#^Variable \$param might not be defined\.$#'
identifier: variable.undefined
@ -14856,30 +14784,12 @@ parameters:
count: 1
path: ../../../htdocs/core/tpl/extrafields_list_search_sql.tpl.php
-
message: '#^Variable \$object might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/extrafields_list_search_sql.tpl.php
-
message: '#^Variable \$sql might not be defined\.$#'
identifier: variable.undefined
count: 7
path: ../../../htdocs/core/tpl/extrafields_list_search_sql.tpl.php
-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/extrafields_list_search_title.tpl.php
-
message: '#^Variable \$object might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/extrafields_list_search_title.tpl.php
-
message: '#^Variable \$param might not be defined\.$#'
identifier: variable.undefined
@ -14970,12 +14880,6 @@ parameters:
count: 2
path: ../../../htdocs/core/tpl/formlayoutai.tpl.php
-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/list_print_subtotal.tpl.php
-
message: '#^Variable \$limit might not be defined\.$#'
identifier: variable.undefined
@ -30114,18 +30018,6 @@ parameters:
count: 7
path: ../../../htdocs/user/card.php
-
message: '#^Variable \$dolibarr_main_authentication might not be defined\.$#'
identifier: variable.undefined
count: 12
path: ../../../htdocs/user/card.php
-
message: '#^Variable \$formproduct might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/user/card.php
-
message: '#^Variable \$mc might not be defined\.$#'
identifier: variable.undefined

View File

@ -1,12 +1,12 @@
<?php
/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010 Pierre Morin <pierre.morin@auguria.net>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010 Pierre Morin <pierre.morin@auguria.net>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -49,7 +49,7 @@ if (!defined('NOREQUIREAJAX')) {
* @var Translate $langs
* @var User $user
*/
$module = '';
if (!isset($mode) || $mode != 'noajax') { // For ajax call
require_once '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

View File

@ -37,7 +37,12 @@
* @var string $defaulttopiclang
* @var string[] $arrayoffamiliestoexclude
* @var string $file
* @var string $action
* @var CommonObject $object
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
*/
'
@phan-var-force int<0,1> $diroutput

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2017-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
/* Copyright (C) 2017-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -27,6 +27,7 @@
/**
* @var CommonObject $object
* @var Conf $conf
* @var DoliDB $db
* @var Form $form
* @var FormAdmin $formadmin
* @var Translate $langs

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -28,6 +28,7 @@
/**
* @var CommonObject $object
* @var Conf $conf
* @var DoliDB $db
* @var Form $form
* @var FormAdmin $formadmin
* @var Translate $langs

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015-2016 Charlie BENKE <charlie@patas-monkey.com>
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -27,7 +27,9 @@
/**
* @var ?CommonObject $object
* @var ?CommonObject $objectsrc
* @var DoliDB $db
* @var Form $form
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
* @var ?string $permission

View File

@ -1,5 +1,28 @@
<?php
/* Copyright (C) 2025 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* @var Conf $conf
* @var DoliDB $db
* @var CommonObject $object
*/
print '<!-- extrafields_list_search_input.tpl.php -->'."\n";
// Protection to avoid direct call of template

View File

@ -1,5 +1,27 @@
<?php
/* Copyright (C) 2025 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* @var Conf $conf
* @var CommonObject $object
*/
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";

View File

@ -1,5 +1,27 @@
<?php
/* Copyright (C) 2025 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* @var Conf $conf
* @var CommonObject $object
*/
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";

View File

@ -1,6 +1,27 @@
<?php
/* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* @var Conf $conf
* @var CommonObject $object
* @var ?Translate $langs
*/
// Protection to avoid direct call of template

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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

View File

@ -1,4 +1,25 @@
<?php
/* Copyright (C) 2025 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* @var Translate $langs
* @var array{nbfield:int,pos?:array<int,int>,val?:array<int,float>} $totalarray
*/
'@phan-var-force array{nbfield:int,pos?:array<int,int>,val?:array<int,float>} $totalarray';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2020 Laurent Destailleur <eldy@destailleur.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -19,12 +19,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @var CommonObject $object
* @var ?CommonObject $object
* @var Form $form
* @var Translate $langs
* @var User $user
*
* @var int $permissionnote
* @var ?int<0,1> $permissionnote
* @var string $moreparam
* @var ?int $colwidth
* @var string $cssclass
*/
// Protection to avoid direct call of template

View File

@ -13,7 +13,7 @@
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2015-2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018 David Beniamine <David.Beniamine@Tetras-Libre.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
@ -70,17 +70,19 @@ if (isModEnabled('stock')) {
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_authentication
*/
// Load translation files required by page
$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm', 'stocks', 'other'));
$id = GETPOSTINT('id');
$action = GETPOST('action', 'aZ09');
$action = GETPOST('action', 'aZ09');
$mode = GETPOST('mode', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$group = GETPOSTINT("group", 3);
$cancel = GETPOST('cancel', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'useracard'; // To manage different context of search
if (empty($id) && $action != 'add' && $action != 'create') {
@ -876,6 +878,7 @@ $formother = new FormOther($db);
$formcompany = new FormCompany($db);
$formadmin = new FormAdmin($db);
$formfile = new FormFile($db);
$formproduct = null;
if (isModEnabled('stock')) {
$formproduct = new FormProduct($db);
}