Skip to content

Commit

Permalink
Qual: Update phpdoc write_file for CommonStickerGenerator classes
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Aug 16, 2024
1 parent 0754d2c commit bb97f0d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 20 deletions.
13 changes: 7 additions & 6 deletions htdocs/core/class/commonstickergenerator.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,14 @@ public function __construct($db)
/**
* Function to build PDF on disk, then output on HTTP stream.
*
* @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $outputdir Output directory for pdf file
* @return int 1=OK, 0=KO
* @param Adherent|array<array{textleft:string,textheader:string,textfooter:string,textright:string,id:string,photo:string}> $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $outputdir Output directory for pdf file
* @param string $filename Short file name of output file
* @return int<-1,1> 1=OK, <=0=KO
*/
abstract public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = '');
abstract public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = '', $filename = '');
// phpcs:enable

/**
Expand Down
16 changes: 8 additions & 8 deletions htdocs/core/modules/member/doc/pdf_standard_member.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,15 @@ public function Add_PDF_card(&$pdf, $textleft, $header, $footer, $outputlangs, $

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build PDF on disk, then output on HTTP stream.
* Function to build PDF on disk, then output on HTTP stream.
*
* @param Adherent|array $object Member object. Old usage: Array of record information (array('textleft'=>,'textheader'=>, ...'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file. Example: '5161', 'AVERYC32010', 'CARD', ...
* @param string $mode Tell if doc module is called for 'member', ...
* @param int $nooutput 1=Generate only file on disk and do not return it on response
* @param string $filename Name of output file (without extension)
* @return int 1=OK, 0=KO
* @param Adherent|array<array{textleft:string,textheader:string,textfooter:string,textright:string,id:string,photo:string}> $object Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath file. Example: '5161', 'AVERYC32010', 'CARD', ...
* @param string $mode Tell if doc module is called
* @param int<0,1> $nooutput 1=Generate only file on disk and do not return it on response
* @param string $filename Name of output file (without extension)
* @return int<-1,1> 1=OK, <=0=KO
*/
public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'member', $nooutput = 0, $filename = 'tmp_cards')

Check warning on line 274 in htdocs/core/modules/member/doc/pdf_standard_member.class.php

View workflow job for this annotation

GitHub Actions / phan / Run phan

pdf_standard_member.class.php: PhanParamSignatureMismatch: Declaration of function write_file(\Adherent|array{textleft:string,textheader:string,textfooter:string,textright:string,id:string,photo:string}[] $object, \Translate $outputlangs, string $srctemplatepath, string $mode = 'member', int $nooutput = 0, string $filename = 'tmp_cards') : int should be compatible with function write_file(\Adherent|array{textleft:string,textheader:string,textfooter:string,textright:string,id:string,photo:string}[] $arrayofrecords, \Translate $outputlangs, string $srctemplatepath, string $outputdir = '', string $filename = '') : int defined in htdocs/core/class/commonstickergenerator.class.php:134 (Expected int $nooutput = 0 to have the same type as string $filename = '' or a supertype)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@ public function Add_PDF_label(&$pdf, $textleft, $header, $footer, $outputlangs,
/**
* Function to build PDF on disk, then output on HTTP stream.
*
* @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param array<array{textleft:string,textheader:string,textfooter:string,textright:string,id:string,photo:string}> $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $outputdir Output directory for pdf file
* @param string $filename Short file name of PDF output file
* @return int 1=OK, 0=KO
* @return int<-1,1> 1=OK, <=0=KO
*/
public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = '', $filename = 'tmp_address_sheet.pdf')
{
Expand Down Expand Up @@ -337,7 +337,7 @@ public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $out

dolChmod($file);

$this->result = array('fullpath'=>$file);
$this->result = array('fullpath' => $file);

return 1;
}
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,12 @@ public function addSticker(&$pdf, $outputlangs, $param)
/**
* Function to build PDF on disk, then output on HTTP stream.
*
* @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param array<array{textleft:string,textheader:string,textfooter:string,textright:string,id:string,photo:string}> $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $outputdir Output directory for pdf file
* @param string $filename Short file name of PDF output file
* @return int 1=OK, 0=KO
* @return int<-1,1> 1=OK, <=0=KO
*/
public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = '', $filename = 'tmp_address_sheet.pdf')
{
Expand Down Expand Up @@ -360,7 +360,7 @@ public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $out

dolChmod($file);

$this->result = array('fullpath'=>$file);
$this->result = array('fullpath' => $file);

return 1;
}
Expand Down
2 changes: 2 additions & 0 deletions htdocs/core/modules/printsheet/modules_labels.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp

$obj = new $classname($db);

'@phan-var-force CommonStickerGenerator $obj';

// 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;
Expand Down

0 comments on commit bb97f0d

Please sign in to comment.