2
0
forked from Wavyzz/dolibarr

fix phpstan (#31177)

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan
This commit is contained in:
Frédéric FRANCE
2024-09-29 02:49:34 +02:00
committed by GitHub
parent a423da6a4b
commit 0e1292e253
9 changed files with 22 additions and 19 deletions

View File

@@ -176,7 +176,7 @@ class Adherent extends CommonObject
public $morphy;
/**
* @var int Info can be public
* @var int<0,1> Info can be public
*/
public $public;

View File

@@ -107,7 +107,9 @@ class AdherentType extends CommonObject
/** @var string Public note */
public $note_public;
/** @var integer Can vote */
/**
* @var int<0,1> Can vote
*/
public $vote;
/** @var string Email sent during validation of member */

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 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
@@ -276,7 +277,7 @@ $daylight = round($c - $b);
$val = ($a >= 0 ? '+' : '').$a;
$val .= ' ('.($a == 'unknown' ? 'unknown' : ($a >= 0 ? '+' : '').($a * 3600)).')';
$val .= ' &nbsp; &nbsp; &nbsp; '.getServerTimeZoneString();
$val .= ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '.((is_null($b) || is_null($c)) ? 'unknown' : ($a == $c ? yn($daylight) : yn(0).($daylight ? ' &nbsp; &nbsp; ('.$langs->trans('YesInSummer').')' : '')));
$val .= ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '.((is_null($b) || is_null($c)) ? 'unknown' : ($a == $c ? yn((int) $daylight) : yn(0).($daylight ? ' &nbsp; &nbsp; ('.$langs->trans('YesInSummer').')' : '')));
print $form->textwithtooltip($val, $txt, 2, 1, img_info(''));
print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now('gmt'), 'dayhour', 'tzserver').'</td></tr>'."\n";

View File

@@ -7693,7 +7693,7 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id
/**
* Return yes or no in current language
*
* @param string|int $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false')
* @param int<0, 1>|'yes'|'true'|'no'|'false' $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false')
* @param integer $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Yes/No
* @param int $color 0=texte only, 1=Text is formatted with a color font style ('ok' or 'error'), 2=Text is formatted with 'ok' color.
* @return string HTML string

View File

@@ -145,7 +145,7 @@ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator
if (getDolGlobalString('MAIN_BARCODE_CODE_ALWAYS_REQUIRED') && !empty($this->code_null)) {
$s .= '<strike>';
}
$s .= yn(!$this->code_null, 1, 2);
$s .= yn($this->code_null ? 0 : 1, 1, 2);
if (getDolGlobalString('MAIN_BARCODE_CODE_ALWAYS_REQUIRED') && !empty($this->code_null)) {
$s .= '</strike> '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
}
@@ -156,7 +156,7 @@ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator
if (getDolGlobalString('MAIN_BARCODE_CODE_ALWAYS_REQUIRED') && !empty($this->code_null)) {
$s .= '<strike>';
}
$s .= yn(!$this->code_null, 1, 2);
$s .= yn($this->code_null ? 0 : 1, 1, 2);
if (getDolGlobalString('MAIN_BARCODE_CODE_ALWAYS_REQUIRED') && !empty($this->code_null)) {
$s .= '</strike> '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
}
@@ -167,7 +167,7 @@ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator
if (getDolGlobalString('MAIN_BARCODE_CODE_ALWAYS_REQUIRED') && !empty($this->code_null)) {
$s .= '<strike>';
}
$s .= yn(!$this->code_null, 1, 2);
$s .= yn($this->code_null ? 0 : 1, 1, 2);
if (getDolGlobalString('MAIN_BARCODE_CODE_ALWAYS_REQUIRED') && !empty($this->code_null)) {
$s .= '</strike> '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
}

View File

@@ -108,7 +108,7 @@ abstract class ModeleNumRefMembers extends CommonNumRefGenerator
$s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';
$s .= $langs->trans("Required").': '.$strikestart;
$s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= yn($this->code_null ? 0 : 1, 1, 2).$strikeend;
$s .= '<br>';
$s .= $langs->trans("CanBeModifiedIfOk").': ';
$s .= yn($this->code_modifiable, 1, 2);

View File

@@ -154,15 +154,15 @@ abstract class ModeleProductCode extends CommonNumRefGenerator
$s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';
if ($type == 0) {
$s .= $langs->trans("RequiredIfProduct").': '.$strikestart;
$s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= yn($this->code_null ? 0 : 1, 1, 2).$strikeend;
$s .= '<br>';
} elseif ($type == 1) {
$s .= $langs->trans("RequiredIfService").': '.$strikestart;
$s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= yn($this->code_null ? 0 : 1, 1, 2).$strikeend;
$s .= '<br>';
} elseif ($type == -1) {
$s .= $langs->trans("Required").': '.$strikestart;
$s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= yn($this->code_null ? 0 : 1, 1, 2).$strikeend;
$s .= '<br>';
}
$s .= $langs->trans("CanBeModifiedIfOk").': ';

View File

@@ -174,15 +174,15 @@ abstract class ModeleThirdPartyCode extends CommonNumRefGenerator
$s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';
if ($type == 0) {
$s .= $langs->trans("RequiredIfCustomer").': '.$strikestart;
$s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= yn($this->code_null ? 0 : 1, 1, 2).$strikeend;
$s .= '<br>';
} elseif ($type == 1) {
$s .= $langs->trans("RequiredIfSupplier").': '.$strikestart;
$s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= yn($this->code_null ? 0 : 1, 1, 2).$strikeend;
$s .= '<br>';
} elseif ($type == -1) {
$s .= $langs->trans("Required").': '.$strikestart;
$s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= yn($this->code_null ? 0 : 1, 1, 2).$strikeend;
$s .= '<br>';
}
$s .= $langs->trans("CanBeModifiedIfOk").': ';

View File

@@ -72,7 +72,7 @@ parameters:
- '# (dol_print_date|correctExifImageOrientation) expects bool\|string#'
- '# (getRandomPassword|vatrate|DolEditor constructor) expects bool, int#'
- '# SMTPs::(getFrom|getErrorsTo|getReplyTo)\(\) expects bool, string given.#'
- '# (dolibarr_set_const|yn|getLocalTaxesFromRate) expects int\|string#'
- '# (dolibarr_set_const|getLocalTaxesFromRate) expects int\|string#'
- '#::(options)\(\) expects int\|string#'
- '# (print_barre_liste|dol_substr) expects int\|null#'
- '#(?:colorAdjustBrightness|imap_(?:(?:fetch)?body|fetchstructure)) expects int, string#'