2
0
forked from Wavyzz/dolibarr

Fix & enable PhanUndeclaredTypeReturnType

# Fix & enable PhanUndeclaredTypeReturnType

One typo, and replace 'number' with int or int|float
This commit is contained in:
MDW
2024-03-15 04:22:49 +01:00
parent 80e2e59373
commit 3384a0b847
6 changed files with 40 additions and 36 deletions

View File

@@ -14,6 +14,7 @@
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021-2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2023 Frédéric France <frederic.france@netlogic.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
@@ -113,7 +114,7 @@ function pdf_getFormat(Translate $outputlangs = null, $mode = 'setup')
}
//print "pdfformat=".$pdfformat." width=".$width." height=".$height." unit=".$unit;
return array('width'=>$width, 'height'=>$height, 'unit'=>$unit);
return array('width' => $width, 'height' => $height, 'unit' => $unit);
}
/**
@@ -309,7 +310,7 @@ function pdf_getPDFFontSize($outputlangs)
*
* @param string $logo Full path to logo file to use
* @param bool $url Image with url (true or false)
* @return number
* @return int|float
*/
function pdf_getHeightForLogo($logo, $url = false)
{
@@ -1219,7 +1220,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
// For customize footer
if (is_object($hookmanager)) {
$parameters = array('line1' => $line1, 'line2' => $line2, 'line3' => $line3, 'line4' => $line4, 'outputlangs'=>$outputlangs);
$parameters = array('line1' => $line1, 'line2' => $line2, 'line3' => $line3, 'line4' => $line4, 'outputlangs' => $outputlangs);
$action = '';
$hookmanager->executeHooks('pdf_pagefoot', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resPrint) && $hidefreetext == 0) {
@@ -1433,7 +1434,7 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('pdf'=>$pdf, 'i'=>$i, 'outputlangs'=>$outputlangs, 'w'=>$w, 'h'=>$h, 'posx'=>$posx, 'posy'=>$posy, 'hideref'=>$hideref, 'hidedesc'=>$hidedesc, 'issupplierline'=>$issupplierline, 'special_code'=>$special_code);
$parameters = array('pdf' => $pdf, 'i' => $i, 'outputlangs' => $outputlangs, 'w' => $w, 'h' => $h, 'posx' => $posx, 'posy' => $posy, 'hideref' => $hideref, 'hidedesc' => $hidedesc, 'issupplierline' => $issupplierline, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_writelinedesc', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -1572,7 +1573,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
$libelleproduitservice = dol_concatdesc(
dol_concatdesc($libelleproduitservice, " * ".$subprodval[3]),
(!empty($qtyText) ?
$outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText :
$outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1] * $qtyText :
$outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])
);
}
@@ -1581,7 +1582,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
$libelleproduitservice = dol_concatdesc(
dol_concatdesc($libelleproduitservice, " * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3]),
(!empty($qtyText) ?
$outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText :
$outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1] * $qtyText :
$outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])
);
}
@@ -1826,7 +1827,7 @@ function pdf_getlinenum($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlinenum', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$result .= $hookmanager->resPrint;
@@ -1859,7 +1860,7 @@ function pdf_getlineref($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineref', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$result .= $hookmanager->resPrint;
@@ -1891,7 +1892,7 @@ function pdf_getlineref_supplier($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineref_supplier', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$result .= $hookmanager->resPrint;
@@ -1923,7 +1924,7 @@ function pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlinevatrate', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -1990,7 +1991,7 @@ function pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineupexcltax', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -2033,7 +2034,7 @@ function pdf_getlineupwithtax($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineupwithtax', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -2070,7 +2071,7 @@ function pdf_getlineqty($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineqty', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -2110,7 +2111,7 @@ function pdf_getlineqty_asked($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineqty_asked', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -2150,7 +2151,7 @@ function pdf_getlineqty_shipped($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineqty_shipped', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -2190,7 +2191,7 @@ function pdf_getlineqty_keeptoship($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineqty_keeptoship', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -2275,7 +2276,7 @@ function pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineremisepercent', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -2372,7 +2373,7 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code, 'sign'=>$sign);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code, 'sign' => $sign);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlinetotalexcltax', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -2428,7 +2429,7 @@ function pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails = 0)
if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlinetotalwithtax', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -2588,7 +2589,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
// For add external linked objects
if (is_object($hookmanager)) {
$parameters = array('linkedobjects' => $linkedobjects, 'outputlangs'=>$outputlangs);
$parameters = array('linkedobjects' => $linkedobjects, 'outputlangs' => $outputlangs);
$action = '';
$hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resArray)) {
@@ -2625,7 +2626,7 @@ function pdf_getSizeForImage($realpath)
$height = $maxheight;
}
}
return array('width'=>$width, 'height'=>$height);
return array('width' => $width, 'height' => $height);
}
/**
@@ -2655,10 +2656,10 @@ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails =
}
$parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code
);
$action = '';