Skip to content

Commit

Permalink
add phpdoc and clean phpstan baseline (#31717)
Browse files Browse the repository at this point in the history
* add phpdoc and clean phpstan baseline

* add phpdoc and clean phpstan baseline

* add phpdoc and clean phpstan baseline

* add phpdoc and clean phpstan baseline

* add phpdoc and clean phpstan baseline

* add phpdoc and clean phpstan baseline

* add phpdoc and clean phpstan baseline

* add phpdoc and clean phpstan baseline

* add phpdoc and clean phpstan baseline

* add phpdoc and clean phpstan baseline

* add phpdoc and clean phpstan baseline

* add phpdoc

* add phpdoc

* add phpdoc
  • Loading branch information
frederic34 authored Nov 7, 2024
1 parent a1cc6b3 commit 41a4f42
Show file tree
Hide file tree
Showing 22 changed files with 155 additions and 2,067 deletions.
2,055 changes: 35 additions & 2,020 deletions build/phpstan/phpstan-baseline.neon

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion htdocs/accountancy/class/accountingjournal.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle
}
if ($withlabel == 2 && !empty($this->nature)) {
$key = $langs->trans("AccountingJournalType".$this->nature);
$transferlabel = ($this->nature && $key != "AccountingJournalType".strtoupper($langs->trans($this->nature)) ? $key : $this->label);
$transferlabel = ($key != "AccountingJournalType".strtoupper($langs->trans($this->nature)) ? $key : $this->label);
$label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$transferlabel.($nourl ? '</span>' : '');
}

Expand Down
6 changes: 3 additions & 3 deletions htdocs/accountancy/closure/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@
} else {
$buttonvalidate = '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=step_1&token='.newToken().'&fiscal_period_id=' . $current_fiscal_period['id'] . '">' . $langs->trans("ValidateMovements") . '</a>';
}
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonvalidate, '', 0, 1, 0);
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), 0, '', '', '', '', '', -1, '', '', 0, $buttonvalidate, '', 0, 1, 0);

print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
Expand Down Expand Up @@ -426,7 +426,7 @@
$button = '<a class="butActionRefused classfortooltip" href="#" title="There is some lines not yet locked. Feature disabled.">' . $langs->trans("AccountancyClosureClose") . '</a>';
}
}
print_barre_liste('', '', '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0);
print_barre_liste('', 0, '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0);

print '<br>';

Expand All @@ -444,7 +444,7 @@
} else {
$button = '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=step_3&token='.newToken().'&fiscal_period_id=' . $current_fiscal_period['id'] . '">' . $langs->trans("AccountancyClosureAccountingReversal") . '</a>';
}
print_barre_liste('', '', '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0);
print_barre_liste('', 0, '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0);
}

// End of page
Expand Down
6 changes: 3 additions & 3 deletions htdocs/accountancy/customer/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@

$buttonbind = '<a class="button small" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'&year='.$year_current.'">'.img_picto($langs->trans("ValidateHistory"), 'link', 'class="pictofixedwidth fa-color-unset"').$langs->trans("ValidateHistory").'</a>';

print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1, 0, $buttonbind);
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), 0, '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1, 0, $buttonbind);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');

print '<div class="div-table-responsive-no-min">';
Expand Down Expand Up @@ -461,7 +461,7 @@
print '<br>';


print_barre_liste(img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
print_barre_liste(img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesBound"), 0, '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');

print '<div class="div-table-responsive-no-min">';
Expand Down Expand Up @@ -582,7 +582,7 @@
print '<br>';
print '<br>';

print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
print_barre_liste($langs->trans("OtherInfo"), 0, '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');

print '<div class="div-table-responsive-no-min">';
Expand Down
6 changes: 3 additions & 3 deletions htdocs/accountancy/expensereport/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
$buttonbind = '<a class="button small" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'&year='.$year_current.'">'.img_picto($langs->trans("ValidateHistory"), 'link', 'class="pictofixedwidth fa-color-unset"').$langs->trans("ValidateHistory").'</a>';


print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1, 0, $buttonbind);
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), 0, '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1, 0, $buttonbind);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');

print '<div class="div-table-responsive-no-min">';
Expand Down Expand Up @@ -334,7 +334,7 @@
print '<br>';


print_barre_liste(img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
print_barre_liste(img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesBound"), 0, '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');


Expand Down Expand Up @@ -420,7 +420,7 @@
print '<br>';
print '<br>';

print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
print_barre_liste($langs->trans("OtherInfo"), 0, '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');

print '<div class="div-table-responsive-no-min">';
Expand Down
6 changes: 3 additions & 3 deletions htdocs/accountancy/supplier/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
$buttonbind = '<a class="button small" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'&year='.$year_current.'">'.img_picto($langs->trans("ValidateHistory"), 'link', 'class="pictofixedwidth fa-color-unset"').$langs->trans("ValidateHistory").'</a>';


print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1, 0, $buttonbind);
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), 0, '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1, 0, $buttonbind);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');

