Skip to content

Commit

Permalink
Fix: Enable/fix PhanPluginPrintfIncompatibleArgumentTypeWeak occurences
Browse files Browse the repository at this point in the history
# Fix: Enable/fix PhanPluginPrintfIncompatibleArgumentTypeWeak occurences

Fix the PhanPluginPrintfIncompatibleArgumentTypeWeak occurences and fix the rule
  • Loading branch information
mdeweerd committed Mar 14, 2024
1 parent 7755e1e commit 0f8b9e7
Show file tree
Hide file tree
Showing 39 changed files with 82 additions and 47 deletions.
2 changes: 1 addition & 1 deletion dev/tools/phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@
'PhanTypeInvalidLeftOperandOfBitwiseOp',
// 'PhanTypeMismatchDimAssignment',
// 'PhanPluginDescriptionlessCommentOnProtectedMethod',
'PhanPluginPrintfIncompatibleArgumentTypeWeak',
// 'PhanPluginPrintfIncompatibleArgumentTypeWeak',
'PhanUndeclaredVariableAssignOp',
'PhanTypeExpectedObjectOrClassName',
'PhanEmptyFQSENInClasslike',
Expand Down
3 changes: 2 additions & 1 deletion htdocs/compta/bank/annuel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2004-2017 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2012 Regis Houssin <[email protected]>
* Copyright (C) 2013-2023 Charlene BENKE <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -205,7 +206,7 @@
print "<td>".dol_print_date(dol_mktime(1, 1, 1, $mois, 1, 2000), "%B")."</td>";

for ($annee = $year_start; $annee <= $year_end; $annee++) {
$case = sprintf("%04s-%02s", $annee, $mois);
$case = sprintf("%04d-%02d", $annee, $mois);

print '<td class="right" width="10%">&nbsp;';
if (isset($decaiss[$case]) && $decaiss[$case] > 0) {
Expand Down
5 changes: 3 additions & 2 deletions htdocs/compta/resultat/result.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2016-2022 Alexandre Spangaro <[email protected]>
* Copyright (C) 2018-2020 Laurent Destailleur <[email protected]>
* Copyright (C) 2018 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -260,12 +261,12 @@
print '<th class="liste_titre right">'.$langs->trans("SelectedPeriod").'</th>';
foreach ($months as $k => $v) {
if (($k + 1) >= $date_startmonth && $k < $date_endmonth) {
print '<th class="liste_titre right width50">'.$langs->trans('MonthShort'.sprintf("%02s", ($k + 1))).'</th>';
print '<th class="liste_titre right width50">'.$langs->trans('MonthShort'.sprintf("%02d", ($k + 1))).'</th>';
}
}
foreach ($months as $k => $v) {
if (($k + 1) < $date_startmonth) {
print '<th class="liste_titre right width50">'.$langs->trans('MonthShort'.sprintf("%02s", ($k + 1))).'</th>';
print '<th class="liste_titre right width50">'.$langs->trans('MonthShort'.sprintf("%02d", ($k + 1))).'</th>';
}
}
print '</tr>';
Expand Down
4 changes: 3 additions & 1 deletion htdocs/core/modules/asset/mod_asset_standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/* Copyright (C) 2005-2010 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2022-2024 Frédéric France <[email protected]>
* Copyright (C) 2022 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -156,7 +158,7 @@ public function getNextValue($object)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_asset_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/bom/mod_bom_standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2005-2010 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -148,7 +149,7 @@ public function getNextValue($objprod, $object)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_bom_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/cheque/mod_chequereceipt_mint.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2015 Juanjo Menent <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -145,7 +146,7 @@ public function getNextValue($objsoc, $object)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/commande/mod_commande_marbre.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2005-2010 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -160,7 +161,7 @@ public function getNextValue($objsoc, $object)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_commande_marbre::getNextValue return ".$this->prefix.$yymm."-".$num);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/contract/mod_contract_serpis.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2011 Juanjo Menent <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -29,7 +30,6 @@
*/
class mod_contract_serpis extends ModelNumRefContracts
{

// variables inherited from ModelNumRefContracts class
public $name = 'Serpis';
public $version = 'dolibarr';
Expand Down Expand Up @@ -145,7 +145,7 @@ public function getNextValue($objsoc, $contract)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_contract_serpis::getNextValue return ".$this->prefix.$yymm."-".$num);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/delivery/mod_delivery_jade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2004-2008 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2010 Regis Houssin <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -163,7 +164,7 @@ public function getNextValue($objsoc, $object)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_delivery_jade::getNextValue return ".$this->prefix.$yymm."-".$num);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/expedition/mod_expedition_safor.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2011 Juanjo Menent <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -151,7 +152,7 @@ public function getNextValue($objsoc, $shipment)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_expedition_safor::getNextValue return ".$this->prefix.$yymm."-".$num);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/expensereport/mod_expensereport_jade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2017 Maxime Kohlhaas <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -208,7 +209,7 @@ public function getNextValue($object)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_expensereport_jade::getNextValue return ".$this->prefix.$yymm."-".$num);
Expand Down
5 changes: 3 additions & 2 deletions htdocs/core/modules/facture/mod_facture_mars.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2005-2018 Regis Houssin <[email protected]>
* Copyright (C) 2013 Juanjo Menent <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -200,7 +201,7 @@ public function getNextValue($objsoc, $invoice, $mode = 'next')
if ($max >= (pow(10, 4) - 1)) {
$num = $max; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max);
$num = sprintf("%04d", $max);
}

