diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/Functions/FunctionsEdit.php | 24 | ||||
| -rw-r--r-- | app/Report/ReportBaseCell.php | 10 | ||||
| -rw-r--r-- | app/Report/ReportHtml.php | 2 | ||||
| -rw-r--r-- | app/Report/ReportHtmlCell.php | 2 | ||||
| -rw-r--r-- | app/Report/ReportHtmlFootnote.php | 2 | ||||
| -rw-r--r-- | app/Report/ReportHtmlHtml.php | 2 | ||||
| -rw-r--r-- | app/Report/ReportHtmlText.php | 2 | ||||
| -rw-r--r-- | app/Report/ReportHtmlTextbox.php | 2 | ||||
| -rw-r--r-- | app/Report/ReportParserBase.php | 32 | ||||
| -rw-r--r-- | app/Report/ReportParserGenerate.php | 6 |
10 files changed, 45 insertions, 39 deletions
diff --git a/app/Functions/FunctionsEdit.php b/app/Functions/FunctionsEdit.php index 780a930ac2..16ba7f08d9 100644 --- a/app/Functions/FunctionsEdit.php +++ b/app/Functions/FunctionsEdit.php @@ -283,7 +283,7 @@ class FunctionsEdit * * @param Tree $tree * @param Family|null $family - * @param string[] $attributes + * @param mixed[] $attributes * * @return string */ @@ -303,8 +303,8 @@ class FunctionsEdit /** * Create a form control to select a flag. * - * @param string $flag - * @param string[] $attributes + * @param string $flag + * @param mixed[] $attributes * * @return string */ @@ -326,7 +326,7 @@ class FunctionsEdit * * @param Tree $tree * @param Individual|null $individual - * @param string[] $attributes + * @param mixed[] $attributes * * @return string */ @@ -348,7 +348,7 @@ class FunctionsEdit * * @param Tree $tree * @param Media|null $media - * @param string[] $attributes + * @param mixed[] $attributes * * @return string */ @@ -370,7 +370,7 @@ class FunctionsEdit * * @param Tree $tree * @param Note|null $note - * @param string[] $attributes + * @param mixed[] $attributes * * @return string */ @@ -390,9 +390,9 @@ class FunctionsEdit /** * Create a form control to select a place. * - * @param Tree $tree - * @param string $place - * @param string[] $attributes + * @param Tree $tree + * @param string $place + * @param mixed[] $attributes * * @return string */ @@ -413,7 +413,7 @@ class FunctionsEdit * * @param Tree $tree * @param Repository|null $repository - * @param string[] $attributes + * @param mixed[] $attributes * * @return string */ @@ -435,7 +435,7 @@ class FunctionsEdit * * @param Tree $tree * @param Source|null $source - * @param string[] $attributes + * @param mixed[] $attributes * * @return string */ @@ -457,7 +457,7 @@ class FunctionsEdit * * @param Tree $tree * @param GedcomRecord|null $submitter - * @param string[] $attributes + * @param mixed[] $attributes * * @return string */ diff --git a/app/Report/ReportBaseCell.php b/app/Report/ReportBaseCell.php index d96be217b1..e6d937674a 100644 --- a/app/Report/ReportBaseCell.php +++ b/app/Report/ReportBaseCell.php @@ -58,7 +58,7 @@ class ReportBaseCell extends ReportBaseElement * Cell height DEFAULT 0 (expressed in points) * The starting height of this cell. If the text wraps the height will automatically be adjusted. * - * @var int + * @var float */ public $height; /** @@ -107,11 +107,11 @@ class ReportBaseCell extends ReportBaseElement * Cell width DEFAULT 0 (expressed in points) * Setting the width to 0 will make it the width from the current location to the right margin. * - * @var int + * @var float */ public $width; - /** @var int Unknown */ + /** @var bool */ public $reseth; /** @@ -130,9 +130,9 @@ class ReportBaseCell extends ReportBaseElement * @param int $stretch Stretch carachter mode * @param string $bocolor Border color * @param string $tcolor Text color - * @param $reseth + * @param bool $reseth */ - public function __construct($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth) + public function __construct($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, int $fill, int $stretch, string $bocolor, string $tcolor, bool $reseth) { $this->align = $align; $this->border = $border; diff --git a/app/Report/ReportHtml.php b/app/Report/ReportHtml.php index f42f0040f8..dedc265cb4 100644 --- a/app/Report/ReportHtml.php +++ b/app/Report/ReportHtml.php @@ -105,7 +105,7 @@ class ReportHtml extends AbstractReport * Use this to calculate a the text height. * This makes sure that the text fits into the cell/box when different font sizes are used * - * @var int + * @var float */ public $largestFontHeight = 0; diff --git a/app/Report/ReportHtmlCell.php b/app/Report/ReportHtmlCell.php index 6b5ceb4c08..29080167c1 100644 --- a/app/Report/ReportHtmlCell.php +++ b/app/Report/ReportHtmlCell.php @@ -34,7 +34,7 @@ class ReportHtmlCell extends ReportBaseCell if (strpos($this->text, '{{:ptp:}}') !== false) { return; } - $temptext = str_replace('#PAGENUM#', $renderer->pageNo(), $this->text); + $temptext = str_replace('#PAGENUM#', (string) $renderer->pageNo(), $this->text); // underline «title» part of Source item $temptext = str_replace([ '«', diff --git a/app/Report/ReportHtmlFootnote.php b/app/Report/ReportHtmlFootnote.php index 00bb641ad7..eba7dc0f26 100644 --- a/app/Report/ReportHtmlFootnote.php +++ b/app/Report/ReportHtmlFootnote.php @@ -51,7 +51,7 @@ class ReportHtmlFootnote extends ReportBaseFootnote $html->setCurrentStyle($this->styleName); } - $temptext = str_replace('#PAGENUM#', $html->pageNo(), $this->text); + $temptext = str_replace('#PAGENUM#', (string) $html->pageNo(), $this->text); // underline «title» part of Source item $temptext = str_replace([ '«', diff --git a/app/Report/ReportHtmlHtml.php b/app/Report/ReportHtmlHtml.php index 824cb2a06f..b9c6c74d25 100644 --- a/app/Report/ReportHtmlHtml.php +++ b/app/Report/ReportHtmlHtml.php @@ -29,7 +29,7 @@ class ReportHtmlHtml extends ReportBaseHtml * @param bool $sub * @param bool $inat * - * @return void + * @return void|string */ public function render($renderer, $sub = false, $inat = true) { diff --git a/app/Report/ReportHtmlText.php b/app/Report/ReportHtmlText.php index f82aed00a3..f4d58efd62 100644 --- a/app/Report/ReportHtmlText.php +++ b/app/Report/ReportHtmlText.php @@ -38,7 +38,7 @@ class ReportHtmlText extends ReportBaseText if ($renderer->getCurrentStyle() != $this->styleName) { $renderer->setCurrentStyle($this->styleName); } - $temptext = str_replace('#PAGENUM#', $renderer->pageNo(), $this->text); + $temptext = str_replace('#PAGENUM#', (string) $renderer->pageNo(), $this->text); // underline «title» part of Source item $temptext = str_replace([ '«', diff --git a/app/Report/ReportHtmlTextbox.php b/app/Report/ReportHtmlTextbox.php index ddf561dd01..0b522ec3f4 100644 --- a/app/Report/ReportHtmlTextbox.php +++ b/app/Report/ReportHtmlTextbox.php @@ -110,7 +110,7 @@ class ReportHtmlTextbox extends ReportBaseTextbox } } $this->elements = $newelements; - unset($footnote_element, $lastelement, $links, $newelements); + unset($footnote_element, $lastelement, $newelements); $cP = 0; // Class Padding diff --git a/app/Report/ReportParserBase.php b/app/Report/ReportParserBase.php index d3ee05f02e..a9973c1e89 100644 --- a/app/Report/ReportParserBase.php +++ b/app/Report/ReportParserBase.php @@ -18,8 +18,6 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; use DomainException; -use Fisharebest\Webtrees\Tree; -use function method_exists; /** * Class ReportParserBase @@ -40,20 +38,28 @@ class ReportParserBase public function __construct(string $report) { $this->xml_parser = xml_parser_create(); + xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, false); - xml_set_element_handler($this->xml_parser, [ - $this, - 'startElement', - ], [ - $this, - 'endElement', - ]); - xml_set_character_data_handler($this->xml_parser, [ - $this, - 'characterData', - ]); + + xml_set_element_handler( + $this->xml_parser, + function ($parser, string $name, array $attrs) { + $this->startElement($parser, $name, $attrs); + }, + function ($parser, string $name) { + $this->endElement($parser, $name); + } + ); + + xml_set_character_data_handler( + $this->xml_parser, + function ($parser, $data) { + $this->characterData($parser, $data); + } + ); $fp = fopen($report, 'r'); + while (($data = fread($fp, 4096))) { if (!xml_parse($this->xml_parser, $data, feof($fp))) { throw new DomainException(sprintf( diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php index 726e56fae0..ab63e4b5c9 100644 --- a/app/Report/ReportParserGenerate.php +++ b/app/Report/ReportParserGenerate.php @@ -153,11 +153,11 @@ class ReportParserGenerate extends ReportParserBase * * @param resource $parser the resource handler for the XML parser * @param string $name the name of the XML element parsed - * @param array $attrs an array of key value pairs for the attributes + * @param string[] $attrs an array of key value pairs for the attributes * * @return void */ - protected function startElement($parser, $name, $attrs) + protected function startElement($parser, string $name, array $attrs) { $newattrs = []; @@ -192,7 +192,7 @@ class ReportParserGenerate extends ReportParserBase * * @return void */ - protected function endElement($parser, $name) + protected function endElement($parser, string $name) { if (($this->process_footnote || $name === 'Footnote') && ($this->process_ifs === 0 || $name === 'if') && ($this->process_gedcoms === 0 || $name === 'Gedcom') && ($this->process_repeats === 0 || $name === 'Facts' || $name === 'RepeatTag' || $name === 'List' || $name === 'Relatives')) { $start_method = $name . 'StartHandler'; |
