summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2023-03-19 09:31:58 +0000
committerGreg Roach <greg@subaqua.co.uk>2023-03-20 09:16:24 +0000
commitf315390b2ef3b402a974292b894bb8d92201eb00 (patch)
treeda5ca3c621d5f18f1f6f884563a98828298458c5
parent171dbd7b39bf37d973a0482fdaec046e02e85694 (diff)
downloadwebtrees-f315390b2ef3b402a974292b894bb8d92201eb00.tar.gz
webtrees-f315390b2ef3b402a974292b894bb8d92201eb00.tar.bz2
webtrees-f315390b2ef3b402a974292b894bb8d92201eb00.zip
Fix phpstan issues in reports
-rw-r--r--app/Report/AbstractRenderer.php18
-rw-r--r--app/Report/HtmlRenderer.php14
-rw-r--r--app/Report/PdfRenderer.php21
-rw-r--r--app/Report/ReportBaseCell.php24
-rw-r--r--app/Report/ReportParserBase.php2
-rw-r--r--app/Report/ReportParserGenerate.php133
-rw-r--r--app/Report/ReportPdfCell.php4
-rw-r--r--app/Report/TcpdfWrapper.php8
-rw-r--r--phpstan-baseline.php112
9 files changed, 101 insertions, 235 deletions
diff --git a/app/Report/AbstractRenderer.php b/app/Report/AbstractRenderer.php
index 43eaf7630d..6de747ddad 100644
--- a/app/Report/AbstractRenderer.php
+++ b/app/Report/AbstractRenderer.php
@@ -72,7 +72,7 @@ abstract class AbstractRenderer
/** @var float Width of page format in points */
public float $page_width = 0.0;
- /** @var array<array<string,string>> An array of the Styles elements found in the document */
+ /** @var array<array{'name': string, 'font': string, 'style': string, 'size': float}> Styles elements found in the document */
public array $styles = [];
/** @var string The default Report font name */
@@ -187,9 +187,9 @@ abstract class AbstractRenderer
* @param string $bgcolor Background color code
* @param string $style The name of the text style
* @param int $ln Indicates where the current position should go after the call
- * @param mixed $top Y-position
- * @param mixed $left X-position
- * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 1
+ * @param float $top Y-position
+ * @param float $left X-position
+ * @param bool $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 1
* @param int $stretch Stretch character mode
* @param string $bocolor Border color
* @param string $tcolor Text color
@@ -205,9 +205,9 @@ abstract class AbstractRenderer
string $bgcolor,
string $style,
int $ln,
- $top,
- $left,
- int $fill,
+ float $top,
+ float $left,
+ bool $fill,
int $stretch,
string $bocolor,
string $tcolor,
@@ -375,7 +375,7 @@ abstract class AbstractRenderer
/**
* Add Style to Styles array
*
- * @param array<string> $style
+ * @param array{'name': string, 'font': string, 'style': string, 'size': float} $style
*
* @return void
*/
@@ -389,7 +389,7 @@ abstract class AbstractRenderer
*
* @param string $s Style name
*
- * @return array<string>
+ * @return array{'name': string, 'font': string, 'style': string, 'size': float}
*/
public function getStyle(string $s): array
{
diff --git a/app/Report/HtmlRenderer.php b/app/Report/HtmlRenderer.php
index 8998ef7c7e..5b68e1ea9e 100644
--- a/app/Report/HtmlRenderer.php
+++ b/app/Report/HtmlRenderer.php
@@ -111,7 +111,7 @@ class HtmlRenderer extends AbstractRenderer
if ($this->show_generated_by) {
// The default style name for Generated by.... is 'genby'
- $element = new ReportHtmlCell(0.0, 10.0, '', 'C', '', 'genby', 1, ReportBaseElement::CURRENT_POSITION, ReportBaseElement::CURRENT_POSITION, 0, 0, '', '', true);
+ $element = new ReportHtmlCell(0.0, 10.0, '', 'C', '', 'genby', 1, ReportBaseElement::CURRENT_POSITION, ReportBaseElement::CURRENT_POSITION, false, 0, '', '', true);
$element->addText($this->generated_by);
$element->setUrl(Webtrees::URL);
$this->footerElements[] = $element;
@@ -226,9 +226,9 @@ class HtmlRenderer extends AbstractRenderer
* @param string $bgcolor Background color code
* @param string $style The name of the text style
* @param int $ln Indicates where the current position should go after the call
- * @param mixed $top Y-position
- * @param mixed $left X-position
- * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 1
+ * @param float $top Y-position
+ * @param float $left X-position
+ * @param bool $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 1
* @param int $stretch Stretch character mode
* @param string $bocolor Border color
* @param string $tcolor Text color
@@ -236,7 +236,7 @@ class HtmlRenderer extends AbstractRenderer
*
* @return ReportBaseCell
*/
- public function createCell(float $width, float $height, string $border, string $align, string $bgcolor, string $style, int $ln, $top, $left, int $fill, int $stretch, string $bocolor, string $tcolor, bool $reseth): ReportBaseCell
+ public function createCell(float $width, float $height, string $border, string $align, string $bgcolor, string $style, int $ln, float $top, float $left, bool $fill, int $stretch, string $bocolor, string $tcolor, bool $reseth): ReportBaseCell
{
return new ReportHtmlCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth);
}
@@ -473,7 +473,7 @@ class HtmlRenderer extends AbstractRenderer
}
$style = $this->getStyle($this->currentStyle);
- return (float) $style['size'];
+ return $style['size'];
}
/**
@@ -524,7 +524,7 @@ class HtmlRenderer extends AbstractRenderer
{
$style = $this->getStyle($this->currentStyle);
- return mb_strlen($text) * ($style['size'] / 2);
+ return mb_strlen($text) * $style['size'] / 2;
}
/**
diff --git a/app/Report/PdfRenderer.php b/app/Report/PdfRenderer.php
index 4a47582598..3e493e9319 100644
--- a/app/Report/PdfRenderer.php
+++ b/app/Report/PdfRenderer.php
@@ -207,16 +207,11 @@ class PdfRenderer extends AbstractRenderer
*
* @param string $s Style name
*
- * @return array<string,string>
+ * @return array{'name': string, 'font': string, 'style': string, 'size': float}
*/
public function getStyle(string $s): array
{
- if (!isset($this->styles[$s])) {
- $s = $this->getCurrentStyle();
- $this->styles[$s] = $s;
- }
-
- return $this->styles[$s];
+ return $this->styles[$s] ?? $this->styles[$this->getCurrentStyle()];
}
/**
@@ -283,7 +278,7 @@ class PdfRenderer extends AbstractRenderer
}
$style = $this->getStyle($this->currentStyle);
- return (float) $style['size'];
+ return $style['size'];
}
/**
@@ -386,7 +381,7 @@ class PdfRenderer extends AbstractRenderer
if ($this->show_generated_by) {
// The default style name for Generated by.... is 'genby'
- $element = new ReportPdfCell(0.0, 10.0, '', 'C', '', 'genby', 1, ReportBaseElement::CURRENT_POSITION, ReportBaseElement::CURRENT_POSITION, 0, 0, '', '', true);
+ $element = new ReportPdfCell(0.0, 10.0, '', 'C', '', 'genby', 1, ReportBaseElement::CURRENT_POSITION, ReportBaseElement::CURRENT_POSITION, false, 0, '', '', true);
$element->addText($this->generated_by);
$element->setUrl(Webtrees::URL);
$this->addElementToFooter($element);
@@ -414,9 +409,9 @@ class PdfRenderer extends AbstractRenderer
* @param string $bgcolor Background color code
* @param string $style The name of the text style
* @param int $ln Indicates where the current position should go after the call
- * @param mixed $top Y-position
- * @param mixed $left X-position
- * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 1
+ * @param float $top Y-position
+ * @param float $left X-position
+ * @param bool $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 1
* @param int $stretch Stretch carachter mode
* @param string $bocolor Border color
* @param string $tcolor Text color
@@ -424,7 +419,7 @@ class PdfRenderer extends AbstractRenderer
*
* @return ReportBaseCell
*/
- public function createCell(float $width, float $height, string $border, string $align, string $bgcolor, string $style, int $ln, $top, $left, int $fill, int $stretch, string $bocolor, string $tcolor, bool $reseth): ReportBaseCell
+ public function createCell(float $width, float $height, string $border, string $align, string $bgcolor, string $style, int $ln, float $top, float $left, bool $fill, int $stretch, string $bocolor, string $tcolor, bool $reseth): ReportBaseCell
{
return new ReportPdfCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth);
}
diff --git a/app/Report/ReportBaseCell.php b/app/Report/ReportBaseCell.php
index f1c59d083c..82c49cb46c 100644
--- a/app/Report/ReportBaseCell.php
+++ b/app/Report/ReportBaseCell.php
@@ -47,9 +47,9 @@ class ReportBaseCell extends ReportBaseElement
// The HTML color code to fill the background of this cell.
public string $bgcolor;
- // Indicates if the cell background must be painted (1) or transparent (0). Default value: 1.
+ // Indicates if the cell background must be painted (true) or transparent (false).
// If no background color is set then it will not be painted
- public int $fill;
+ public bool $fill;
// Cell height DEFAULT 0 (expressed in points)
// The starting height of this cell. If the text wraps the height will automatically be adjusted.
@@ -58,10 +58,10 @@ class ReportBaseCell extends ReportBaseElement
/**
* Left position in user units (X-position). Default is the current position
*
- * @var mixed
+ * @var float
*/
- public $left;
+ public float $left;
// Indicates where the current position should go after the call. Possible values are:
// 0: to the right [DEFAULT]
@@ -86,10 +86,10 @@ class ReportBaseCell extends ReportBaseElement
/**
* Top position in user units (Y-position). Default is the current position
*
- * @var mixed
+ * @var float
*/
- public $top;
+ public float $top;
// URL address
public string $url = '';
@@ -110,9 +110,9 @@ class ReportBaseCell extends ReportBaseElement
* @param string $bgcolor Background color code
* @param string $style The name of the text style
* @param int $ln Indicates where the current position should go after the call
- * @param mixed $top Y-position
- * @param mixed $left X-position
- * @param int $fill Indicates if the cell background must be painted (1) or transparent (0).
+ * @param float $top Y-position
+ * @param float $left X-position
+ * @param bool $fill Indicates if the cell background must be painted (1) or transparent (0).
* @param int $stretch Stretch carachter mode
* @param string $bocolor Border color
* @param string $tcolor Text color
@@ -126,9 +126,9 @@ class ReportBaseCell extends ReportBaseElement
string $bgcolor,
string $style,
int $ln,
- $top,
- $left,
- int $fill,
+ float $top,
+ float $left,
+ bool $fill,
int $stretch,
string $bocolor,
string $tcolor,
diff --git a/app/Report/ReportParserBase.php b/app/Report/ReportParserBase.php
index de2611c5dd..d911acb5dd 100644
--- a/app/Report/ReportParserBase.php
+++ b/app/Report/ReportParserBase.php
@@ -62,7 +62,7 @@ class ReportParserBase
{
$this->xml_parser = xml_parser_create();
- xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, false);
+ xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler(
$this->xml_parser,
diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php
index 364ceb5685..0cd6635382 100644
--- a/app/Report/ReportParserGenerate.php
+++ b/app/Report/ReportParserGenerate.php
@@ -51,7 +51,6 @@ use function addslashes;
use function array_pop;
use function array_shift;
use function assert;
-use function call_user_func;
use function count;
use function end;
use function explode;
@@ -98,26 +97,26 @@ use const XML_OPTION_CASE_FOLDING;
*/
class ReportParserGenerate extends ReportParserBase
{
- /** @var bool Are we collecting data from <Footnote> elements */
- private $process_footnote = true;
+ /** Are we collecting data from <Footnote> elements */
+ private bool $process_footnote = true;
- /** @var bool Are we currently outputing data? */
- private $print_data = false;
+ /** Are we currently outputing data? */
+ private bool $print_data = false;
- /** @var bool[] Push-down stack of $print_data */
- private $print_data_stack = [];
+ /** @var array<int,bool> Push-down stack of $print_data */
+ private array $print_data_stack = [];
- /** @var int Are we processing GEDCOM data */
- private $process_gedcoms = 0;
+ /** Are we processing GEDCOM data */
+ private int $process_gedcoms = 0;
- /** @var int Are we processing conditionals */
- private $process_ifs = 0;
+ /** Are we processing conditionals */
+ private int $process_ifs = 0;
- /** @var int Are we processing repeats */
- private $process_repeats = 0;
+ /** Are we processing repeats */
+ private int $process_repeats = 0;
- /** @var int Quantity of data to repeat during loops */
- private $repeat_bytes = 0;
+ /** Quantity of data to repeat during loops */
+ private int $repeat_bytes = 0;
/** @var array<string> Repeated data when iterating over loops */
private array $repeats = [];
@@ -134,10 +133,10 @@ class ReportParserGenerate extends ReportParserBase
/** @var XMLParser[] (resource[] before PHP 8.0) Nested repeating data */
private array $parser_stack = [];
- /** @var string The current GEDCOM record */
- private $gedrec = '';
+ /** The current GEDCOM record */
+ private string $gedrec = '';
- /** @var array<string> Nested GEDCOM records */
+ /** @var array<int,array<int,string>> Nested GEDCOM records */
private array $gedrec_stack = [];
/** @var ReportBaseElement The currently processed element */
@@ -146,26 +145,26 @@ class ReportParserGenerate extends ReportParserBase
/** @var ReportBaseElement The currently processed element */
private $footnote_element;
- /** @var string The GEDCOM fact currently being processed */
- private $fact = '';
+ /** The GEDCOM fact currently being processed */
+ private string $fact = '';
- /** @var string The GEDCOM value currently being processed */
- private $desc = '';
+ /** The GEDCOM value currently being processed */
+ private string $desc = '';
- /** @var string The GEDCOM type currently being processed */
- private $type = '';
+ /** The GEDCOM type currently being processed */
+ private string $type = '';
- /** @var int The current generational level */
- private $generation = 1;
+ /** The current generational level */
+ private int $generation = 1;
/** @var array<static|GedcomRecord> Source data for processing lists */
private array $list = [];
- /** @var int Number of items in lists */
- private $list_total = 0;
+ /** Number of items in lists */
+ private int $list_total = 0;
- /** @var int Number of items filtered from lists */
- private $list_private = 0;
+ /** Number of items filtered from lists */
+ private int $list_private = 0;
/** @var string The filename of the XML report */
protected $report;
@@ -311,7 +310,7 @@ class ReportParserGenerate extends ReportParserBase
$method = $name . 'StartHandler';
if (method_exists($this, $method)) {
- call_user_func([$this, $method], $attrs);
+ $this->{$method}($attrs);
}
}
}
@@ -332,7 +331,7 @@ class ReportParserGenerate extends ReportParserBase
$method = $name . 'EndHandler';
if (method_exists($this, $method)) {
- call_user_func([$this, $method]);
+ $this->{$method}();
}
}
}
@@ -365,32 +364,14 @@ class ReportParserGenerate extends ReportParserBase
throw new DomainException('REPORT ERROR Style: The "name" of the style is missing or not set in the XML file.');
}
- // array Style that will be passed on
- $s = [];
+ $style = [
+ 'name' => $attrs['name'],
+ 'font' => $attrs['font'] ?? $this->wt_report->default_font,
+ 'size' => (float) ($attrs['size'] ?? $this->wt_report->default_font_size),
+ 'style' => $attrs['style'] ?? '',
+ ];
- // string Name af the style
- $s['name'] = $attrs['name'];
-
- // string Name of the DEFAULT font
- $s['font'] = $this->wt_report->default_font;
- if (!empty($attrs['font'])) {
- $s['font'] = $attrs['font'];
- }
-
- // int The size of the font in points
- $s['size'] = $this->wt_report->default_font_size;
- if (!empty($attrs['size'])) {
- // Get it as int to ignore all decimal points or text (if no text then 0)
- $s['size'] = (string) (int) $attrs['size'];
- }
-
- // string B: bold, I: italic, U: underline, D: line trough, The default value is regular.
- $s['style'] = '';
- if (!empty($attrs['style'])) {
- $s['style'] = $attrs['style'];
- }
-
- $this->wt_report->addStyle($s);
+ $this->wt_report->addStyle($style);
}
/**
@@ -407,19 +388,19 @@ class ReportParserGenerate extends ReportParserBase
// Custom page width
if (!empty($attrs['customwidth'])) {
- $this->wt_report->page_width = (int) $attrs['customwidth'];
- } // Get it as int to ignore all decimal points or text (if any text then int(0))
+ $this->wt_report->page_width = (float) $attrs['customwidth'];
+ }
// Custom Page height
if (!empty($attrs['customheight'])) {
- $this->wt_report->page_height = (int) $attrs['customheight'];
- } // Get it as int to ignore all decimal points or text (if any text then int(0))
+ $this->wt_report->page_height = (float) $attrs['customheight'];
+ }
// Left Margin
if (isset($attrs['leftmargin'])) {
if ($attrs['leftmargin'] === '0') {
$this->wt_report->left_margin = 0;
} elseif (!empty($attrs['leftmargin'])) {
- $this->wt_report->left_margin = (int) $attrs['leftmargin']; // Get it as int to ignore all decimal points or text (if any text then int(0))
+ $this->wt_report->left_margin = (float) $attrs['leftmargin'];
}
}
// Right Margin
@@ -427,7 +408,7 @@ class ReportParserGenerate extends ReportParserBase
if ($attrs['rightmargin'] === '0') {
$this->wt_report->right_margin = 0;
} elseif (!empty($attrs['rightmargin'])) {
- $this->wt_report->right_margin = (int) $attrs['rightmargin']; // Get it as int to ignore all decimal points or text (if any text then int(0))
+ $this->wt_report->right_margin = (float) $attrs['rightmargin'];
}
}
// Top Margin
@@ -435,7 +416,7 @@ class ReportParserGenerate extends ReportParserBase
if ($attrs['topmargin'] === '0') {
$this->wt_report->top_margin = 0;
} elseif (!empty($attrs['topmargin'])) {
- $this->wt_report->top_margin = (int) $attrs['topmargin']; // Get it as int to ignore all decimal points or text (if any text then int(0))
+ $this->wt_report->top_margin = (float) $attrs['topmargin'];
}
}
// Bottom Margin
@@ -443,7 +424,7 @@ class ReportParserGenerate extends ReportParserBase
if ($attrs['bottommargin'] === '0') {
$this->wt_report->bottom_margin = 0;
} elseif (!empty($attrs['bottommargin'])) {
- $this->wt_report->bottom_margin = (int) $attrs['bottommargin']; // Get it as int to ignore all decimal points or text (if any text then int(0))
+ $this->wt_report->bottom_margin = (float) $attrs['bottommargin'];
}
}
// Header Margin
@@ -451,7 +432,7 @@ class ReportParserGenerate extends ReportParserBase
if ($attrs['headermargin'] === '0') {
$this->wt_report->header_margin = 0;
} elseif (!empty($attrs['headermargin'])) {
- $this->wt_report->header_margin = (int) $attrs['headermargin']; // Get it as int to ignore all decimal points or text (if any text then int(0))
+ $this->wt_report->header_margin = (float) $attrs['headermargin'];
}
}
// Footer Margin
@@ -459,7 +440,7 @@ class ReportParserGenerate extends ReportParserBase
if ($attrs['footermargin'] === '0') {
$this->wt_report->footer_margin = 0;
} elseif (!empty($attrs['footermargin'])) {
- $this->wt_report->footer_margin = (int) $attrs['footermargin']; // Get it as int to ignore all decimal points or text (if any text then int(0))
+ $this->wt_report->footer_margin = (float) $attrs['footermargin'];
}
}
@@ -560,7 +541,7 @@ class ReportParserGenerate extends ReportParserBase
$bgcolor = $attrs['bgcolor'] ?? '';
// Whether the background should be painted
- $fill = (int) ($attrs['fill'] ?? '0');
+ $fill = (bool) ($attrs['fill'] ?? '0');
// If true reset the last cell height
$reseth = (bool) ($attrs['reseth'] ?? '1');
@@ -586,9 +567,9 @@ class ReportParserGenerate extends ReportParserBase
if ($attrs['left'] === '.') {
$left = ReportBaseElement::CURRENT_POSITION;
} elseif (!empty($attrs['left'])) {
- $left = (int) $attrs['left'];
+ $left = (float) $attrs['left'];
} elseif ($attrs['left'] === '0') {
- $left = 0;
+ $left = 0.0;
}
}
// mixed Position the top corner of this box on the page. the default is the current position
@@ -597,9 +578,9 @@ class ReportParserGenerate extends ReportParserBase
if ($attrs['top'] === '.') {
$top = ReportBaseElement::CURRENT_POSITION;
} elseif (!empty($attrs['top'])) {
- $top = (int) $attrs['top'];
+ $top = (float) $attrs['top'];
} elseif ($attrs['top'] === '0') {
- $top = 0;
+ $top = 0.0;
}
}
@@ -1214,7 +1195,7 @@ class ReportParserGenerate extends ReportParserBase
$this->gedrec = $gedrec;
$repeat_parser = xml_parser_create();
$this->parser = $repeat_parser;
- xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, false);
+ xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler(
$repeat_parser,
@@ -1422,7 +1403,7 @@ class ReportParserGenerate extends ReportParserBase
}
$repeat_parser = xml_parser_create();
$this->parser = $repeat_parser;
- xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, false);
+ xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler(
$repeat_parser,
@@ -2335,7 +2316,7 @@ class ReportParserGenerate extends ReportParserBase
//-- start the sax parser
$repeat_parser = xml_parser_create();
$this->parser = $repeat_parser;
- xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, false);
+ xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler(
$repeat_parser,
@@ -2564,7 +2545,7 @@ class ReportParserGenerate extends ReportParserBase
$repeat_parser = xml_parser_create();
$this->parser = $repeat_parser;
- xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, false);
+ xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler(
$repeat_parser,
diff --git a/app/Report/ReportPdfCell.php b/app/Report/ReportPdfCell.php
index 6f05425f04..90e6fa0a09 100644
--- a/app/Report/ReportPdfCell.php
+++ b/app/Report/ReportPdfCell.php
@@ -56,7 +56,7 @@ class ReportPdfCell extends ReportBaseCell
// Background color
$match = [];
// Indicates if the cell background must be painted (1) or transparent (0)
- if ($this->fill === 1) {
+ if ($this->fill) {
if (!empty($this->bgcolor)) {
// HTML color to RGB
if (preg_match('/#?(..)(..)(..)/', $this->bgcolor, $match)) {
@@ -67,7 +67,7 @@ class ReportPdfCell extends ReportBaseCell
}
} else {
// If no color set then don't fill
- $this->fill = 0;
+ $this->fill = false;
}
}
diff --git a/app/Report/TcpdfWrapper.php b/app/Report/TcpdfWrapper.php
index fe2c2f06f6..46a81bd8be 100644
--- a/app/Report/TcpdfWrapper.php
+++ b/app/Report/TcpdfWrapper.php
@@ -39,13 +39,13 @@ class TcpdfWrapper extends TCPDF
/**
* Expose protected method in base class.
*
- * @param mixed $h Cell height. Default value: 0.
- * @param mixed $y Starting y position, leave empty for current position.
- * @param bool $addpage If true add a page, otherwise only return the true/false state
+ * @param float $h Cell height. Default value: 0.
+ * @param float|null $y Starting y position, leave empty for current position.
+ * @param bool $addpage If true add a page, otherwise only return the true/false state
*
* @return bool true in case of page break, false otherwise.
*/
- public function checkPageBreak($h = 0, $y = '', $addpage = true): bool
+ public function checkPageBreak($h = 0, $y = null, $addpage = true): bool
{
return parent::checkPageBreak($h, $y, $addpage);
}
diff --git a/phpstan-baseline.php b/phpstan-baseline.php
index 0f7915212d..259f4bf02e 100644
--- a/phpstan-baseline.php
+++ b/phpstan-baseline.php
@@ -2339,16 +2339,6 @@ $ignoreErrors[] = [
'path' => __DIR__ . '/app/PlaceLocation.php',
];
$ignoreErrors[] = [
- 'message' => '#^Binary operation "/" between string and 2 results in an error\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/HtmlRenderer.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Method Fisharebest\\\\Webtrees\\\\Report\\\\PdfRenderer\\:\\:getStyle\\(\\) should return array\\<string, string\\> but returns array\\<string, string\\>\\|string\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/PdfRenderer.php',
-];
-$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$fm of method TCPDF\\:\\:setFooterMargin\\(\\) expects int, float given\\.$#',
'count' => 1,
'path' => __DIR__ . '/app/Report/PdfRenderer.php',
@@ -2359,46 +2349,6 @@ $ignoreErrors[] = [
'path' => __DIR__ . '/app/Report/PdfRenderer.php',
];
$ignoreErrors[] = [
- 'message' => '#^Parameter \\#3 \\$size of method TCPDF\\:\\:setFont\\(\\) expects float\\|null, string given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/PdfRenderer.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Property Fisharebest\\\\Webtrees\\\\Report\\\\AbstractRenderer\\:\\:\\$styles \\(array\\<array\\<string, string\\>\\>\\) does not accept array\\<array\\<string, string\\>\\|string\\>\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/PdfRenderer.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Parameter \\#1 \\$x of method Fisharebest\\\\Webtrees\\\\Report\\\\HtmlRenderer\\:\\:setX\\(\\) expects float, mixed given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportHtmlCell.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Parameter \\#1 \\$y of method Fisharebest\\\\Webtrees\\\\Report\\\\HtmlRenderer\\:\\:setY\\(\\) expects float, mixed given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportHtmlCell.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Parameter \\#2 \\$y of method Fisharebest\\\\Webtrees\\\\Report\\\\HtmlRenderer\\:\\:setXy\\(\\) expects float, mixed given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportHtmlCell.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Parameter \\#3 \\(mixed\\) of echo cannot be converted to string\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportHtmlCell.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Parameter \\#4 \\(mixed\\) of echo cannot be converted to string\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportHtmlCell.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Binary operation "\\*" between string and 0\\|int\\<2, max\\> results in an error\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportHtmlText.php',
-];
-$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#',
'count' => 1,
'path' => __DIR__ . '/app/Report/ReportParserBase.php',
@@ -2414,11 +2364,6 @@ $ignoreErrors[] = [
'path' => __DIR__ . '/app/Report/ReportParserBase.php',
];
$ignoreErrors[] = [
- 'message' => '#^Parameter \\#3 \\$value of function xml_parser_set_option expects int\\|string, false given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportParserBase.php',
-];
-$ignoreErrors[] = [
'message' => '#^Access to an undefined property Fisharebest\\\\Webtrees\\\\GedcomRecord\\|static\\(Fisharebest\\\\Webtrees\\\\Report\\\\ReportParserGenerate\\)\\:\\:\\$generation\\.$#',
'count' => 1,
'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
@@ -2529,7 +2474,7 @@ $ignoreErrors[] = [
'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
];
$ignoreErrors[] = [
- 'message' => '#^Cannot use array destructuring on string\\|null\\.$#',
+ 'message' => '#^Cannot use array destructuring on array\\<int, string\\>\\|null\\.$#',
'count' => 1,
'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
];
@@ -2554,11 +2499,6 @@ $ignoreErrors[] = [
'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
];
$ignoreErrors[] = [
- 'message' => '#^Parameter \\#1 \\$callback of function call_user_func expects callable\\(\\)\\: mixed, array\\{\\$this\\(Fisharebest\\\\Webtrees\\\\Report\\\\ReportParserGenerate\\), non\\-falsy\\-string\\} given\\.$#',
- 'count' => 2,
- 'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
-];
-$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$callback of method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:map\\(\\) expects callable\\(mixed, \\(int\\|string\\)\\)\\: Fisharebest\\\\Webtrees\\\\GedcomRecord\\|null, Closure\\(object\\)\\: Fisharebest\\\\Webtrees\\\\GedcomRecord\\|null given\\.$#',
'count' => 1,
'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
@@ -2589,11 +2529,6 @@ $ignoreErrors[] = [
'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
];
$ignoreErrors[] = [
- 'message' => '#^Parameter \\#1 \\$style of method Fisharebest\\\\Webtrees\\\\Report\\\\AbstractRenderer\\:\\:addStyle\\(\\) expects array\\<string\\>, array\\<string, float\\|string\\> given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
-];
-$ignoreErrors[] = [
'message' => '#^Parameter \\#2 \\$callback of function uasort expects callable\\(Fisharebest\\\\Webtrees\\\\GedcomRecord\\|null, Fisharebest\\\\Webtrees\\\\GedcomRecord\\|null\\)\\: int, Closure\\(Fisharebest\\\\Webtrees\\\\Family, Fisharebest\\\\Webtrees\\\\Family\\)\\: int given\\.$#',
'count' => 1,
'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
@@ -2629,21 +2564,11 @@ $ignoreErrors[] = [
'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
];
$ignoreErrors[] = [
- 'message' => '#^Parameter \\#3 \\$value of function xml_parser_set_option expects int\\|string, false given\\.$#',
- 'count' => 4,
- 'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
-];
-$ignoreErrors[] = [
'message' => '#^Property Fisharebest\\\\Webtrees\\\\Report\\\\ReportParserGenerate\\:\\:\\$current_element \\(Fisharebest\\\\Webtrees\\\\Report\\\\ReportBaseElement\\) does not accept Fisharebest\\\\Webtrees\\\\Report\\\\AbstractRenderer\\.$#',
'count' => 1,
'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
];
$ignoreErrors[] = [
- 'message' => '#^Property Fisharebest\\\\Webtrees\\\\Report\\\\ReportParserGenerate\\:\\:\\$gedrec_stack \\(array\\<string\\>\\) does not accept array\\<array\\<int, string\\>\\|string\\>\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
-];
-$ignoreErrors[] = [
'message' => '#^Property Fisharebest\\\\Webtrees\\\\Report\\\\ReportParserGenerate\\:\\:\\$list \\(array\\<Fisharebest\\\\Webtrees\\\\GedcomRecord\\|static\\(Fisharebest\\\\Webtrees\\\\Report\\\\ReportParserGenerate\\)\\>\\) does not accept array\\<Fisharebest\\\\Webtrees\\\\GedcomRecord\\|null\\>\\.$#',
'count' => 1,
'path' => __DIR__ . '/app/Report/ReportParserGenerate.php',
@@ -2709,31 +2634,6 @@ $ignoreErrors[] = [
'path' => __DIR__ . '/app/Report/ReportParserSetup.php',
];
$ignoreErrors[] = [
- 'message' => '#^Parameter \\#1 \\$x of method Fisharebest\\\\Webtrees\\\\Report\\\\PdfRenderer\\:\\:addMarginX\\(\\) expects float, mixed given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportPdfCell.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Parameter \\#1 \\$y of method TCPDF\\:\\:setY\\(\\) expects float, mixed given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportPdfCell.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Parameter \\#2 \\$y of method TCPDF\\:\\:Link\\(\\) expects float, mixed given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportPdfCell.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Parameter \\#6 \\$fill of method TCPDF\\:\\:MultiCell\\(\\) expects bool, int given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportPdfCell.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Parameter \\#9 \\$y of method TCPDF\\:\\:MultiCell\\(\\) expects float\\|null, mixed given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/ReportPdfCell.php',
-];
-$ignoreErrors[] = [
'message' => '#^Method Fisharebest\\\\Webtrees\\\\Report\\\\ReportPdfFootnote\\:\\:getWidth\\(\\) should return array\\{float, int, float\\} but returns array\\{0\\|array\\<float\\>\\|float, 1, int\\<0, max\\>\\}\\.$#',
'count' => 1,
'path' => __DIR__ . '/app/Report/ReportPdfFootnote.php',
@@ -2794,16 +2694,6 @@ $ignoreErrors[] = [
'path' => __DIR__ . '/app/Report/RightToLeftSupport.php',
];
$ignoreErrors[] = [
- 'message' => '#^Parameter \\#1 \\$h of method TCPDF\\:\\:checkPageBreak\\(\\) expects float, mixed given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/TcpdfWrapper.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Parameter \\#2 \\$y of method TCPDF\\:\\:checkPageBreak\\(\\) expects float\\|null, mixed given\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/app/Report/TcpdfWrapper.php',
-];
-$ignoreErrors[] = [
'message' => '#^Cannot access property \\$access_level on mixed\\.$#',
'count' => 1,
'path' => __DIR__ . '/app/Schema/Migration42.php',