diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 4d4e78b6bef66..1d934ad7821a1 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -450,6 +450,7 @@ // 'PhanPluginUnknownArrayMethodReturnType', // Too many troubles to manage. Is enabled in config_extended only. // 'PhanUndeclaredGlobalVariable', // Helps identify variables that are not set/defined - add '@phan-var-force TYPE $varname' in tpl or includes to help type the variable // 'PhanPluginUnknownObjectMethodCall', // False positive for some class. Is enabled in config_extended only. + 'PhanTypeSuspiciousNonTraversableForeach', // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code. ], // You can put relative paths to internal stubs in this config option. // Phan will continue using its detailed type annotations, diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 8e6660856a74f..4510df6749049 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -109,7 +109,7 @@ public function __construct($db) * @param string $_dir Directory * @param string $number Number * @param Translate $outputlangs Lang output object - * @return int 1=ok, 0=ko + * @return int<-1,1> 1 if OK, <=0 if KO */ public function write_file($object, $_dir, $number, $outputlangs) { diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php index d75805a1174bf..b9cf4832fc24a 100644 --- a/htdocs/core/modules/cheque/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/modules_chequereceipts.php @@ -111,6 +111,19 @@ public static function liste_modeles($db, $maxfilenamelength = 0) return $list; } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Fonction to generate document on disk + * + * @param RemiseCheque $object Object RemiseCheque + * @param string $_dir Directory + * @param string $number Number + * @param Translate $outputlangs Lang output object + * @return int<-1,1> 1 if OK, <=0 if KO + */ + abstract public function write_file($object, $_dir, $number, $outputlangs); } @@ -155,7 +168,8 @@ function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs) // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charset_output = $outputlangs->charset_output; - if ($obj->write_file($id, $outputlangs) > 0) { + // TODO: write_file seems invalid, function is likely no longer used - delete ? + if ($obj->write_file($id, $outputlangs) > 0) { // @phan-suppress-current-line PhanParamTooFew $outputlangs->charset_output = $sav_charset_output; return 1; } else {