print '<div class="div-table-responsive-no-min">';
Expand Down Expand Up @@ -447,7 +447,7 @@
print '<br>';


print_barre_liste(img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
print_barre_liste(img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesBound"), 0, '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');

print '<div class="div-table-responsive-no-min">';
Expand Down Expand Up @@ -559,7 +559,7 @@
print '<br>';
print '<br>';

print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
print_barre_liste($langs->trans("OtherInfo"), 0, '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');

print '<div class="div-table-responsive-no-min">';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/fediverse.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@

$title = $langs->trans("ConfigImportSocialNetwork");

print_barre_liste($title, '', $_SERVER["PHP_SELF"], '', '', '', '', -1, '', 'tools', 0, '', '', -1, 0, 0, 0, '');
print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', '', '', '', -1, '', 'tools', 0, '', '', -1, 0, 0, 0, '');


print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
Expand Down
11 changes: 8 additions & 3 deletions htdocs/asset/tpl/accountancy_codes_edit.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@
* $parameters
*/

/**
* @var DoliDB $db
* @var Form $form
* @var FormAccounting $formaccounting
* @var HookManager $hookmanager
* @var Translate $langs
*/

// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit(1);
}
/**
* @var HookManager $hookmanager
*/

if (!is_object($form)) {
$form = new Form($db);
Expand Down
12 changes: 8 additions & 4 deletions htdocs/asset/tpl/accountancy_codes_view.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@
* $parameters
*/

/**
* @var Conf $conf
* @var DoliDB $db
* @var Form $form
* @var HookManager $hookmanager
* @var Translate $langs
*/

// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit(1);
}
/**
* @var HookManager $hookmanager
*/


if (!is_object($form)) {
$form = new Form($db);
Expand Down
10 changes: 6 additions & 4 deletions htdocs/asset/tpl/depreciation_options_edit.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@
* $parameters
*/

/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
*/

// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit(1);
}

/**
* @var HookManager $hookmanager
*/

if (!is_object($form)) {
$form = new Form($db);
}
Expand Down
7 changes: 3 additions & 4 deletions htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -5324,7 +5324,7 @@ public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateS
* @param Societe $seller Object of seller third party
* @param Societe $buyer Object of buyer third party
* @param int $selected ID line selected
* @param ?Extrafields $extrafields Object of extrafields
* @param ?ExtraFields $extrafields Object of extrafields
* @param string $defaulttpldir Directory where to find the template (deprecated)
* @return void
*/
Expand Down Expand Up @@ -7873,7 +7873,6 @@ function handlemultiinputdisabling(htmlname){
$sqlwhere .= " AND entity = " . ((int) $conf->entity);
}
$sql .= $sqlwhere;
//print $sql;

// Note: $InfoFieldList can be 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:CategoryIdType[:CategoryIdList[:Sortfield]]]]]]'
if (isset($InfoFieldList[7]) && preg_match('/^[a-z0-9_\-,]+$/i', $InfoFieldList[7])) {
Expand Down Expand Up @@ -9085,7 +9084,7 @@ public function validateField($fields, $fieldKey, $fieldValue)
* Function to show lines of extrafields with output data.
* This function is responsible to output the <tr> and <td> according to correct number of columns received into $params['colspan'] or <div> according to $display_type
*
* @param Extrafields $extrafields Extrafield Object
* @param ExtraFields $extrafields Extrafield Object
* @param string $mode Show output ('view') or input ('create' or 'edit') for extrafield
* @param array<string,mixed> $params Optional parameters. Example: array('style'=>'class="oddeven"', 'colspan'=>$colspan)
* @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names)
Expand Down Expand Up @@ -9383,7 +9382,7 @@ public function showOptionals($extrafields, $mode = 'view', $params = null, $key
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], $listoftypestoshowpicto)) {
$out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : ''));
}
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element);
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', '', $this->id, $this->table_element);
break;
}

