Skip to content

Commit

Permalink
Qual: Add abstract write_file to ModeleChequeReceipts
Browse files Browse the repository at this point in the history
And update phpdoc for derived classes
  • Loading branch information
mdeweerd committed Oct 14, 2024
1 parent 3281d26 commit 5f5df2f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions dev/tools/phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/cheque/doc/pdf_blochet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
16 changes: 15 additions & 1 deletion htdocs/core/modules/cheque/modules_chequereceipts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 5f5df2f

Please sign in to comment.