mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Qual: Fix phpstan notices (int expected) (#31485)
# Qual: Fix phpstan notices (int expected) Fix several notices where int was expected (casting/phpdoc/GETPOSTINT). Separate phpstan exceptions for methods containing 'pdf' from other methods/functions.
This commit is contained in:
parent
8abfcf71a9
commit
0d2f1cf666
|
|
@ -1489,7 +1489,7 @@ class BOM extends CommonObject
|
|||
$reg = array();
|
||||
$qtyhourservice = 0;
|
||||
if (preg_match('/^(\d+)([a-z]+)$/', $defaultdurationofservice, $reg)) {
|
||||
$qtyhourservice = convertDurationtoHour((int) $reg[1], $reg[2]);
|
||||
$qtyhourservice = convertDurationtoHour((float) $reg[1], $reg[2]);
|
||||
}
|
||||
|
||||
if ($qtyhourservice) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -44,7 +45,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
|||
|
||||
$boxid = GETPOSTINT('boxid');
|
||||
$boxorder = GETPOST('boxorder');
|
||||
$zone = GETPOST('zone'); // Can be '0' or '1' or 'pagename'...
|
||||
$zone = GETPOST('zone'); // Can be key for zone
|
||||
if ($zone !== '') {
|
||||
$zone = (int) $zone;
|
||||
}
|
||||
$userid = GETPOSTINT('userid');
|
||||
|
||||
// Security check
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ abstract class CommonStickerGenerator extends CommonDocGenerator
|
|||
* Convert units (in to mm, mm to in)
|
||||
* $src and $dest must be 'in' or 'mm'
|
||||
*
|
||||
* @param int $value value
|
||||
* @param float $value value
|
||||
* @param string $src from ('in' or 'mm')
|
||||
* @param string $dest to ('in' or 'mm')
|
||||
* @return float value value after conversion
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ class InfoBox
|
|||
* Save order of boxes for area and user
|
||||
*
|
||||
* @param DoliDB $dbs Database handler
|
||||
* @param int $zone Name of area (0 for Homepage, ...)
|
||||
* @param int $zone Key of area (0 for Homepage, ...)
|
||||
* @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...'
|
||||
* @param int $userid Id of user
|
||||
* @return int Return integer <0 if KO, 0=Nothing done, > 0 if OK
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ function getServerTimeZoneInt($refgmtdate = 'now')
|
|||
* Add a delay to a date
|
||||
*
|
||||
* @param int $time Date timestamp (or string with format YYYY-MM-DD)
|
||||
* @param int $duration_value Value of delay to add
|
||||
* @param float $duration_value Value of delay to add
|
||||
* @param string $duration_unit Unit of added delay (d, m, y, w, h, i)
|
||||
* @param int $ruleforendofmonth Change the behavior of PHP over data-interval, 0 or 1
|
||||
* @return int New timestamp
|
||||
|
|
@ -128,16 +128,16 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforend
|
|||
return $time;
|
||||
}
|
||||
if ($duration_unit == 's') {
|
||||
return $time + ($duration_value);
|
||||
return $time + (int) ($duration_value);
|
||||
}
|
||||
if ($duration_unit == 'i') {
|
||||
return $time + (60 * $duration_value);
|
||||
return $time + (int) (60 * $duration_value);
|
||||
}
|
||||
if ($duration_unit == 'h') {
|
||||
return $time + (3600 * $duration_value);
|
||||
return $time + (int) (3600 * $duration_value);
|
||||
}
|
||||
if ($duration_unit == 'w') {
|
||||
return $time + (3600 * 24 * 7 * $duration_value);
|
||||
return $time + (int) (3600 * 24 * 7 * $duration_value);
|
||||
}
|
||||
|
||||
$deltastring = 'P';
|
||||
|
|
@ -327,9 +327,9 @@ function convertSecondToTime($iSecond, $format = 'all', $lengthOfDay = 86400, $l
|
|||
|
||||
/** Convert duration to hour
|
||||
*
|
||||
* @param int $duration_value Duration value
|
||||
* @param float $duration_value Duration value
|
||||
* @param string $duration_unit Duration unit
|
||||
* @return int $result
|
||||
* @return float $result
|
||||
*/
|
||||
function convertDurationtoHour($duration_value, $duration_unit)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1009,7 +1009,7 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0,
|
|||
* @param ?Societe $fromcompany Object company
|
||||
* @param int $marge_basse Margin bottom we use for the autobreak
|
||||
* @param int $marge_gauche Margin left (no more used)
|
||||
* @param int $page_hauteur Page height
|
||||
* @param float $page_hauteur Page height
|
||||
* @param CommonObject $object Object shown in PDF
|
||||
* @param int<0,3> $showdetails Show company address details into footer (0=Nothing, 1=Show address, 2=Show managers, 3=Both)
|
||||
* @param int $hidefreetext 1=Hide free text, 0=Show free text
|
||||
|
|
@ -1424,8 +1424,8 @@ function pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w,
|
|||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $w Width
|
||||
* @param int $h Height
|
||||
* @param int $posx Pos x
|
||||
* @param int $posy Pos y
|
||||
* @param float $posx Pos x
|
||||
* @param float $posy Pos y
|
||||
* @param int<0,1> $hideref Hide reference
|
||||
* @param int<0,1> $hidedesc Hide description
|
||||
* @param int<0,1> $issupplierline Is it a line for a supplier object ?
|
||||
|
|
@ -2542,9 +2542,9 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
|
|||
|
||||
$refListsTxt = '';
|
||||
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') {
|
||||
$refListsTxt.= $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending").' :';
|
||||
$refListsTxt .= $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending").' :';
|
||||
} else {
|
||||
$refListsTxt.=$outputlangs->transnoentities("RefSending").' :';
|
||||
$refListsTxt .= $outputlangs->transnoentities("RefSending").' :';
|
||||
}
|
||||
// We concat this record info into fields xxx_value. title is overwrote.
|
||||
foreach ($objects as $elementobject) {
|
||||
|
|
@ -2559,12 +2559,12 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
|
|||
}
|
||||
}
|
||||
}
|
||||
$refListsTxt.= (!empty($refListsTxt)?' ':'');
|
||||
$refListsTxt .= (!empty($refListsTxt) ? ' ' : '');
|
||||
if (! is_object($order)) {
|
||||
$refListsTxt.= $outputlangs->transnoentities($elementobject->ref);
|
||||
$refListsTxt .= $outputlangs->transnoentities($elementobject->ref);
|
||||
} else {
|
||||
$refListsTxt.= $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : '');
|
||||
$refListsTxt.= ' / '.$outputlangs->transnoentities($elementobject->ref);
|
||||
$refListsTxt .= $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : '');
|
||||
$refListsTxt .= ' / '.$outputlangs->transnoentities($elementobject->ref);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1003,7 +1003,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
$reg = [];
|
||||
$qtyhourservice = 0;
|
||||
if (preg_match('/^(\d+)([a-z]+)$/', $tmpproduct->duration, $reg)) {
|
||||
$qtyhourservice = convertDurationtoHour((int) $reg[1], (string) $reg[2]);
|
||||
$qtyhourservice = convertDurationtoHour((float) $reg[1], (string) $reg[2]);
|
||||
}
|
||||
$qtyhourforline = 0;
|
||||
if ($line->fk_unit) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* Copyright (C) 2019 Pierre Ardoin <mapiolca@me.com>
|
||||
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.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
|
||||
|
|
@ -332,7 +333,7 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr
|
|||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
//print $sql;
|
||||
$lastmodified="";
|
||||
$lastmodified = "";
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
|
|
|||
|
|
@ -83,12 +83,12 @@ class Task extends CommonObjectLine
|
|||
public $description;
|
||||
|
||||
/**
|
||||
* @var float|'' total of time spent on this task
|
||||
* @var int|'' total of time spent on this task (in seconds)
|
||||
*/
|
||||
public $duration_effective;
|
||||
|
||||
/**
|
||||
* @var float|'' planned workload
|
||||
* @var int|'' planned workload (in seconds)
|
||||
*/
|
||||
public $planned_workload;
|
||||
|
||||
|
|
|
|||
|
|
@ -82,11 +82,9 @@ parameters:
|
|||
- '#EvalMath::trigger\(\) expects string, int given#'
|
||||
- '# Diff::generatePartialDiff\(\) expects array#'
|
||||
- '# EmailCollector::getpart\(\) expects string#'
|
||||
- '#(?:convertSecondToTime) expects int, float\|string given#'
|
||||
- '#(?:Comm(?:(?:ande::updateline|on(?:Invoice::getLibStatut|StickerGenerator::(?:Set_Char_Size|_Croix|convertMetric)))\(\))|Facture(?:(?:::update|FournisseurRec::add)line\(\))|(?:Holiday::addLogCP|Loan::getLibStatut|SupplierProposal::updateline)\(\)|c(?:alcul_price_total|onvert(?:DurationtoHour|SecondToTime))|dol_time_plus_duree|pdf_(?:azur::_tableau_(?:(?:info|tot)\(\))|ban(?:::_tableau\(\)|k)|c(?:anelle::_tableau_(?:(?:tot|versements)\(\))|ornas::_tableau_(?:(?:info|tot)\(\))|rabe::_tableau_(?:(?:info|tot|versements)\(\))|yan::draw(?:(?:Info|Total)Table\(\)))|e(?:agle(?:(?:::_tableau_tot|_proforma::drawTotalTable)\(\))|instein::_tableau_(?:(?:info|tot)\(\))|ratosthene::draw(?:(?:Info|Total)Table\(\))|spadon::_tableau_tot\(\))|muscadet::_tableau_(?:(?:info|tot)\(\))|octopus::(?:_table(?:(?:FirstPage|au)\(\))|draw(?:(?:Info|Total)Table\(\)))|page(?:foot|head)|(?:rouget::_tableau_tot|s(?:epamandate::_tableau(?:_info)?|ponge::draw(?:(?:Info|Total)Table)|quille::_tableau_tot|t(?:andard_(?:e(?:(?:valuation|xpensereport)::_tableau|xpensereport::tablePayments)|(?:myobjec|supplierpaymen)t::_tableau|supplierpayment::_tableau_cheque)|orm::_tableau_info|rato::tabSignature))|t(?:cpdflabel::writeBarcode|yphon::_tableau_info)|vinci::_tableau_info)\(\)|w(?:atermark|rite(?:LinkedObjects|linedesc))|zenith::_tableau_tot\(\))|usleep) expects int, float given\.#'
|
||||
|
||||
- '#(?:(?:CommonStickerGenerator::_Croix|pdf_(?:azur::_tableau_(?:info|tot)|ban::_tableau))\(\)|pdf_(?:bank|c(?:anelle::_tableau_(?:(?:tot|versements)\(\))|ornas::_tableau_(?:(?:info|tot)\(\))|rabe::_tableau_(?:(?:info|tot|versements)\(\))|yan::draw(?:(?:Info|Total)Table\(\)))|e(?:agle(?:(?:::_tableau_tot|_proforma::drawTotalTable)\(\))|instein::_tableau_(?:(?:info|tot)\(\))|ratosthene::draw(?:(?:Info|Total)Table\(\))|spadon::_tableau_tot\(\))|muscadet::_tableau_(?:(?:info|tot)\(\))|octopus::(?:_table(?:(?:FirstPage|au)\(\))|draw(?:(?:Info|Total)Table\(\)))|page(?:foot|head)|(?:rouget::_tableau_tot|s(?:epamandate::_tableau(?:_info)?|ponge::draw(?:(?:Info|Total)Table)|quille::_tableau_tot|t(?:andard_(?:e(?:(?:valuation|xpensereport)::_tableau|xpensereport::tablePayments)|(?:myobjec|supplierpaymen)t::_tableau|supplierpayment::_tableau_cheque)|orm::_tableau_info|rato::tabSignature))|t(?:cpdflabel::writeBarcode|yphon::_tableau_info)|vinci::_tableau_info)\(\)|w(?:atermark|rite(?:LinkedObjects|linedesc))|zenith::_tableau_tot\(\))) expects int, float given\.#'
|
||||
- '#(?:Comm(?:(?:ande::updateline|on(?:Invoice::getLibStatut|StickerGenerator::Set_Char_Size))\(\))|Facture(?:(?:::update|FournisseurRec::add)line\(\))|(?:Holiday::addLogCP|Loan::getLibStatut|SupplierProposal::updateline)\(\)|calcul_price_total) expects int, float given\.#'
|
||||
- '#(?:dol_(?:mktime|remove_file_process)|fetchObjectByElement|print_actions_filter) expects int, array\|string given\.#'
|
||||
|
||||
- '# (CSMSFile) constructor expects int, array\|string given.#'
|
||||
- '#(?:ProductFournisseur::logPrice\(\)) expects float\|null#'
|
||||
- '#(?:(?:Asset::addDepreciationL|Facture(?:(?:(?:Fournisseur)?::add|Fournisseur::update)l))ine\(\)|calcul_price_total|dol_convertToWord|(?:loanCalcMonthlyPaymen|print_paypal_redirec)t) expects float, string given.#'
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2024 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -396,7 +397,7 @@ if ($resql) {
|
|||
}
|
||||
|
||||
if (getDolGlobalInt('MAILING_DELAY')) {
|
||||
usleep((float) getDolGlobalInt('MAILING_DELAY') * 1000000);
|
||||
usleep((int) ((float) getDolGlobalInt('MAILING_DELAY') * 1000000));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user