Expand Down
30 changes: 15 additions & 15 deletions htdocs/core/lib/pdf.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t
*
* @param TCPDF $pdf Object PDF
* @param Translate $outputlangs Object lang for output
* @param int $page_height Height of page
* @param float $page_height Height of page
* @return void
*/
function pdf_pagehead(&$pdf, $outputlangs, $page_height)
Expand All @@ -736,9 +736,9 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height)
if (file_exists($filepath)) {
$pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image
if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) {
$pdf->SetAlpha($conf->global->MAIN_USE_BACKGROUND_ON_PDF_ALPHA);
$pdf->SetAlpha(getDolGlobalFloat('MAIN_USE_BACKGROUND_ON_PDF_ALPHA'));
} // Option for change opacity of background
$pdf->Image($filepath, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height);
$pdf->Image($filepath, getDolGlobalFloat('MAIN_USE_BACKGROUND_ON_PDF_X'), getDolGlobalFloat('MAIN_USE_BACKGROUND_ON_PDF_Y'), 0, $page_height);
if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) {
$pdf->SetAlpha(1);
}
Expand Down Expand Up @@ -776,8 +776,8 @@ function pdf_getSubstitutionArray($outputlangs, $exclude = null, $object = null,
*
* @param TCPDF $pdf Object PDF
* @param Translate $outputlangs Object lang
* @param int $h Height of PDF
* @param int $w Width of PDF
* @param float $h Height of PDF
* @param float $w Width of PDF
* @param string $unit Unit of height (mm, pt, ...)
* @param string $text Text to show
* @return void
Expand Down Expand Up @@ -815,17 +815,17 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
$pdf->SetFont('', 'B', 40);
$pdf->SetTextColor(255, 0, 0);

//rotate
// rotate
$pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm', cos($watermark_angle), sin($watermark_angle), -sin($watermark_angle), cos($watermark_angle), $watermark_x * $k, ($h - $watermark_y) * $k, -$watermark_x * $k, -($h - $watermark_y) * $k));
//print watermark
// print watermark
$pdf->SetAlpha(0.5);
$pdf->SetXY($watermark_x_pos, $watermark_y_pos);

// set alpha to semi-transparency
$pdf->SetAlpha(0.3);
$pdf->Cell($w - 20, 25, $outputlangs->convToOutputCharset($text), "", 2, "C", 0);

//antirotate
// antirotate
$pdf->_out('Q');

$pdf->SetXY($savx, $savy);
Expand All @@ -840,8 +840,8 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
*
* @param TCPDF $pdf Object PDF
* @param Translate $outputlangs Object lang
* @param int $curx X
* @param int $cury Y
* @param float $curx X
* @param float $cury Y
* @param Account $account Bank account object
* @param int $onlynumber Output only number (bank+desk+key+number according to country, but without name of bank and address)
* @param int $default_font_size Default font size
Expand Down Expand Up @@ -1014,13 +1014,13 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0,
* @param Translate $outputlangs Object lang for output
* @param string $paramfreetext Constant name of free text
* @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 float $marge_basse Margin bottom we use for the autobreak
* @param float $marge_gauche Margin left (no more used)
* @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
* @param int $page_largeur Page width
* @param float $page_largeur Page width
* @param string $watermark Watermark text to print on page
* @return int Return height of bottom margin including footer text
*/
Expand Down Expand Up @@ -1394,8 +1394,8 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
* @param TCPDF $pdf Object PDF
* @param CommonObject $object Object
* @param Translate $outputlangs Object lang
* @param int $posx X
* @param int $posy Y
* @param float $posx X
* @param float $posy Y
* @param float $w Width of cells. If 0, they extend up to the right margin of the page.
* @param float $h Cell minimum height. The cell extends automatically if needed.
* @param string $align Align
Expand Down
12 changes: 12 additions & 0 deletions htdocs/core/tpl/extrafields_add.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
* $parameters
*/

/**
* @var CommonObject $object
* @var Conf $conf
* @var DoliDB $db
* @var ExtraFields $extrafields
* @var Translate $langs
*
* @var Societe $thirdpartytopropagateextrafieldsfrom
* @var string $action
* @var array<string,mixed> $parameters
*/

// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
Expand Down
8 changes: 8 additions & 0 deletions htdocs/core/tpl/extrafields_edit.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
* $parameters
*/

/**
* @var CommonObject $object
* @var Conf $conf
* @var Translate $langs
* @var string $action
* @var array<string,mixed> $parameters
*/

// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/tpl/login.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* @var User $user
*
* @var string $captcha
* @var string $message
*
* @var int<0,1> $dol_hide_leftmenu
* @var int<0,1> $dol_hide_topmenu
Expand Down Expand Up @@ -497,6 +496,7 @@


<?php
$message = '';
// Show error message if defined
if (!empty($_SESSION['dol_loginmesg'])) {
$message = $_SESSION['dol_loginmesg']; // By default this is an error message
Expand Down
2 changes: 1 addition & 1 deletion htdocs/modulebuilder/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4950,7 +4950,7 @@ function cleanString( stringtoclean )


$newdict = dolGetButtonTitle($langs->trans('NewDictionary'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.urlencode($module).'&tabdic=newdictionary');
print_barre_liste($langs->trans("ListOfDictionariesEntries"), '', $_SERVER["PHP_SELF"], '', '', '', '', 0, '', '', 0, $newdict, '', 0, 0, 0, 1);
print_barre_liste($langs->trans("ListOfDictionariesEntries"), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', '', 0, $newdict, '', 0, 0, 0, 1);

if ($tabdic != 'newdictionary') {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
Expand Down
Loading

0 comments on commit 41a4f42

Please sign in to comment.