$ref = '';
Expand Down Expand Up @@ -229,7 +230,7 @@ public function getNextValue($objsoc, $invoice, $mode = 'next')
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num);
Expand Down
5 changes: 3 additions & 2 deletions htdocs/core/modules/facture/mod_facture_terre.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2005-2008 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2015 Regis Houssin <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -240,7 +241,7 @@ public function getNextValue($objsoc, $invoice, $mode = 'next')
if ($max >= (pow(10, 4) - 1)) {
$num = $max; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max);
$num = sprintf("%04d", $max);
}

$ref = '';
Expand Down Expand Up @@ -268,7 +269,7 @@ public function getNextValue($objsoc, $invoice, $mode = 'next')
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/fichinter/mod_pacific.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2013 Juanjo Menent <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -156,7 +157,7 @@ public function getNextValue($objsoc = '', $object = '')
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

return $this->prefix.$yymm."-".$num;
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/holiday/mod_holiday_madonna.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2011 Juanjo Menent <[email protected]>
* Copyright (C) 2018-2023 Charlene Benke <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -30,7 +31,6 @@
*/
class mod_holiday_madonna extends ModelNumRefHolidays
{

// variables inherited from ModelNumRefHolidays class
public $name = 'Madonna';
public $version = 'dolibarr';
Expand Down Expand Up @@ -146,7 +146,7 @@ public function getNextValue($objsoc, $holiday)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_holiday_madonna::getNextValue return ".$this->prefix.$yymm."-".$num);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/hrm/mod_evaluation_standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2005-2010 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -156,7 +157,7 @@ public function getNextValue($object)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_evaluation_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/member/mod_member_advanced.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2021 Laurent Destailleur <[email protected]>
* Copyright (C) 2022-2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -31,7 +32,6 @@
*/
class mod_member_advanced extends ModeleNumRefMembers
{

// variables inherited from ModeleNumRefMembers class
public $name = 'Advanced';
public $version = 'dolibarr';
Expand Down Expand Up @@ -150,7 +150,7 @@ public function getNextValue($objsoc, $object)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_member_advanced::getNextValue return ".$this->prefix.$yymm."-".$num, LOG_INFO);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/mrp/mod_mo_standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2005-2010 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -148,7 +149,7 @@ public function getNextValue($objprod, $object)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_mo_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/payment/mod_payment_cicada.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2015 Juanjo Menent <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -154,7 +155,7 @@ public function getNextValue($objsoc, $object)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/product_batch/mod_lot_standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2021 Christophe Battarel <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -150,7 +151,7 @@ public function getNextValue($objsoc, $object)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1;
} else { // If counter > 9999, we do not format on 4 chars, we take number as it is
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_lot_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/product_batch/mod_sn_standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2021 Christophe Battarel <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -150,7 +151,7 @@ public function getNextValue($objsoc, $object)
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1;
} else { // If counter > 9999, we do not format on 4 chars, we take number as it is
$num = sprintf("%04s", $max + 1);
$num = sprintf("%04d", $max + 1);
}

dol_syslog("mod_sn_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
Expand Down
Loading

0 comments on commit 0f8b9e7

Please sign in to comment.