fix phpstan

This commit is contained in:
Frédéric France
2024-12-03 21:17:10 +01:00
parent 69d6f5b60c
commit 1a4c9736b7
3 changed files with 15 additions and 55 deletions

View File

@@ -21582,48 +21582,6 @@ parameters:
count: 1
path: ../../htdocs/ftp/index.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 2
path: ../../htdocs/holiday/card.php
-
message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 8
path: ../../htdocs/holiday/card.php
-
message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 8
path: ../../htdocs/holiday/card.php
-
message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 8
path: ../../htdocs/holiday/card.php
-
message: '#^Variable \$canread might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/holiday/card.php
-
message: '#^Variable \$endhalfdaykey might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/holiday/card.php
-
message: '#^Variable \$starthalfdaykey might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/holiday/card.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse

View File

@@ -1148,8 +1148,10 @@ function GETPOSTFLOAT($paramname, $rounding = '')
* @param string $hourTime 'getpost' to include hour, minute, second values from the HTTP request,
* or 'XX:YY:ZZ' to set hour, minute, second respectively (for instance '23:59:59')
* or '' means '00:00:00' (default)
* @param string $gm Passed to dol_mktime
* @param int|string $gm Passed to dol_mktime
* @return int|string Date as a timestamp, '' or false if error
*
* @see dol_mktime()
*/
function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto')
{
@@ -3647,7 +3649,7 @@ function dol_getdate($timestamp, $fast = false, $forcetimezone = '')
* @param int $month Month (1 to 12)
* @param int $day Day (1 to 31)
* @param int $year Year
* @param mixed $gm True or 1 or 'gmt'=Input information are GMT values
* @param int|string $gm True or 1 or 'gmt'=Input information are GMT values
* False or 0 or 'tzserver' = local to server TZ
* 'auto'
* 'tzuser' = local to user TZ taking dst into account at the current date. Not yet implemented.

View File

@@ -169,10 +169,10 @@ if (empty($reshook)) {
$db->begin();
$date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'));
$date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'));
$date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1);
$date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1);
$date_debut = GETPOSTDATE('date_debut_', '00:00:00');
$date_fin = GETPOSTDATE('date_fin_', '00:00:00');
$date_debut_gmt = GETPOSTDATE('date_debut_', '00:00:00', 1);
$date_fin_gmt = GETPOSTDATE('date_fin_', '00:00:00', 1);
$starthalfday = GETPOST('starthalfday');
$endhalfday = GETPOST('endhalfday');
$type = GETPOST('type');
@@ -325,10 +325,10 @@ if (empty($reshook)) {
}
if ($action == 'update' && !GETPOSTISSET('savevalidator')) { // Test on permission done later
$date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'));
$date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'));
$date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1);
$date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1);
$date_debut = GETPOSTDATE('date_debut_', '00:00:00');
$date_fin = GETPOSTDATE('date_fin_', '00:00:00');
$date_debut_gmt = GETPOSTDATE('date_debut_', '00:00:00', 1);
$date_fin_gmt = GETPOSTDATE('date_fin_', '00:00:00', 1);
$starthalfday = GETPOST('starthalfday');
$endhalfday = GETPOST('endhalfday');
$halfday = 0;
@@ -1154,7 +1154,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
if (!GETPOST('date_debut_')) { // If visitor does not come from agenda
print $form->selectDate(-1, 'date_debut_', 0, 0, 0, '', 1, 1);
} else {
$tmpdate = dol_mktime(0, 0, 0, GETPOSTINT('date_debut_month'), GETPOSTINT('date_debut_day'), GETPOSTINT('date_debut_year'));
$tmpdate = GETPOSTDATE('date_debut_', '00:00:00');
print $form->selectDate($tmpdate, 'date_debut_', 0, 0, 0, '', 1, 1);
}
print ' &nbsp; &nbsp; ';
@@ -1171,7 +1171,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
if (!GETPOST('date_fin_')) {
print $form->selectDate(-1, 'date_fin_', 0, 0, 0, '', 1, 1);
} else {
$tmpdate = dol_mktime(0, 0, 0, GETPOSTINT('date_fin_month'), GETPOSTINT('date_fin_day'), GETPOSTINT('date_fin_year'));
$tmpdate = GETPOSTDATE('date_fin_', '00:00:00');
print $form->selectDate($tmpdate, 'date_fin_', 0, 0, 0, '', 1, 1);
}
print ' &nbsp; &nbsp; ';
@@ -1349,7 +1349,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
print $form->textwithpicto($langs->trans('DateDebCP'), $langs->trans("FirstDayOfHoliday"));
print '</td>';
print '<td>';
$tmpdate = dol_mktime(0, 0, 0, GETPOSTINT('date_debut_month'), GETPOSTINT('date_debut_day'), GETPOSTINT('date_debut_year'));
$tmpdate = GETPOSTDATE('date_debut_', '00:00:00');
print $form->selectDate($tmpdate ? $tmpdate : $object->date_debut, 'date_debut_');
print ' &nbsp; &nbsp; ';
print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday') ? GETPOST('starthalfday') : $starthalfday));